mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 18:55:29 +03:00
uihelpers: Fix error showing dialog if default pool isn't started
This commit is contained in:
parent
194cb715a3
commit
bbf54d7a08
@ -1268,7 +1268,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
|
|
||||||
# Make sure default pool is running
|
# Make sure default pool is running
|
||||||
if self.is_default_storage():
|
if self.is_default_storage():
|
||||||
ret = uihelpers.check_default_pool_active(self.topwin, self.conn)
|
ret = uihelpers.check_default_pool_active(self.err, self.conn)
|
||||||
if not ret:
|
if not ret:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1642,7 +1642,7 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
|
|
||||||
# Make sure default pool is running
|
# Make sure default pool is running
|
||||||
if self.is_default_storage():
|
if self.is_default_storage():
|
||||||
ret = uihelpers.check_default_pool_active(self.topwin, self.conn)
|
ret = uihelpers.check_default_pool_active(self.err, self.conn)
|
||||||
if not ret:
|
if not ret:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -116,13 +116,13 @@ def update_host_space(conn, widget):
|
|||||||
widget.set_markup(hd_label)
|
widget.set_markup(hd_label)
|
||||||
|
|
||||||
|
|
||||||
def check_default_pool_active(topwin, conn):
|
def check_default_pool_active(err, conn):
|
||||||
default_pool = util.get_default_pool(conn)
|
default_pool = util.get_default_pool(conn)
|
||||||
if default_pool and not default_pool.is_active():
|
if default_pool and not default_pool.is_active():
|
||||||
res = err_dial.yes_no(_("Default pool is not active."),
|
res = err.yes_no(_("Default pool is not active."),
|
||||||
_("Storage pool '%s' is not active. "
|
_("Storage pool '%s' is not active. "
|
||||||
"Would you like to start the pool "
|
"Would you like to start the pool "
|
||||||
"now?") % default_pool.get_name())
|
"now?") % default_pool.get_name())
|
||||||
if not res:
|
if not res:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -131,9 +131,9 @@ def check_default_pool_active(topwin, conn):
|
|||||||
default_pool.start()
|
default_pool.start()
|
||||||
logging.info("Started pool '%s'", default_pool.get_name())
|
logging.info("Started pool '%s'", default_pool.get_name())
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
return topwin.err.show_err(_("Could not start storage_pool "
|
return err.show_err(_("Could not start storage_pool "
|
||||||
"'%s': %s") %
|
"'%s': %s") %
|
||||||
(default_pool.get_name(), str(e)))
|
(default_pool.get_name(), str(e)))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user