uihelpers: Fix error showing dialog if default pool isn't started

This commit is contained in:
Cole Robinson 2013-07-09 09:12:26 -04:00
parent 194cb715a3
commit bbf54d7a08
3 changed files with 10 additions and 10 deletions

View File

@ -1268,7 +1268,7 @@ class vmmAddHardware(vmmGObjectUI):
# Make sure default pool is running
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:
return False

View File

@ -1642,7 +1642,7 @@ class vmmCreate(vmmGObjectUI):
# Make sure default pool is running
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:
return False

View File

@ -116,13 +116,13 @@ def update_host_space(conn, widget):
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)
if default_pool and not default_pool.is_active():
res = err_dial.yes_no(_("Default pool is not active."),
_("Storage pool '%s' is not active. "
"Would you like to start the pool "
"now?") % default_pool.get_name())
res = err.yes_no(_("Default pool is not active."),
_("Storage pool '%s' is not active. "
"Would you like to start the pool "
"now?") % default_pool.get_name())
if not res:
return False
@ -131,9 +131,9 @@ def check_default_pool_active(topwin, conn):
default_pool.start()
logging.info("Started pool '%s'", default_pool.get_name())
except Exception, e:
return topwin.err.show_err(_("Could not start storage_pool "
"'%s': %s") %
(default_pool.get_name(), str(e)))
return err.show_err(_("Could not start storage_pool "
"'%s': %s") %
(default_pool.get_name(), str(e)))
return True
#####################################################