Use check_path_search_for_qemu

Used in create wizard, addhw, and choosecd.
This commit is contained in:
Cole Robinson 2009-12-01 12:35:04 -05:00
parent 86e955b30d
commit c4db9569e8
4 changed files with 28 additions and 4 deletions

View File

@ -84,6 +84,7 @@ class vmmAddHardware(gobject.GObject):
self.__gobject_init__()
self.config = config
self.vm = vm
self.conn = vm.get_connection()
self.window = gtk.glade.XML(config.get_glade_dir() + "/vmm-add-hardware.glade", "vmm-add-hardware", domain="virt-manager")
self.topwin = self.window.get_widget("vmm-add-hardware")
self.err = vmmErrorDialog(self.topwin,
@ -1197,7 +1198,13 @@ class vmmAddHardware(gobject.GObject):
res = self.err.yes_no(
_('Disk "%s" is already in use by another guest!' % self._dev),
_("Do you really want to use the disk?"))
return res
if not res:
return False
uihelpers.check_path_search_for_qemu(self.topwin, self.config,
self.conn, self._dev.path)
def validate_page_network(self):
nettype, devname = self.get_config_network()

View File

@ -35,12 +35,13 @@ class vmmChooseCD(gobject.GObject):
def __init__(self, config, dev_id_info, connection):
self.__gobject_init__()
self.window = gtk.glade.XML(config.get_glade_dir() + "/vmm-choose-cd.glade", "vmm-choose-cd", domain="virt-manager")
self.err = vmmErrorDialog(self.window.get_widget("vmm-choose-cd"),
self.topwin = self.window.get_widget("vmm-choose-cd")
self.topwin.hide()
self.err = vmmErrorDialog(self.topwin,
0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
_("Unexpected Error"),
_("An unexpected error occurred"))
self.topwin = self.window.get_widget("vmm-choose-cd")
self.topwin.hide()
self.config = config
self.dev_id_info = dev_id_info
@ -107,6 +108,9 @@ class vmmChooseCD(gobject.GObject):
except Exception, e:
return self.err.val_err(_("Invalid Media Path"), str(e))
uihelpers.check_path_search_for_qemu(self.topwin, self.config,
self.conn, self._dev.path)
self.emit("cdrom-chosen", self.dev_id_info, disk.path, disk.type)
self.cancel()

View File

@ -1182,6 +1182,11 @@ class vmmCreate(gobject.GObject):
return self.err.val_err(_("Error setting OS information."),
str(e))
if instmethod == INSTALL_PAGE_ISO and not revalidate:
uihelpers.check_path_search_for_qemu(self.topwin, self.config,
self.conn,
self.guest.installer.location)
# Validation passed, store the install path (if there is one) in
# gconf
self.get_config_local_media(store_media=True)
@ -1247,6 +1252,10 @@ class vmmCreate(gobject.GObject):
if not res:
return False
if not revalidate:
uihelpers.check_path_search_for_qemu(self.topwin, self.config,
self.conn, disk.path)
return True
def validate_final_page(self):

View File

@ -34,6 +34,10 @@ OPTICAL_IS_MEDIA_PRESENT = 2
OPTICAL_DEV_KEY = 3
OPTICAL_MEDIA_KEY = 4
# What user we guess the qemu:///system starts the emulator as. Some distros
# may use a nonroot user, so simply changing this will cause several UI
# pieces to attempt to verify that permissions are correct. Eventually this
# should be exposed via capabilities so we can determine this programmatically.
QEMU_SYSTEM_EMULATOR_USER = "root"
##############################################################