Installer: Drop hard to manage install_bootconfig

This commit is contained in:
Cole Robinson 2013-07-16 20:05:24 -04:00
parent 00d41be5c5
commit 07215853b3
4 changed files with 33 additions and 28 deletions

View File

@ -184,9 +184,8 @@ def get_basic_paravirt_guest(installer=None):
if installer:
g.installer = installer
else:
instboot = getattr(g.installer, "_install_bootconfig")
instboot.kernel = "/boot/vmlinuz"
instboot.initrd = "/boot/initrd"
g.installer._install_kernel = "/boot/vmlinuz"
g.installer._install_initrd = "/boot/initrd"
g.installer._scratchdir = scratch
g.add_default_input_device()

View File

@ -99,10 +99,9 @@ class TestXMLConfig(unittest.TestCase):
dom.destroy()
# Replace kernel/initrd with known info
if (guest.installer._install_bootconfig and
guest.installer._install_bootconfig.kernel):
guest.installer._install_bootconfig.kernel = "kernel"
guest.installer._install_bootconfig.initrd = "initrd"
if guest.installer._install_kernel:
guest.installer._install_kernel = "kernel"
guest.installer._install_initrd = "initrd"
xmlinst = guest.get_xml_config(True, False)
xmlboot = guest.get_xml_config(False, False)

View File

@ -282,7 +282,7 @@ class DistroInstaller(Installer.Installer):
disk.transient = True
# Make sure we always fetch kernel here if required
if self._install_bootconfig.kernel and not self.scratchdir_required():
if self._install_kernel and not self.scratchdir_required():
return disk
# Need to fetch the kernel & initrd from a remote site, or
@ -315,9 +315,9 @@ class DistroInstaller(Installer.Installer):
meter, kernelfn, initrdfn)
self._tmpvols += tmpvols
self._install_bootconfig.kernel = kernelfn
self._install_bootconfig.initrd = initrdfn
self._install_bootconfig.kernel_args = args
self._install_kernel = kernelfn
self._install_initrd = initrdfn
self._install_args = args
return disk

View File

@ -74,8 +74,11 @@ class Installer(XMLBuilder):
self._machine = None
self._loader = None
self._init = None
self._install_bootconfig = Boot(self.conn)
self._bootconfig = Boot(self.conn, parsexml, parsexmlnode)
self.bootconfig = Boot(self.conn, parsexml, parsexmlnode)
self._install_kernel = None
self._install_initrd = None
self._install_args = None
# Devices created/added during the prepare() stage
self.install_devices = []
@ -95,10 +98,6 @@ class Installer(XMLBuilder):
# XML related props #
#####################
def _get_bootconfig(self):
return self._bootconfig
bootconfig = property(_get_bootconfig)
# Hypervisor name (qemu, kvm, xen, lxc, etc.)
def get_type(self):
return self._type
@ -187,9 +186,9 @@ class Installer(XMLBuilder):
initrd_injections = property(get_initrd_injections, set_initrd_injections)
def get_extra_args(self):
return self._install_bootconfig.kernel_args
return self._install_args
def set_extra_args(self, val):
self._install_bootconfig.kernel_args = val
self._install_args = val
extraargs = property(get_extra_args, set_extra_args)
@ -223,7 +222,12 @@ class Installer(XMLBuilder):
return scratch
def _build_boot_order(self, isinstall, guest):
bootorder = [self._get_bootdev(isinstall, guest)]
bootdev = self._get_bootdev(isinstall, guest)
if bootdev is None:
# None here means 'kernel boot'
return []
bootorder = [bootdev]
# If guest has an attached disk, always have 'hd' in the boot
# list, so disks are marked as bootable/installable (needed for
@ -316,20 +320,24 @@ class Installer(XMLBuilder):
"""
# pylint: disable=W0221
# Argument number differs from overridden method
if isinstall:
bootconfig = self._install_bootconfig
else:
bootconfig = self.bootconfig
if isinstall and not self.has_install_phase():
return
bootconfig = self.bootconfig.copy()
bootorder = self._build_boot_order(isinstall, guest)
bootconfig = copy.copy(bootconfig)
if not bootconfig.bootorder:
bootconfig.bootorder = bootorder
if isinstall:
bootconfig = bootconfig.copy()
if self._install_kernel:
bootconfig.kernel = self._install_kernel
if self._install_initrd:
bootconfig.initrd = self._install_initrd
if self._install_args:
bootconfig.kernel_args = self._install_args
return self._get_osblob_helper(guest, isinstall, bootconfig)
@ -442,7 +450,6 @@ class Installer(XMLBuilder):
class ContainerInstaller(Installer):
_has_install_phase = False
def _get_bootdev(self, isinstall, guest):
ignore = isinstall
ignore = guest