connection: Clean up usage of get_type
Move users to either get_driver or is_* functions, which are self documenting.
This commit is contained in:
parent
0b094377b9
commit
f635c176e7
|
@ -453,7 +453,7 @@ class vmmAddHardware(gobject.GObject):
|
|||
add_dev("usb", virtinst.VirtualDisk.DEVICE_DISK, "USB disk")
|
||||
if self.vm.get_hv_type().lower() == "kvm":
|
||||
add_dev("virtio", virtinst.VirtualDisk.DEVICE_DISK, "Virtio Disk")
|
||||
if self.vm.get_connection().get_type().lower() == "xen":
|
||||
if self.vm.get_connection().is_xen():
|
||||
add_dev("xen", virtinst.VirtualDisk.DEVICE_DISK, "Virtual disk")
|
||||
|
||||
def populate_input_model(self, model):
|
||||
|
|
|
@ -558,7 +558,7 @@ class vmmConfig:
|
|||
folder)
|
||||
|
||||
def get_default_image_dir(self, connection):
|
||||
if connection.get_type() == "Xen":
|
||||
if connection.is_xen():
|
||||
return DEFAULT_XEN_IMAGE_DIR
|
||||
|
||||
if (connection.is_qemu_session() or
|
||||
|
@ -570,7 +570,7 @@ class vmmConfig:
|
|||
return DEFAULT_VIRT_IMAGE_DIR
|
||||
|
||||
def get_default_save_dir(self, connection):
|
||||
if connection.get_type() == "Xen":
|
||||
if connection.is_xen():
|
||||
return DEFAULT_XEN_SAVE_DIR
|
||||
elif os.access(DEFAULT_VIRT_SAVE_DIR, os.W_OK):
|
||||
return DEFAULT_VIRT_SAVE_DIR
|
||||
|
|
|
@ -141,11 +141,6 @@ class vmmConnection(gobject.GObject):
|
|||
def get_uri(self):
|
||||
return self.uri
|
||||
|
||||
def get_type(self):
|
||||
if self.vmm is None:
|
||||
return None
|
||||
return self.vmm.getType()
|
||||
|
||||
def get_capabilities(self):
|
||||
return virtinst.CapabilitiesParser.parse(self.vmm.getCapabilities())
|
||||
|
||||
|
|
|
@ -1275,10 +1275,10 @@ class vmmCreate(gobject.GObject):
|
|||
def guest_from_install_type(self):
|
||||
instmeth = self.get_config_install_page()
|
||||
|
||||
conntype = self.conn.get_type().lower()
|
||||
if conntype not in ["xen", "test"]:
|
||||
if not self.conn.is_xen() and not self.conn.is_test_conn():
|
||||
return
|
||||
|
||||
conntype = self.conn.get_driver()
|
||||
# FIXME: some things are dependent on domain type (vcpu max)
|
||||
if instmeth == INSTALL_PAGE_URL:
|
||||
self.change_caps(gtype = "xen", dtype = conntype)
|
||||
|
|
|
@ -1131,7 +1131,7 @@ class vmmManager(gobject.GObject):
|
|||
conn.pause()
|
||||
|
||||
def _connect_error(self, conn, details):
|
||||
if conn.get_driver() == "xen" and not conn.is_remote():
|
||||
if conn.is_xen() and not conn.is_remote():
|
||||
self.err.show_err(_("Unable to open a connection to the Xen hypervisor/daemon.\n\n" +
|
||||
"Verify that:\n" +
|
||||
" - A Xen host kernel was booted\n" +
|
||||
|
|
Loading…
Reference in New Issue