--- .../libvirt-gconfig-storage-pool-target.c | 39 ++++++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 3 ++ libvirt-gconfig/tests/test-domain-create.c | 4 +++ 4 files changed, 48 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c index c83145c..f76b26c 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c @@ -72,6 +72,23 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const } /** + * gvir_config_storage_pool_target_get_path: + * @target: a #GVirConfigStoragePoolTarget + * + * Provides the location at which the storage pool associated with @target + * will be mapped into the local filesystem namespace. + * + * Returns: local filesystem path the storage pool is mapped at. + */ +const char *gvir_config_storage_pool_target_get_path(GVirConfigStoragePoolTarget *target) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_STORAGE_POOL_TARGET(target), NULL); + + return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(target), + "path"); +} + +/** * gvir_config_storage_pool_target_set_path: * @path: (allow-none): */ @@ -85,6 +102,28 @@ void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *targe } /** + * gvir_config_storage_pool_target_get_permissions: + * @target: a #GVirConfigStoragePoolTarget + * + * Gets the permissions associated with @target + * + * Returns: (transfer full): a new #GVirConfigStoragePoolPermissions instance. + */ +GVirConfigStoragePermissions *gvir_config_storage_pool_target_get_permissions(GVirConfigStoragePoolTarget *target) +{ + GVirConfigObject *object; + + g_return_val_if_fail(GVIR_CONFIG_IS_STORAGE_POOL_TARGET(target), NULL); + + object = gvir_config_object_get_child_with_type + (GVIR_CONFIG_OBJECT(target), + "permissions", + GVIR_CONFIG_TYPE_STORAGE_PERMISSIONS); + + return GVIR_CONFIG_STORAGE_PERMISSIONS(object); +} + +/** * gvir_config_storage_pool_perms_set_permissions: * @perms: (allow-none): */ diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h index 031abe2..ca6602d 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h @@ -63,8 +63,10 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new(void); GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const gchar *xml, GError **error); +const char *gvir_config_storage_pool_target_get_path(GVirConfigStoragePoolTarget *target); void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *target, const char *path); +GVirConfigStoragePermissions *gvir_config_storage_pool_target_get_permissions(GVirConfigStoragePoolTarget *target); void gvir_config_storage_pool_target_set_permissions(GVirConfigStoragePoolTarget *target, GVirConfigStoragePermissions *perms); diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 49072dd..4456487 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -531,6 +531,9 @@ LIBVIRT_GCONFIG_0.1.7 { gvir_config_storage_pool_source_get_name; gvir_config_storage_pool_source_get_product; gvir_config_storage_pool_source_get_vendor; + + gvir_config_storage_pool_target_get_path; + gvir_config_storage_pool_target_get_permissions; } LIBVIRT_GCONFIG_0.1.6; # .... 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 f7cb076..88bfbfb 100644 --- a/libvirt-gconfig/tests/test-domain-create.c +++ b/libvirt-gconfig/tests/test-domain-create.c @@ -422,6 +422,10 @@ int main(int argc, char **argv) gvir_config_storage_pool_set_target(pool, pool_target); g_object_unref(G_OBJECT(pool_target)); + pool_target = gvir_config_storage_pool_get_target(pool); + g_str_const_check(gvir_config_storage_pool_target_get_path(pool_target), "/dev/disk/by-path"); + g_object_unref(G_OBJECT(pool_target)); + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(pool)); g_print("%s\n\n", xml); g_free(xml); -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list