create: Ask to start default pool if it is inactive

This commit is contained in:
Cole Robinson
2010-05-13 10:37:46 -04:00
parent cb1385e465
commit 85acd6ecab
3 changed files with 33 additions and 0 deletions

View File

@@ -1090,6 +1090,12 @@ class vmmAddHardware(gobject.GObject):
def validate_page_storage(self):
bus, device = self.get_config_disk_target()
# Make sure default pool is running
if self.is_default_storage():
ret = uihelpers.check_default_pool_active(self.topwin, self.conn)
if not ret:
return False
readonly = False
if device == virtinst.VirtualDisk.DEVICE_CDROM:
readonly=True

View File

@@ -1320,6 +1320,12 @@ class vmmCreate(gobject.GObject):
if not use_storage:
return True
# Make sure default pool is running
if self.is_default_storage():
ret = uihelpers.check_default_pool_active(self.topwin, self.conn)
if not ret:
return False
try:
# This can error out
diskpath, disksize, sparse = self.get_storage_info()

View File

@@ -104,6 +104,27 @@ def host_space_tick(conn, config, widget):
return 1
def check_default_pool_active(topwin, 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())
if not res:
return False
# Try to start the pool
try:
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)),
"".join(traceback.format_exc()))
return True
#####################################################
# Hardware model list building (for details, addhw) #
#####################################################