于 2011年10月24日 19:49, Osier Yang 写道:
Change patch title into:
storage: Forbid specifying ...
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)