[libvirt] [PATCH] qemu: Forbid specify target path for disk vol

Osier Yang jyang at redhat.com
Mon Oct 24 11:49:18 UTC 2011


target path for disk vol is just meaningless, and it's never used
but free()ed silently when creating the volume.
---
 src/conf/storage_conf.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index e893b2d..5f4f264 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1052,6 +1052,12 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
     }
 
     ret->target.path = virXPathString("string(./target/path)", ctxt);
+    if (ret->target.path && (pool->type == VIR_STORAGE_POOL_DISK)) {
+        virStorageReportError(VIR_ERR_XML_ERROR, "%s",
+                              _("target path for disk vol is just meaningless"));
+        goto cleanup;
+    }
+
     if (options->formatFromString) {
         char *format = virXPathString("string(./target/format/@type)", ctxt);
         if (format == NULL)
-- 
1.7.6




More information about the libvir-list mailing list