virtinst: Remove redundant LiveCDInstaller

DistroInstaller can basically do the same thing. This also gives us distro
detection when using virt-install --livecd
This commit is contained in:
Cole Robinson 2014-09-07 13:42:56 -04:00
parent 1247e8d43e
commit a8843e5807
6 changed files with 13 additions and 24 deletions

View File

@ -281,8 +281,10 @@ def make_distro_installer(location="/dev/default-pool/default-vol"):
def make_live_installer(location="/dev/null"): def make_live_installer(location="/dev/null"):
inst = virtinst.LiveCDInstaller(_conn) inst = virtinst.DistroInstaller(_conn)
inst.location = location inst.location = location
inst.livecd = True
inst.cdrom = True
return inst return inst

View File

@ -419,14 +419,12 @@ def show_warnings(options, guest):
def build_installer(options, conn, virt_type): def build_installer(options, conn, virt_type):
# Build the Installer instance # Build the Installer instance
if options.livecd: if options.pxe:
instclass = virtinst.LiveCDInstaller
elif options.pxe:
if options.nonetworks: if options.nonetworks:
fail(_("Can't use --pxe with --nonetworks")) fail(_("Can't use --pxe with --nonetworks"))
instclass = virtinst.PXEInstaller instclass = virtinst.PXEInstaller
elif options.cdrom or options.location: elif options.cdrom or options.location or options.livecd:
instclass = virtinst.DistroInstaller instclass = virtinst.DistroInstaller
elif virt_type == "exe": elif virt_type == "exe":
instclass = virtinst.ContainerInstaller instclass = virtinst.ContainerInstaller
@ -440,9 +438,9 @@ def build_installer(options, conn, virt_type):
else: else:
instclass = virtinst.DistroInstaller instclass = virtinst.DistroInstaller
# Only set installer params here that impact the hw config, not
# anything to do with install media
installer = instclass(conn) installer = instclass(conn)
if options.livecd:
installer.livecd = True
return installer return installer

View File

@ -65,7 +65,7 @@ from virtinst.devicerng import VirtualRNGDevice
from virtinst.devicepanic import VirtualPanicDevice from virtinst.devicepanic import VirtualPanicDevice
from virtinst.installer import (ContainerInstaller, ImportInstaller, from virtinst.installer import (ContainerInstaller, ImportInstaller,
LiveCDInstaller, PXEInstaller, Installer) PXEInstaller, Installer)
from virtinst.distroinstaller import DistroInstaller from virtinst.distroinstaller import DistroInstaller

View File

@ -449,6 +449,9 @@ class DistroInstaller(Installer):
# Public installer impls # # Public installer impls #
########################## ##########################
def has_install_phase(self):
return not self.livecd
def scratchdir_required(self): def scratchdir_required(self):
if not self.location: if not self.location:
return False return False

View File

@ -322,8 +322,8 @@ class Guest(XMLBuilder):
Return the full Guest xml configuration. Return the full Guest xml configuration.
@param install: Whether we want the 'OS install' configuration or @param install: Whether we want the 'OS install' configuration or
the 'post-install' configuration. (Some Installers, the 'post-install' configuration. (Some installs,
like the LiveCDInstaller may not have an 'install' like an import or livecd may not have an 'install'
config.) config.)
@type install: C{bool} @type install: C{bool}
@param disk_boot: Whether we should boot off the harddisk, regardless @param disk_boot: Whether we should boot off the harddisk, regardless

View File

@ -244,20 +244,6 @@ class PXEInstaller(Installer):
return bootdev return bootdev
class LiveCDInstaller(Installer):
_has_install_phase = False
cdrom = True
def _validate_location(self, val):
return self._make_cdrom_dev(val).path
def _prepare(self, guest, meter):
ignore = guest
ignore = meter
self.install_devices.append(self._make_cdrom_dev(self.location))
def _get_bootdev(self, isinstall, guest):
return OSXML.BOOT_DEVICE_CDROM
class ImportInstaller(Installer): class ImportInstaller(Installer):
_has_install_phase = False _has_install_phase = False