Add the gvir_config_domain_filesys_set_driver_format function to allow setting nbd driver type + image format for containers filesystems. --- libvirt-gconfig/libvirt-gconfig-domain-filesys.c | 16 ++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-filesys.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 5 +++++ tests/test-gconfig.c | 1 + tests/xml/gconfig-domain-device-filesys.xml | 2 +- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c index dc49bcd..9b73af5 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c @@ -137,6 +137,22 @@ void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys g_object_unref(G_OBJECT(node)); } +void gvir_config_domain_filesys_set_driver_format(GVirConfigDomainFilesys *filesys, + GVirConfigDomainDiskFormat format) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_FILESYS(filesys)); + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys), "driver"); + g_return_if_fail(GVIR_CONFIG_IS_OBJECT(node)); + + gvir_config_object_set_attribute_with_type( + node, + "format", GVIR_CONFIG_TYPE_DOMAIN_DISK_FORMAT, format, + NULL); + g_object_unref(G_OBJECT(node)); +} + void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, const char *source) { diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h index 4144976..18c4069 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h @@ -91,6 +91,8 @@ void gvir_config_domain_filesys_set_access_type(GVirConfigDomainFilesys *filesys GVirConfigDomainFilesysAccessType type); void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys, GVirConfigDomainFilesysDriverType type); +void gvir_config_domain_filesys_set_driver_format(GVirConfigDomainFilesys *filesys, + GVirConfigDomainDiskFormat format); void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, const char *source); void gvir_config_domain_filesys_set_ram_usage(GVirConfigDomainFilesys *filesys, diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 407a52f..6ce1511 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -719,4 +719,9 @@ global: gvir_config_storage_vol_target_set_compat; } LIBVIRT_GCONFIG_0.1.9; +LIBVIRT_GCONFIG_0.2.1 { +global: + gvir_config_domain_filesys_set_driver_format; +} LIBVIRT_GCONFIG_0.2.0; + # .... define new API here using predicted next version number .... diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c index e7dafde..bd2daa6 100644 --- a/tests/test-gconfig.c +++ b/tests/test-gconfig.c @@ -369,6 +369,7 @@ static void test_domain_device_filesystem(void) gvir_config_domain_filesys_set_type(fs, GVIR_CONFIG_DOMAIN_FILESYS_FILE); gvir_config_domain_filesys_set_access_type(fs, GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_MAPPED); gvir_config_domain_filesys_set_driver_type(fs, GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_DEFAULT); + gvir_config_domain_filesys_set_driver_format(fs, GVIR_CONFIG_DOMAIN_DISK_FORMAT_QCOW2); gvir_config_domain_filesys_set_source(fs, "/path/to/source"); gvir_config_domain_filesys_set_target(fs, "/path/to/target1"); gvir_config_domain_filesys_set_readonly(fs, TRUE); diff --git a/tests/xml/gconfig-domain-device-filesys.xml b/tests/xml/gconfig-domain-device-filesys.xml index 5db6d61..30152d2 100644 --- a/tests/xml/gconfig-domain-device-filesys.xml +++ b/tests/xml/gconfig-domain-device-filesys.xml @@ -1,7 +1,7 @@ <domain> <devices> <filesystem type="file" accessmode="mapped"> - <driver/> + <driver format="qcow2"/> <source file="/path/to/source"/> <target dir="/path/to/target1"/> <readonly/> -- 2.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list