]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Add NONE protocol type for network disks
authorPeter Krempa <pkrempa@redhat.com>
Thu, 24 Apr 2014 14:11:44 +0000 (16:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 23 May 2014 08:08:35 +0000 (10:08 +0200)
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.

src/conf/domain_conf.c
src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/util/virstoragefile.c
src/util/virstoragefile.h

index d6a1fc92af594e4f4dfa26b5a3ca7b80788c3e23..7ae63cc723345bbbdce4f13629e46879cb56160b 100644 (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;
index 31d078199c3f9b97c5a4403bfd7f62240bec5bbb..0a7b2ff597524d0508e89b3070f28f60610faabc 100644 (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;
                 }
index d3e14eae96c172b439383784a30d884b83986600..2b852ebe69f37d108f5d3ac9631f816054121d4b 100644 (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:
index 856b72620dd77b46dc58eb3e90fa9d3fe4a6d45f..b90cdc9fb54f4c0eb9ba69c0b8182e83b92ce0d2 100644 (file)
@@ -72,6 +72,7 @@ VIR_ENUM_IMPL(virStorageFileFeature,
               )
 
 VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
+              "none",
               "nbd",
               "rbd",
               "sheepdog",
index d3560a82a101b6fd99dc851448553ac86cf0f178..082ff5b7e5b83fe178e87236be57e33b768817df 100644 (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,