From 158340e2fbab9a49013ee0de59af7236da014622 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 12 Mar 2015 17:53:01 +0100 Subject: [PATCH] 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. --- src/util/virstoragefile.c | 4 ++++ 1 file changed, 4 insertions(+) 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; }