Only one feature is supported at the moment, 'lazy refcount' Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> --- .../libvirt-gconfig-storage-vol-target.c | 14 ++++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 6 ++++++ libvirt-gconfig/libvirt-gconfig.sym | 6 ++++++ libvirt-gconfig/tests/test-domain-create.c | 1 + 4 files changed, 27 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c index 751c950c..300d3927 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c @@ -109,3 +109,17 @@ void gvir_config_storage_vol_target_set_compat(GVirConfigStorageVolTarget *targe gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(target), "compat", compat); } + +void gvir_config_storage_vol_target_set_features(GVirConfigStorageVolTarget *target, + guint64 features) +{ + g_return_if_fail(GVIR_CONFIG_IS_STORAGE_VOL_TARGET(target)); + g_return_if_fail((features & ~GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT) == 0); + + if ((features & GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT) != 0) { + GVirConfigObject *features_node; + features_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(target), "features"); + gvir_config_object_set_node_content(features_node, "lazy_refcount", ""); + g_object_unref(features_node); + } +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h index 2030e734..f1b50035 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h @@ -69,6 +69,12 @@ void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *targe const char *format); void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget *target, GVirConfigStoragePermissions *perms); +typedef enum { + GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT = 1 << 0 +} GVirConfigStorageVolTargetFeatures; + +void gvir_config_storage_vol_target_set_features(GVirConfigStorageVolTarget *target, + guint64 features); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index ee5bf8ad..2d7486ea 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -779,4 +779,10 @@ global: gvir_config_domain_set_custom_xml_ns_children; } LIBVIRT_GCONFIG_0.2.4; +LIBVIRT_GCONFIG_2.0.1 { +global: + gvir_config_storage_vol_target_features_get_type; + gvir_config_storage_vol_target_set_features; +} LIBVIRT_GCONFIG_2.0.0; + # .... define new API here using predicted next version number .... diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c index 79c242f4..f8fd6d51 100644 --- a/libvirt-gconfig/tests/test-domain-create.c +++ b/libvirt-gconfig/tests/test-domain-create.c @@ -498,6 +498,7 @@ int main(int argc, char **argv) gvir_config_storage_vol_target_set_format(vol_target, "qcow2"); gvir_config_storage_vol_target_set_permissions(vol_target, perms); gvir_config_storage_vol_target_set_compat(vol_target, "1.1"); + gvir_config_storage_vol_target_set_features(vol_target, GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT); g_object_unref(G_OBJECT(perms)); gvir_config_storage_vol_set_target(vol, vol_target); g_object_unref(G_OBJECT(vol_target)); -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list