Add a way to get the value of <os firmware="bios|efi"/> which has been set to the domain XML. Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- libvirt-gconfig/libvirt-gconfig-domain-os.c | 12 ++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-os.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 1 + tests/test-gconfig.c | 2 ++ 4 files changed, 16 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c index 5aa247a..4bdbab2 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c @@ -345,3 +345,15 @@ void gvir_config_domain_os_set_firmware(GVirConfigDomainOs *os, GVirConfigDomain xmlNewProp(node, (xmlChar*)"firmware", (xmlChar*)firmware_str); } + +GVirConfigDomainOsFirmware gvir_config_domain_os_get_firmware(GVirConfigDomainOs *os) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_OS(os), + GVIR_CONFIG_DOMAIN_OS_FIRMWARE_BIOS); + + return gvir_config_object_get_attribute_genum + (GVIR_CONFIG_OBJECT(os), + NULL, "firmware", + GVIR_CONFIG_TYPE_DOMAIN_OS_FIRMWARE, + GVIR_CONFIG_DOMAIN_OS_FIRMWARE_BIOS); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.h b/libvirt-gconfig/libvirt-gconfig-domain-os.h index 2a8fc13..f54fe87 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.h @@ -104,6 +104,7 @@ void gvir_config_domain_os_set_smbios_mode(GVirConfigDomainOs *os, GVirConfigDomainOsSmBiosMode mode); void gvir_config_domain_os_enable_boot_menu(GVirConfigDomainOs *os, gboolean enable); void gvir_config_domain_os_bios_enable_serial(GVirConfigDomainOs *os, gboolean enable); +GVirConfigDomainOsFirmware gvir_config_domain_os_get_firmware(GVirConfigDomainOs *os); void gvir_config_domain_os_set_firmware(GVirConfigDomainOs *os, GVirConfigDomainOsFirmware firmware); diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index d40bb7b..6686566 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -781,6 +781,7 @@ global: gvir_config_domain_capabilities_os_get_firmwares; gvir_config_domain_capabilities_os_get_type; gvir_config_domain_os_firmware_get_type; + gvir_config_domain_os_get_firmware; gvir_config_domain_os_set_firmware; gvir_config_storage_vol_target_features_get_type; gvir_config_storage_vol_target_set_features; diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c index 6979578..6cd36d1 100644 --- a/tests/test-gconfig.c +++ b/tests/test-gconfig.c @@ -219,6 +219,7 @@ static void test_domain_os(void) g_assert_cmpint(gvir_config_domain_os_get_os_type(os), ==, GVIR_CONFIG_DOMAIN_OS_TYPE_HVM); g_assert_cmpstr(gvir_config_domain_os_get_arch(os), ==, "x86_64"); g_assert_cmpstr(gvir_config_domain_os_get_machine(os), ==, "q35"); + g_assert_cmpint(gvir_config_domain_os_get_firmware(os), ==, GVIR_CONFIG_DOMAIN_OS_FIRMWARE_EFI); devices = g_list_append(devices, GINT_TO_POINTER(GVIR_CONFIG_DOMAIN_OS_BOOT_DEVICE_CDROM)); devices = g_list_append(devices, @@ -234,6 +235,7 @@ static void test_domain_os(void) g_assert(os != NULL); g_assert_cmpstr(gvir_config_domain_os_get_arch(os), ==, "x86_64"); g_assert_cmpint(gvir_config_domain_os_get_os_type(os), ==, GVIR_CONFIG_DOMAIN_OS_TYPE_HVM); + g_assert_cmpint(gvir_config_domain_os_get_firmware(os), ==, GVIR_CONFIG_DOMAIN_OS_FIRMWARE_EFI); domain_os_check_boot_devices(os); g_object_unref(G_OBJECT(os)); -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list