virtinst: Guest: remove legacy 'boot' handling
This commit is contained in:
parent
7a47465ab6
commit
248a1a509f
|
@ -149,12 +149,15 @@ def get_basic_paravirt_guest(installer=None):
|
|||
g.memory = int(200)
|
||||
g.maxmemory = int(400)
|
||||
g.uuid = "12345678-1234-1234-1234-123456789012"
|
||||
g.boot = ["/boot/vmlinuz", "/boot/initrd"]
|
||||
g.add_device(VirtualGraphics("vnc", keymap="ja"))
|
||||
g.vcpus = 5
|
||||
|
||||
if installer:
|
||||
g.installer = installer
|
||||
else:
|
||||
instboot = getattr(g.installer, "_install_bootconfig")
|
||||
instboot.kernel = "/boot/vmlinuz"
|
||||
instboot.initrd = "/boot/initrd"
|
||||
|
||||
g.installer._scratchdir = scratch
|
||||
return g
|
||||
|
|
|
@ -150,12 +150,6 @@ args = {
|
|||
|
||||
'installer' : {
|
||||
'init_conns' : [ testconn, None ],
|
||||
'boot' : {
|
||||
'invalid' : ['', 0, ('1element'), ['1el', '2el', '3el'],
|
||||
{'1element': '1val'},
|
||||
{'kernel' : 'a', 'wronglabel' : 'b'}],
|
||||
'valid' : [('kern', 'init'), ['kern', 'init'],
|
||||
{ 'kernel' : 'a', 'initrd' : 'b'}]},
|
||||
'extraargs' : {
|
||||
'invalid' : [],
|
||||
'valid' : ['someargs']},
|
||||
|
|
|
@ -154,10 +154,10 @@ def _upload_file(conn, meter, destpool, src):
|
|||
|
||||
|
||||
class DistroInstaller(Installer.Installer):
|
||||
def __init__(self, type="xen", location=None, boot=None,
|
||||
def __init__(self, type="xen", location=None,
|
||||
extraargs=None, os_type=None,
|
||||
conn=None, caps=None):
|
||||
Installer.Installer.__init__(self, type, location, boot, extraargs,
|
||||
Installer.Installer.__init__(self, type, location, extraargs,
|
||||
os_type, conn=conn, caps=caps)
|
||||
|
||||
self._livecd = False
|
||||
|
|
|
@ -535,13 +535,6 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._installer.scratchdir
|
||||
scratchdir = property(get_scratchdir)
|
||||
|
||||
# Deprecated: Should be called from the installer directly
|
||||
def get_boot(self):
|
||||
return self._installer.boot
|
||||
def set_boot(self, val):
|
||||
self._installer.boot = val
|
||||
boot = property(get_boot, set_boot)
|
||||
|
||||
# Deprecated: Should be called from the installer directly
|
||||
def get_extraargs(self):
|
||||
return self._installer.extraargs
|
||||
|
|
|
@ -80,7 +80,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
"""
|
||||
|
||||
_dumpxml_xpath = "/domain/os"
|
||||
def __init__(self, type="xen", location=None, boot=None,
|
||||
def __init__(self, type="xen", location=None,
|
||||
extraargs=None, os_type=None, conn=None,
|
||||
parsexml=None, parsexmlnode=None, caps=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
|
@ -121,8 +121,6 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
if not location is None:
|
||||
self.location = location
|
||||
|
||||
if not boot is None:
|
||||
self.boot = boot
|
||||
self.extraargs = extraargs
|
||||
|
||||
self._tmpfiles = []
|
||||
|
@ -218,38 +216,6 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self._initrd_injections = val
|
||||
initrd_injections = property(get_initrd_injections, set_initrd_injections)
|
||||
|
||||
# kernel + initrd pair to use for installing as opposed to using a location
|
||||
def get_boot(self):
|
||||
return {"kernel" : self._install_bootconfig.kernel,
|
||||
"initrd" : self._install_bootconfig.initrd}
|
||||
def set_boot(self, val):
|
||||
self.cdrom = False
|
||||
boot = {}
|
||||
if type(val) == tuple:
|
||||
if len(val) != 2:
|
||||
raise ValueError(_("Must pass both a kernel and initrd"))
|
||||
(k, i) = val
|
||||
boot = {"kernel": k, "initrd": i}
|
||||
|
||||
elif type(val) == dict:
|
||||
if "kernel" not in val or "initrd" not in val:
|
||||
raise ValueError(_("Must pass both a kernel and initrd"))
|
||||
boot = val
|
||||
|
||||
elif type(val) == list:
|
||||
if len(val) != 2:
|
||||
raise ValueError(_("Must pass both a kernel and initrd"))
|
||||
boot = {"kernel": val[0], "initrd": val[1]}
|
||||
|
||||
else:
|
||||
raise ValueError(_("Kernel and initrd must be specified by "
|
||||
"a list, dict, or tuple."))
|
||||
|
||||
self._install_bootconfig.kernel = boot.get("kernel")
|
||||
self._install_bootconfig.initrd = boot.get("initrd")
|
||||
|
||||
boot = property(get_boot, set_boot)
|
||||
|
||||
# extra arguments to pass to the guest installer
|
||||
def get_extra_args(self):
|
||||
return self._install_bootconfig.kernel_args
|
||||
|
|
Loading…
Reference in New Issue