[libvirt] [PATCH RFC 05/22] storage: Add NONE protocol type for network disks

Peter Krempa pkrempa at redhat.com
Tue May 6 13:36:54 UTC 2014


Currently the protocol type with index 0 was NBD which made it hard to
distinguish wether the protocol type was actually assigned. Add a new
protocol type with index 0 to distinguish it explicitly.
---
 src/qemu/qemu_command.c   | 2 ++
 src/qemu/qemu_driver.c    | 3 +++
 src/util/virstoragefile.c | 1 +
 src/util/virstoragefile.h | 1 +
 4 files changed, 7 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c0f2fb6..48eeae0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3582,6 +3582,7 @@ qemuNetworkDriveGetPort(int protocol,

         case VIR_STORAGE_NET_PROTOCOL_RBD:
         case VIR_STORAGE_NET_PROTOCOL_LAST:
+        case VIR_STORAGE_NET_PROTOCOL_NONE:
             /* not aplicable */
             return -1;
     }
@@ -3798,6 +3799,7 @@ qemuBuildNetworkDriveURI(int protocol,


         case VIR_STORAGE_NET_PROTOCOL_LAST:
+        case VIR_STORAGE_NET_PROTOCOL_NONE:
             goto cleanup;
     }

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ac0de1e..b0a79e4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12338,6 +12338,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:
@@ -12403,6 +12404,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:
@@ -12545,6 +12547,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 cf270f6..73cef3c 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 3777d66..95f2e45 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -118,6 +118,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,
-- 
1.9.2




More information about the libvir-list mailing list