virtinst: install: simplify has_install_phase()

This commit is contained in:
Cole Robinson
2013-04-14 16:31:18 -04:00
parent 0f57dae8b2
commit 4107646bf3
4 changed files with 12 additions and 15 deletions

View File

@@ -32,7 +32,11 @@ class ImageInstallerException(Exception):
class ImageInstaller(Installer.Installer):
"""Installer for image-based guests"""
"""
Installer for virt-image-based guests
"""
_has_install_phase = False
def __init__(self, image, capabilities=None, boot_index=None, conn=None):
Installer.Installer.__init__(self, conn=conn, caps=capabilities)
@@ -102,9 +106,6 @@ class ImageInstaller(Installer.Installer):
self.bootconfig.initrd = self.boot_caps.initrd
self.bootconfig.kernel_args = self.boot_caps.cmdline
def has_install_phase(self):
return False
# Private methods
def _get_bootdev(self, isinstall, guest):
return self.boot_caps.bootdev

View File

@@ -30,14 +30,12 @@ class ImportInstaller(Installer.Installer):
attached to the Guest (so, one of 'hd', 'cdrom', or 'fd'). All the
user has to do is fill in the Guest object with the desired parameters.
"""
_has_install_phase = False
# General Installer methods
def prepare(self, guest, meter):
pass
def has_install_phase(self):
return False
# Private methods
def _get_bootdev(self, isinstall, guest):
disks = guest.get_devices("disk")

View File

@@ -75,8 +75,9 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
- Hypervisor name (parameter 'type') ('qemu', 'kvm', 'xen', etc.)
- Guest architecture ('i686', 'x86_64')
"""
_dumpxml_xpath = "/domain/os"
_has_install_phase = True
def __init__(self, type="xen", location=None,
extraargs=None, os_type=None, conn=None,
parsexml=None, parsexmlnode=None, caps=None):
@@ -380,7 +381,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
into the guest. Things like LiveCDs, Import, or a manually specified
bootorder do not have an install phase.
"""
return True
return self._has_install_phase
def cleanup(self):
"""
@@ -448,6 +449,8 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
class ContainerInstaller(Installer):
_has_install_phase = False
def prepare(self, guest, meter):
ignore = guest
ignore = meter
@@ -456,6 +459,3 @@ class ContainerInstaller(Installer):
ignore = isinstall
ignore = guest
return self.bootconfig.BOOT_DEVICE_HARDDISK
def has_install_phase(self):
return False

View File

@@ -29,6 +29,7 @@ class LiveCDInstallerException(Exception):
class LiveCDInstaller(Installer.Installer):
_has_install_phase = False
# LiveCD specific methods/overwrites
def _validate_location(self, val):
@@ -68,9 +69,6 @@ class LiveCDInstaller(Installer.Installer):
self.install_devices.append(disk)
def has_install_phase(self):
return False
# Internal methods
def _get_bootdev(self, isinstall, guest):
return self.bootconfig.BOOT_DEVICE_CDROM