size_t i;
int n;
- virCheckFlags(VIR_VOL_XML_PARSE_NO_CAPACITY, NULL);
+ virCheckFlags(VIR_VOL_XML_PARSE_NO_CAPACITY |
+ VIR_VOL_XML_PARSE_OPT_CAPACITY, NULL);
options = virStorageVolOptionsForPoolType(pool->type);
if (options == NULL)
if (capacity) {
if (virStorageSize(unit, capacity, &ret->target.capacity) < 0)
goto error;
- } else if (!(flags & VIR_VOL_XML_PARSE_NO_CAPACITY)) {
+ } else if (!(flags & VIR_VOL_XML_PARSE_NO_CAPACITY) &&
+ !((flags & VIR_VOL_XML_PARSE_OPT_CAPACITY) && ret->target.backingStore)) {
virReportError(VIR_ERR_XML_ERROR, "%s", _("missing capacity element"));
goto error;
}
typedef enum {
/* do not require volume capacity at all */
VIR_VOL_XML_PARSE_NO_CAPACITY = 1 << 0,
+ /* do not require volume capacity if the volume has a backing store */
+ VIR_VOL_XML_PARSE_OPT_CAPACITY = 1 << 1,
} virStorageVolDefParseFlags;
virStorageVolDefPtr
virStorageVolDefParseString(virStoragePoolDefPtr pool,