From: Peter Krempa Date: Thu, 12 Mar 2015 16:53:01 +0000 (+0100) Subject: util: storage: Fix check for empty storage device X-Git-Tag: v1.2.14-rc1~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158340e2fbab9a49013ee0de59af7236da014622;p=thirdparty%2Flibvirt.git util: storage: Fix check for empty storage device If the storage device type is parsed as network our parser still allows it to omit the element. The empty drive check would not trigger on such device as it expects that every network storage source is valid. Use VIR_STORAGE_NET_PROTOCOL_NONE as a marker that the storage source is empty. --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 78a7a9f8b9..96be02e66e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1989,6 +1989,10 @@ virStorageSourceIsEmpty(virStorageSourcePtr src) if (src->type == VIR_STORAGE_TYPE_NONE) return true; + if (src->type == VIR_STORAGE_TYPE_NETWORK && + src->protocol == VIR_STORAGE_NET_PROTOCOL_NONE) + return true; + return false; }