size_t i;
int n;
- virCheckFlags(0, NULL);
+ virCheckFlags(VIR_VOL_XML_PARSE_NO_CAPACITY, NULL);
options = virStorageVolOptionsForPoolType(pool->type);
if (options == NULL)
capacity = virXPathString("string(./capacity)", ctxt);
unit = virXPathString("string(./capacity/@unit)", ctxt);
- if (capacity == NULL) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing capacity element"));
+ if (capacity) {
+ if (virStorageSize(unit, capacity, &ret->target.capacity) < 0)
+ goto error;
+ } else if (!(flags & VIR_VOL_XML_PARSE_NO_CAPACITY)) {
+ virReportError(VIR_ERR_XML_ERROR, "%s", _("missing capacity element"));
goto error;
}
- if (virStorageSize(unit, capacity, &ret->target.capacity) < 0)
- goto error;
VIR_FREE(unit);
allocation = virXPathString("string(./allocation)", ctxt);
xmlNodePtr root);
char *virStoragePoolDefFormat(virStoragePoolDefPtr def);
+typedef enum {
+ /* do not require volume capacity at all */
+ VIR_VOL_XML_PARSE_NO_CAPACITY = 1 << 0,
+} virStorageVolDefParseFlags;
virStorageVolDefPtr
virStorageVolDefParseString(virStoragePoolDefPtr pool,
const char *xml,