mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
create: Ask to start default pool if it is inactive
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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) #
|
||||
#####################################################
|
||||
|
||||
Reference in New Issue
Block a user