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

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

于 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)

On Mon, Oct 24, 2011 at 07:49:18PM +0800, Osier Yang wrote:
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)) {
Encoding a specific pool type here is wrong. The parser determines what is valid from the 'virStoragePoolTypeInfo' data tables
+ 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)
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Osier Yang