[virt-tools-list] [PATCH] Add support for setting BIOS path using -boot loader=PATH
Daniel P. Berrange
berrange at redhat.com
Tue Apr 10 14:01:11 UTC 2012
From: "Daniel P. Berrange" <berrange at redhat.com>
Support setting the <loader> XML element to the BIOS path
using -boot loader=PATH. The same loader must be used both
for the initial VM install and post-install configs
---
man/en/virt-install.pod.in | 5 +++++
virtinst/Boot.py | 12 ++++++++++++
virtinst/Installer.py | 11 +++++++++--
virtinst/cli.py | 3 +++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/man/en/virt-install.pod.in b/man/en/virt-install.pod.in
index 460d95e..45ebc46 100644
--- a/man/en/virt-install.pod.in
+++ b/man/en/virt-install.pod.in
@@ -357,6 +357,11 @@ network PXE boot. Additionally enable BIOS boot menu prompt.
Have guest permanently boot off a local kernel/initrd pair, with the
specified kernel options.
+=item B<--boot loader=BIOSPATH>
+
+Use BIOSPATH as the virtual machine BIOS. Only valid for fully virtualized
+guests.
+
=back
=back
diff --git a/virtinst/Boot.py b/virtinst/Boot.py
index e8ef539..5e71525 100644
--- a/virtinst/Boot.py
+++ b/virtinst/Boot.py
@@ -43,6 +43,7 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
self._kernel = None
self._initrd = None
self._kernel_args = None
+ self._loader = None
def _get_enable_bootmenu(self):
return self._enable_bootmenu
@@ -93,9 +94,20 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
kernel_args = _xml_property(_get_kernel_args, _set_kernel_args,
xpath="./os/cmdline")
+ def _get_loader(self):
+ return self._loader
+ def _set_loader(self, val):
+ self._loader = val
+ loader = _xml_property(_get_loader, _set_loader,
+ xpath="./os/loader")
+
def _get_xml_config(self):
xml = ""
+ if self.loader:
+ xml = _util.xml_append(xml, " <loader>%s</loader>" %
+ _util.xml_escape(self.loader))
+
if self.kernel:
xml = _util.xml_append(xml, " <kernel>%s</kernel>" %
_util.xml_escape(self.kernel))
diff --git a/virtinst/Installer.py b/virtinst/Installer.py
index 0e1a714..108ea6a 100644
--- a/virtinst/Installer.py
+++ b/virtinst/Installer.py
@@ -121,6 +121,10 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
return self._bootconfig
bootconfig = property(_get_bootconfig)
+ def _get_install_bootconfig(self):
+ return self._install_bootconfig
+ install_bootconfig = property(_get_install_bootconfig)
+
# Hypervisor name (qemu, kvm, xen, lxc, etc.)
def get_type(self):
return self._type
@@ -324,8 +328,11 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
hvxen = (hvtype == "xen")
- if not loader and self.is_hvm() and hvxen:
- loader = "/usr/lib/xen/boot/hvmloader"
+ if not loader and self.is_hvm():
+ if self.install_bootconfig.loader:
+ loader = self.install_bootconfig.loader
+ elif hvxen:
+ loader = "/usr/lib/xen/boot/hvmloader"
# Use older libvirt 'linux' value for back compat
if os_type == "xen" and hvxen:
diff --git a/virtinst/cli.py b/virtinst/cli.py
index d846209..99e6ea7 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1370,6 +1370,8 @@ def parse_boot(guest, optstring):
return
setattr(guest.installer.bootconfig, paramname, val)
+ if paramname == "loader":
+ setattr(guest.installer.install_bootconfig, paramname, val)
# Convert menu= value
if "menu" in opts:
@@ -1389,6 +1391,7 @@ def parse_boot(guest, optstring):
set_param("enable_bootmenu", "menu", menu)
set_param("kernel", "kernel")
set_param("initrd", "initrd")
+ set_param("loader", "loader")
set_param("kernel_args", ["kernel_args", "extra_args"])
# Build boot order
--
1.7.7.6
More information about the virt-tools-list
mailing list