]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: storage: Fix check for empty storage device
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Mar 2015 16:53:01 +0000 (17:53 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 17 Mar 2015 16:11:38 +0000 (17:11 +0100)
If the storage device type is parsed as network our parser still allows
it to omit the <source> 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.

src/util/virstoragefile.c

index 78a7a9f8b935c5bfb77fcc8b6f3defb8e731fb51..96be02e66e9d6cbf45bd7267a426146975b61750 100644 (file)
@@ -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;
 }