[PATCH 0 of 2] Add netfs storage pool support

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1241572138 25200 # Node ID 0bbc6afa622ccea1b57b5a92dbf228a61b6aee6b # Parent aa607e00fcf92c40f6fa3e5ca311f68433395661 Add XML generation for netfs disk pools Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r aa607e00fcf9 -r 0bbc6afa622c libxkutil/pool_parsing.c --- a/libxkutil/pool_parsing.c Fri May 01 13:02:34 2009 -0700 +++ b/libxkutil/pool_parsing.c Tue May 05 18:08:58 2009 -0700 @@ -55,6 +55,8 @@ static void cleanup_disk_pool(struct disk_pool pool) { free(pool.path); free(pool.device_path); + free(pool.host); + free(pool.src_dir); } void cleanup_virt_pool(struct virt_pool **pool) diff -r aa607e00fcf9 -r 0bbc6afa622c libxkutil/pool_parsing.h --- a/libxkutil/pool_parsing.h Fri May 01 13:02:34 2009 -0700 +++ b/libxkutil/pool_parsing.h Tue May 05 18:08:58 2009 -0700 @@ -46,6 +46,8 @@ DISK_POOL_LOGICAL} pool_type; char *path; char *device_path; + char *host; + char *src_dir; }; struct virt_pool { diff -r aa607e00fcf9 -r 0bbc6afa622c libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Fri May 01 13:02:34 2009 -0700 +++ b/libxkutil/xmlgen.c Tue May 05 18:08:58 2009 -0700 @@ -847,16 +847,61 @@ return NULL; } +static const char *set_disk_pool_source(xmlNodePtr disk, + struct disk_pool *pool) +{ + xmlNodePtr src; + xmlNodePtr tmp; + + src = xmlNewChild(disk, NULL, BAD_CAST "source", NULL); + if (src == NULL) + return XML_ERROR; + + if (pool->device_path != NULL) { + tmp = xmlNewChild(src, NULL, BAD_CAST "device", BAD_CAST NULL); + if (tmp == NULL) + return XML_ERROR; + + if (xmlNewProp(tmp, + BAD_CAST "path", + BAD_CAST pool->device_path) == NULL) + return XML_ERROR; + } + + if (pool->host != NULL) { + tmp = xmlNewChild(src, NULL, BAD_CAST "host", BAD_CAST NULL); + if (tmp == NULL) + return XML_ERROR; + + if (xmlNewProp(tmp, + BAD_CAST "name", + BAD_CAST pool->host) == NULL) + return XML_ERROR; + } + + if (pool->src_dir != NULL) { + tmp = xmlNewChild(src, NULL, BAD_CAST "dir", BAD_CAST NULL); + if (tmp == NULL) + return XML_ERROR; + + if (xmlNewProp(tmp, + BAD_CAST "path", + BAD_CAST pool->src_dir) == NULL) + return XML_ERROR; + } + + return NULL; +} + static const char *disk_pool_xml(xmlNodePtr root, struct virt_pool *_pool) { xmlNodePtr disk = NULL; xmlNodePtr name = NULL; - xmlNodePtr src = NULL; - xmlNodePtr dev = NULL; xmlNodePtr target = NULL; xmlNodePtr path = NULL; const char *type = NULL; + const char *msg = NULL; struct disk_pool *pool = &_pool->pool_info.disk; type = disk_pool_type_to_str(pool->pool_type); @@ -874,19 +919,10 @@ if (name == NULL) goto out; - if (pool->device_path != NULL) { - src = xmlNewChild(disk, NULL, BAD_CAST "source", NULL); - if (src == NULL) - goto out; - - dev = xmlNewChild(src, NULL, BAD_CAST "device", BAD_CAST NULL); - if (dev == NULL) - goto out; - - if (xmlNewProp(dev, - BAD_CAST "path", - BAD_CAST pool->device_path) == NULL) - goto out; + if (pool->pool_type != DISK_POOL_DIR) { + msg = set_disk_pool_source(disk, pool); + if (msg != NULL) + return msg; } target = xmlNewChild(disk, NULL, BAD_CAST "target", NULL);

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1241572138 25200 # Node ID 570c3507c7b2c3e55680e9a70f4889accb9a1cf7 # Parent 0bbc6afa622ccea1b57b5a92dbf228a61b6aee6b Add netfs disk pool attributes to schema, RPCS support, and template RASDs Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 0bbc6afa622c -r 570c3507c7b2 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue May 05 18:08:58 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Tue May 05 18:08:58 2009 -0700 @@ -223,6 +223,8 @@ uint16 Type; string Path; string DevicePath; + string Host; + string SourceDirectory; }; [Description ("KVM virtual disk pool settings"), @@ -237,6 +239,8 @@ uint16 Type; string Path; string DevicePath; + string Host; + string SourceDirectory; }; [Description ("LXC virtual disk pool settings"), @@ -251,5 +255,7 @@ uint16 Type; string Path; string DevicePath; + string Host; + string SourceDirectory; }; diff -r 0bbc6afa622c -r 570c3507c7b2 src/Virt_ResourcePoolConfigurationService.c --- a/src/Virt_ResourcePoolConfigurationService.c Tue May 05 18:08:58 2009 -0700 +++ b/src/Virt_ResourcePoolConfigurationService.c Tue May 05 18:08:58 2009 -0700 @@ -144,6 +144,8 @@ { pool->pool_info.disk.device_path = NULL; pool->pool_info.disk.path = NULL; + pool->pool_info.disk.host = NULL; + pool->pool_info.disk.src_dir = NULL; } static const char *disk_fs_pool(CMPIInstance *inst, @@ -159,6 +161,24 @@ return NULL; } +static const char *disk_netfs_pool(CMPIInstance *inst, + struct virt_pool *pool) +{ + const char *val = NULL; + + if (cu_get_str_prop(inst, "Host", &val) != CMPI_RC_OK) + return "Missing `Host' property"; + + pool->pool_info.disk.host = strdup(val); + + if (cu_get_str_prop(inst, "SourceDirectory", &val) != CMPI_RC_OK) + return "Missing `SourceDirectory' property"; + + pool->pool_info.disk.src_dir = strdup(val); + + return NULL; +} + static const char *disk_rasd_to_pool(CMPIInstance *inst, struct virt_pool *pool) { @@ -179,6 +199,11 @@ if (msg != NULL) goto out; break; + case DISK_POOL_NETFS: + msg = disk_netfs_pool(inst, pool); + if (msg != NULL) + goto out; + break; default: return "Storage pool type not supported"; } diff -r 0bbc6afa622c -r 570c3507c7b2 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Tue May 05 18:08:58 2009 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Tue May 05 18:08:58 2009 -0700 @@ -1240,8 +1240,10 @@ CMPIStatus s = {CMPI_RC_OK, NULL}; const char *path = "/dev/null"; const char *dev_path; - int type[2] = {DISK_POOL_DIR, DISK_POOL_FS}; - int pool_types = 2; + const char *host; + const char *src_dir; + int type[3] = {DISK_POOL_DIR, DISK_POOL_FS, DISK_POOL_NETFS}; + int pool_types = 3; int i; switch (template_type) { @@ -1277,6 +1279,15 @@ CMSetProperty(inst, "DevicePath", (CMPIValue *)dev_path, CMPI_chars); break; + case DISK_POOL_NETFS: + host = "host_sys.domain.com"; + CMSetProperty(inst, "Host", + (CMPIValue *)host, CMPI_chars); + + src_dir = "/var/lib/images"; + CMSetProperty(inst, "SourceDirectory", + (CMPIValue *)src_dir, CMPI_chars); + break; default: break; }

+1 Kaitlin Rupert wrote:
This adds support for the netfs type storage pool.
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
Richard Maciel