memset(&host, 0, sizeof(host));
- switch (src->type) {
+ switch ((enum virStorageType)src->type) {
case VIR_STORAGE_TYPE_FILE:
src->path = virXMLPropString(node, "file");
break;
if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0)
goto cleanup;
break;
- default:
+ case VIR_STORAGE_TYPE_NONE:
+ case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %s"),
virStorageTypeToString(src->type));
type = virXMLPropString(node, "type");
if (type) {
- if ((def->src.type = virStorageTypeFromString(type)) < 0) {
+ if ((def->src.type = virStorageTypeFromString(type)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk type '%s'"), type);
goto error;
src->seclabels, flags);
break;
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %d"), src->type);
char uuidstr[VIR_UUID_STRING_BUFLEN];
- if (!type) {
+ if (!type || !def->src.type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %d"), def->src.type);
return -1;
}
if ((type = virXMLPropString(node, "type"))) {
- if ((def->src.type = virStorageTypeFromString(type)) < 0 ||
+ if ((def->src.type = virStorageTypeFromString(type)) <= 0 ||
def->src.type == VIR_STORAGE_TYPE_VOLUME ||
def->src.type == VIR_STORAGE_TYPE_DIR) {
virReportError(VIR_ERR_XML_ERROR,
break;
case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
break;
}
case VIR_STORAGE_TYPE_DIR:
case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external inactive snapshots are not supported on "
case VIR_STORAGE_TYPE_DIR:
case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external active snapshots are not supported on "
case VIR_STORAGE_TYPE_NETWORK:
case VIR_STORAGE_TYPE_DIR:
case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external inactive snapshots are not supported on "
case VIR_STORAGE_TYPE_DIR:
case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("internal inactive snapshots are not supported on "
VIR_STRDUP(persistSource, snap->src.path) < 0)
goto cleanup;
- switch (snap->src.type) {
+ switch ((enum virStorageType)snap->src.type) {
case VIR_STORAGE_TYPE_BLOCK:
reuse = true;
/* fallthrough */
}
break;
- default:
+ case VIR_STORAGE_TYPE_DIR:
+ case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_NONE:
+ case VIR_STORAGE_TYPE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("snapshots are not supported on '%s' volumes"),
virStorageTypeToString(snap->src.type));
VIR_LOG_INIT("util.storagefile");
VIR_ENUM_IMPL(virStorage, VIR_STORAGE_TYPE_LAST,
- "block",
+ "none",
"file",
+ "block",
"dir",
"network",
"volume")
# define VIR_STORAGE_MAX_HEADER 0x8200
-/* Types of disk backends (host resource) */
+/* Types of disk backends (host resource). Comparable to the public
+ * virStorageVolType, except we have an undetermined state, don't have
+ * a netdir type, and add a volume type for reference through a
+ * storage pool. */
enum virStorageType {
- VIR_STORAGE_TYPE_BLOCK,
+ VIR_STORAGE_TYPE_NONE,
VIR_STORAGE_TYPE_FILE,
+ VIR_STORAGE_TYPE_BLOCK,
VIR_STORAGE_TYPE_DIR,
VIR_STORAGE_TYPE_NETWORK,
VIR_STORAGE_TYPE_VOLUME,