storage: Add NONE protocol type for network disks

Currently the protocol type with index 0 was NBD which made it hard to
distinguish whether the protocol type was actually assigned. Add a new
protocol type with index 0 to distinguish it explicitly.
This commit is contained in:
Peter Krempa 2014-04-24 16:11:44 +02:00
parent b52e1ad961
commit a01d93579e
5 changed files with 10 additions and 2 deletions

View File

@ -4989,7 +4989,7 @@ virDomainDiskSourceParse(xmlNodePtr node,
goto cleanup;
}
if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) < 0){
if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown protocol type '%s'"), protocol);
goto cleanup;

View File

@ -3046,7 +3046,8 @@ qemuNetworkDriveGetPort(int protocol,
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_LAST:
/* not aplicable */
case VIR_STORAGE_NET_PROTOCOL_NONE:
/* not applicable */
return -1;
}
@ -3262,6 +3263,7 @@ qemuBuildNetworkDriveURI(int protocol,
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
goto cleanup;
}
@ -11080,6 +11082,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
/* ignored for now */
break;
}

View File

@ -12390,6 +12390,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
case VIR_STORAGE_TYPE_NETWORK:
switch ((virStorageNetProtocol) disk->src.protocol) {
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@ -12455,6 +12456,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
return 0;
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@ -12597,6 +12599,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
case VIR_STORAGE_TYPE_NETWORK:
switch ((virStorageNetProtocol) disk->src.protocol) {
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:

View File

@ -72,6 +72,7 @@ VIR_ENUM_IMPL(virStorageFileFeature,
)
VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
"none",
"nbd",
"rbd",
"sheepdog",

View File

@ -119,6 +119,7 @@ struct _virStorageTimestamps {
/* Information related to network storage */
typedef enum {
VIR_STORAGE_NET_PROTOCOL_NONE,
VIR_STORAGE_NET_PROTOCOL_NBD,
VIR_STORAGE_NET_PROTOCOL_RBD,
VIR_STORAGE_NET_PROTOCOL_SHEEPDOG,