From: Peter Krempa Date: Thu, 24 Apr 2014 14:11:44 +0000 (+0200) Subject: storage: Add NONE protocol type for network disks X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a01d93579ee793a0f5afb6e86e7be627a2a4a4a5;p=libvirt.git 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. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d6a1fc92af..7ae63cc723 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 31d078199c..0a7b2ff597 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d3e14eae96..2b852ebe69 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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: diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 856b72620d..b90cdc9fb5 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -72,6 +72,7 @@ VIR_ENUM_IMPL(virStorageFileFeature, ) VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST, + "none", "nbd", "rbd", "sheepdog", diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index d3560a82a1..082ff5b7e5 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -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,