From f87f422824855cadd46a22122a999f056773a561 Mon Sep 17 00:00:00 2001 From: Daniel Juarez <34030545+djuarezg@users.noreply.github.com> Date: Fri, 21 Feb 2020 15:57:00 +0100 Subject: [PATCH 1/2] Add a new libvirt config option to chose boot_mode --- oz/Guest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/oz/Guest.py b/oz/Guest.py index 92bdc71c..941a0e22 100644 --- a/oz/Guest.py +++ b/oz/Guest.py @@ -191,6 +191,8 @@ def __init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, 'rng_rate_bytes', 1024)) self.rng_rate_period = int(oz.ozutil.config_get_key(config, 'libvirt', 'rng_rate_period', 1000)) + self.boot_mode = oz.ozutil.config_get_key(config, 'libvirt', 'boot_mode', + 'bios') # configuration from 'cache' section self.cache_original_media = oz.ozutil.config_get_boolean_key(config, @@ -497,6 +499,10 @@ def _generate_xml(self, bootdev, installdev, kernel=None, initrd=None, loader, nvram = oz.ozutil.find_uefi_firmware(self.tdl.arch) oz.ozutil.lxml_subelement(osNode, "loader", loader, {'readonly': 'yes', 'type': 'pflash'}) oz.ozutil.lxml_subelement(osNode, "nvram", None, {'template': nvram}) + if self.tdl.arch in ["x86_64"] and self.boot_mode == "uefi": + loader, nvram = oz.ozutil.find_uefi_firmware(self.tdl.arch) + oz.ozutil.lxml_subelement(osNode, "loader", loader, {'readonly': 'yes', 'type': 'pflash'}) + oz.ozutil.lxml_subelement(osNode, "nvram", None, {'template': nvram}) # poweroff, reboot, crash oz.ozutil.lxml_subelement(domain, "on_poweroff", "destroy") oz.ozutil.lxml_subelement(domain, "on_reboot", "destroy") From 85a8a287be200df5adcf7ef5475161bc5a6f2afc Mon Sep 17 00:00:00 2001 From: Daniel Juarez <34030545+djuarezg@users.noreply.github.com> Date: Fri, 21 Feb 2020 15:57:40 +0100 Subject: [PATCH 2/2] Add default boot_mode option for oz cfg --- oz.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/oz.cfg b/oz.cfg index 8913f9d4..14937730 100644 --- a/oz.cfg +++ b/oz.cfg @@ -11,6 +11,7 @@ image_type = raw # bridge_name = virbr0 # cpus = 1 # memory = 1024 +# boot_mode = bios [cache] original_media = yes