We already have a way stricter check in the code which is doing the snapshot so duplicating it in the parser does not make much sense. Also gets rid of an ugly ternary operator. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/snapshot_conf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index adba149241..5a511b4495 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -159,17 +159,11 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlopt) < 0) goto cleanup; - if ((driver = virXPathString("string(./driver/@type)", ctxt))) { - def->src->format = virStorageFileFormatTypeFromString(driver); - if (def->src->format < VIR_STORAGE_FILE_BACKING) { + if ((driver = virXPathString("string(./driver/@type)", ctxt)) && + (def->src->format = virStorageFileFormatTypeFromString(driver)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - def->src->format <= 0 - ? _("unknown disk snapshot driver '%s'") - : _("disk format '%s' lacks backing file " - "support"), - driver); + _("unknown disk snapshot driver '%s'"), driver); goto cleanup; - } } /* validate that the passed path is absolute */ -- 2.19.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list