Another enum moved to util/, this time the fallout from renaming
is not quite as large.
* src/conf/domain_conf.h (virDomainDiskProtocol): Move...
* src/util/virstoragefile.h (virStorageNetProtocol): ...and
rename.
* src/conf/domain_conf.c: Update clients.
* src/qemu/qemu_command.c: Likewise.
* src/qemu/qemu_conf.c: Likewise.
* src/qemu/qemu_driver.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/storage/storage_backend.c: Likewise.
* src/storage/storage_backend_gluster.c: Likewise.
* src/libvirt_private.syms (domain_conf.h): Move symbols...
(virstoragefile.h): ...as appropriate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 26 +++-------
src/conf/domain_conf.h | 17 +-----
src/libvirt_private.syms | 2 +-
src/qemu/qemu_command.c | 98 +++++++++++++++++------------------
src/qemu/qemu_conf.c | 4 +-
src/qemu/qemu_driver.c | 86 +++++++++++++++---------------
src/qemu/qemu_migration.c | 2 +-
src/storage/storage_backend.c | 2 +-
src/storage/storage_backend_gluster.c | 2 +-
src/util/virstoragefile.c | 11 ++++
src/util/virstoragefile.h | 18 +++++++
11 files changed, 135 insertions(+), 133 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8c49d58..36149da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -257,18 +257,6 @@ VIR_ENUM_IMPL(virDomainDiskErrorPolicy,
VIR_DOMAIN_DISK_ERROR_POLICY_LAST,
"ignore",
"enospace")
-VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
- "nbd",
- "rbd",
- "sheepdog",
- "gluster",
- "iscsi",
- "http",
- "https",
- "ftp",
- "ftps",
- "tftp")
-
VIR_ENUM_IMPL(virDomainDiskSecretType, VIR_DOMAIN_DISK_SECRET_TYPE_LAST,
"none",
"uuid",
@@ -5057,14 +5045,14 @@ virDomainDiskSourceDefParse(xmlNodePtr node,
goto cleanup;
}
- if ((*proto = virDomainDiskProtocolTypeFromString(protocol)) < 0){
+ if ((*proto = virStorageNetProtocolTypeFromString(protocol)) < 0){
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown protocol type '%s'"), protocol);
goto cleanup;
}
if (!(*source = virXMLPropString(node, "name")) &&
- *proto != VIR_DOMAIN_DISK_PROTOCOL_NBD) {
+ *proto != VIR_STORAGE_NET_PROTOCOL_NBD) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing name for disk source"));
goto cleanup;
@@ -5255,9 +5243,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
if (def->src.type == VIR_STORAGE_TYPE_NETWORK) {
- if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI)
+ if (def->src.protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI)
expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI;
- else if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)
+ else if (def->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
expected_secret_usage = VIR_SECRET_USAGE_TYPE_CEPH;
}
@@ -14809,7 +14797,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
case VIR_STORAGE_TYPE_NETWORK:
virBufferAsprintf(buf, "<source protocol='%s'",
- virDomainDiskProtocolTypeToString(protocol));
+ virStorageNetProtocolTypeToString(protocol));
virBufferEscapeString(buf, " name='%s'", src);
if (nhosts == 0) {
@@ -14984,9 +14972,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, "<auth username='%s'>\n",
def->src.auth.username);
virBufferAdjustIndent(buf, 2);
- if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
+ if (def->src.protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI) {
virBufferAddLit(buf, "<secret type='iscsi'");
- } else if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
+ } else if (def->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
virBufferAddLit(buf, "<secret type='ceph'");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 247b2f8..bf92593 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -509,20 +509,6 @@ enum virDomainDiskErrorPolicy {
VIR_DOMAIN_DISK_ERROR_POLICY_LAST
};
-enum virDomainDiskProtocol {
- VIR_DOMAIN_DISK_PROTOCOL_NBD,
- VIR_DOMAIN_DISK_PROTOCOL_RBD,
- VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
- VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
- VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
- VIR_DOMAIN_DISK_PROTOCOL_HTTP,
- VIR_DOMAIN_DISK_PROTOCOL_HTTPS,
- VIR_DOMAIN_DISK_PROTOCOL_FTP,
- VIR_DOMAIN_DISK_PROTOCOL_FTPS,
- VIR_DOMAIN_DISK_PROTOCOL_TFTP,
-
- VIR_DOMAIN_DISK_PROTOCOL_LAST
-};
enum virDomainDiskTray {
VIR_DOMAIN_DISK_TRAY_CLOSED,
@@ -656,7 +642,7 @@ typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr;
struct _virDomainDiskSourceDef {
int type; /* enum virStorageType */
char *path;
- int protocol; /* enum virDomainDiskProtocol */
+ int protocol; /* enum virStorageNetProtocol */
size_t nhosts;
virStorageNetHostDefPtr hosts;
virDomainDiskSourcePoolDefPtr srcpool;
@@ -2632,7 +2618,6 @@ VIR_ENUM_DECL(virDomainDiskGeometryTrans)
VIR_ENUM_DECL(virDomainDiskBus)
VIR_ENUM_DECL(virDomainDiskCache)
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
-VIR_ENUM_DECL(virDomainDiskProtocol)
VIR_ENUM_DECL(virDomainDiskIo)
VIR_ENUM_DECL(virDomainDiskSecretType)
VIR_ENUM_DECL(virDomainDeviceSGIO)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 29b47b7..99781a2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -209,7 +209,6 @@ virDomainDiskInsertPreAlloced;
virDomainDiskIoTypeFromString;
virDomainDiskIoTypeToString;
virDomainDiskPathByName;
-virDomainDiskProtocolTypeToString;
virDomainDiskRemove;
virDomainDiskRemoveByName;
virDomainDiskSetDriver;
@@ -1840,6 +1839,7 @@ virStorageNetHostDefCopy;
virStorageNetHostDefFree;
virStorageNetHostTransportTypeFromString;
virStorageNetHostTransportTypeToString;
+virStorageNetProtocolTypeToString;
virStorageTypeFromString;
virStorageTypeToString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b3ad7b1..3cdda68 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3573,35 +3573,35 @@ qemuNetworkDriveGetPort(int protocol,
return ret;
}
- switch ((enum virDomainDiskProtocol) protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_HTTP:
+ switch ((enum virStorageNetProtocol) protocol) {
+ case VIR_STORAGE_NET_PROTOCOL_HTTP:
return 80;
- case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
+ case VIR_STORAGE_NET_PROTOCOL_HTTPS:
return 443;
- case VIR_DOMAIN_DISK_PROTOCOL_FTP:
+ case VIR_STORAGE_NET_PROTOCOL_FTP:
return 21;
- case VIR_DOMAIN_DISK_PROTOCOL_FTPS:
+ case VIR_STORAGE_NET_PROTOCOL_FTPS:
return 990;
- case VIR_DOMAIN_DISK_PROTOCOL_TFTP:
+ case VIR_STORAGE_NET_PROTOCOL_TFTP:
return 69;
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
return 7000;
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
return 10809;
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
/* no default port specified */
return 0;
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
- case VIR_DOMAIN_DISK_PROTOCOL_LAST:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_LAST:
/* not aplicable */
return -1;
}
@@ -3624,12 +3624,12 @@ qemuBuildNetworkDriveURI(int protocol,
virURIPtr uri = NULL;
size_t i;
- switch ((enum virDomainDiskProtocol) protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
+ switch ((enum virStorageNetProtocol) protocol) {
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
if (nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("protocol '%s' accepts only one
host"),
- virDomainDiskProtocolTypeToString(protocol));
+ virStorageNetProtocolTypeToString(protocol));
goto cleanup;
}
@@ -3682,17 +3682,17 @@ qemuBuildNetworkDriveURI(int protocol,
/* fallthrough */
/* NBD code uses same formatting scheme as others in some cases */
- case VIR_DOMAIN_DISK_PROTOCOL_HTTP:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_FTP:
- case VIR_DOMAIN_DISK_PROTOCOL_FTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_TFTP:
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_HTTP:
+ case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+ case VIR_STORAGE_NET_PROTOCOL_FTP:
+ case VIR_STORAGE_NET_PROTOCOL_FTPS:
+ case VIR_STORAGE_NET_PROTOCOL_TFTP:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
if (nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("protocol '%s' accepts only one
host"),
- virDomainDiskProtocolTypeToString(protocol));
+ virStorageNetProtocolTypeToString(protocol));
goto cleanup;
}
@@ -3701,11 +3701,11 @@ qemuBuildNetworkDriveURI(int protocol,
if (hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
if (VIR_STRDUP(uri->scheme,
- virDomainDiskProtocolTypeToString(protocol)) < 0)
+ virStorageNetProtocolTypeToString(protocol)) < 0)
goto cleanup;
} else {
if (virAsprintf(&uri->scheme, "%s+%s",
- virDomainDiskProtocolTypeToString(protocol),
+ virStorageNetProtocolTypeToString(protocol),
virStorageNetHostTransportTypeToString(hosts->transport)) < 0)
goto cleanup;
}
@@ -3740,7 +3740,7 @@ qemuBuildNetworkDriveURI(int protocol,
break;
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
if (!src) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing disk source for 'sheepdog'
protocol"));
@@ -3764,7 +3764,7 @@ qemuBuildNetworkDriveURI(int protocol,
break;
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
if (strchr(src, ':')) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("':' not allowed in RBD source volume name
'%s'"),
@@ -3809,7 +3809,7 @@ qemuBuildNetworkDriveURI(int protocol,
break;
- case VIR_DOMAIN_DISK_PROTOCOL_LAST:
+ case VIR_STORAGE_NET_PROTOCOL_LAST:
goto cleanup;
}
@@ -3876,19 +3876,19 @@ qemuDomainDiskGetSourceString(virConnectPtr conn,
if (actualType == VIR_STORAGE_TYPE_NETWORK &&
disk->src.auth.username &&
- (disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI ||
- disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
+ (disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI ||
+ disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD)) {
bool encode = false;
int secretType = VIR_SECRET_USAGE_TYPE_ISCSI;
- if (disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
+ if (disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
/* qemu requires the secret to be encoded for RBD */
encode = true;
secretType = VIR_SECRET_USAGE_TYPE_CEPH;
}
if (!(secret = qemuGetSecretString(conn,
-
virDomainDiskProtocolTypeToString(disk->src.protocol),
+
virStorageNetProtocolTypeToString(disk->src.protocol),
encode,
disk->src.auth.secretType,
disk->src.auth.username,
@@ -4321,10 +4321,10 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
goto error;
}
if (disk->src.type == VIR_STORAGE_TYPE_NETWORK) {
- if (disk->src.protocol != VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
+ if (disk->src.protocol != VIR_STORAGE_NET_PROTOCOL_ISCSI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk device='lun' is not supported for
protocol='%s'"),
-
virDomainDiskProtocolTypeToString(disk->src.protocol));
+
virStorageNetProtocolTypeToString(disk->src.protocol));
goto error;
}
} else if (!virDomainDiskSourceIsBlockType(disk)) {
@@ -10213,7 +10213,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
else if (STRPREFIX(def->src.path, "nbd:") ||
STRPREFIX(def->src.path, "nbd+")) {
def->src.type = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_NBD;
if (qemuParseNBDString(def) < 0)
goto error;
@@ -10221,7 +10221,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
char *p = def->src.path;
def->src.type = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
if (VIR_STRDUP(def->src.path, p + strlen("rbd:")) <
0)
goto error;
/* old-style CEPH_ARGS env variable is parsed later */
@@ -10234,13 +10234,13 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STRPREFIX(def->src.path, "gluster:") ||
STRPREFIX(def->src.path, "gluster+")) {
def->src.type = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_GLUSTER;
if (qemuParseGlusterString(def) < 0)
goto error;
} else if (STRPREFIX(def->src.path, "iscsi:")) {
def->src.type = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
if (qemuParseISCSIString(def) < 0)
goto error;
@@ -10249,7 +10249,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
char *port, *vdi;
def->src.type = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_SHEEPDOG;
if (VIR_STRDUP(def->src.path, p + strlen("sheepdog:"))
< 0)
goto error;
VIR_FREE(p);
@@ -11505,17 +11505,17 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
disk->src.type = VIR_STORAGE_TYPE_BLOCK;
else if (STRPREFIX(val, "nbd:")) {
disk->src.type = VIR_STORAGE_TYPE_NETWORK;
- disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD;
+ disk->src.protocol = VIR_STORAGE_NET_PROTOCOL_NBD;
} else if (STRPREFIX(val, "rbd:")) {
disk->src.type = VIR_STORAGE_TYPE_NETWORK;
- disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
+ disk->src.protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
val += strlen("rbd:");
} else if (STRPREFIX(val, "gluster")) {
disk->src.type = VIR_STORAGE_TYPE_NETWORK;
- disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER;
+ disk->src.protocol = VIR_STORAGE_NET_PROTOCOL_GLUSTER;
} else if (STRPREFIX(val, "sheepdog:")) {
disk->src.type = VIR_STORAGE_TYPE_NETWORK;
- disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG;
+ disk->src.protocol = VIR_STORAGE_NET_PROTOCOL_SHEEPDOG;
val += strlen("sheepdog:");
} else
disk->src.type = VIR_STORAGE_TYPE_FILE;
@@ -11551,16 +11551,16 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
char *port;
switch (disk->src.protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
if (qemuParseNBDString(disk) < 0)
goto error;
break;
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
/* old-style CEPH_ARGS env variable is parsed later */
if (!ceph_args && qemuParseRBDString(disk) < 0)
goto error;
break;
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
/* disk->src must be [vdiname] or [host]:[port]:[vdiname] */
port = strchr(disk->src.path, ':');
if (port) {
@@ -11584,12 +11584,12 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
goto error;
}
break;
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
if (qemuParseGlusterString(disk) < 0)
goto error;
break;
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
if (qemuParseISCSIString(disk) < 0)
goto error;
@@ -12028,7 +12028,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
virDomainDiskDefPtr first_rbd_disk = NULL;
for (i = 0; i < def->ndisks; i++) {
if (def->disks[i]->src.type == VIR_STORAGE_TYPE_NETWORK &&
- def->disks[i]->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
+ def->disks[i]->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
first_rbd_disk = def->disks[i];
break;
}
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index dd851c6..0f33553 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1195,7 +1195,7 @@ qemuAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
def->src.hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
def->src.hosts[0].socket = NULL;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
ret = 0;
@@ -1376,7 +1376,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT:
def->src.srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
- def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
+ def->src.protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b1c22c0..b57700e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12356,22 +12356,22 @@
qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virDomainDiskProtocol) disk->src.protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTP:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_FTP:
- case VIR_DOMAIN_DISK_PROTOCOL_FTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_TFTP:
- case VIR_DOMAIN_DISK_PROTOCOL_LAST:
+ switch ((enum virStorageNetProtocol) disk->src.protocol) {
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_HTTP:
+ case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+ case VIR_STORAGE_NET_PROTOCOL_FTP:
+ case VIR_STORAGE_NET_PROTOCOL_FTPS:
+ case VIR_STORAGE_NET_PROTOCOL_TFTP:
+ case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external inactive snapshots are not supported on
"
"'network' disks using '%s'
protocol"),
- virDomainDiskProtocolTypeToString(disk->src.protocol));
+ virStorageNetProtocolTypeToString(disk->src.protocol));
return -1;
}
break;
@@ -12417,24 +12417,24 @@
qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virDomainDiskProtocol) disk->protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
+ switch ((enum virStorageNetProtocol) disk->protocol) {
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
return 0;
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTP:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_FTP:
- case VIR_DOMAIN_DISK_PROTOCOL_FTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_TFTP:
- case VIR_DOMAIN_DISK_PROTOCOL_LAST:
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_HTTP:
+ case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+ case VIR_STORAGE_NET_PROTOCOL_FTP:
+ case VIR_STORAGE_NET_PROTOCOL_FTPS:
+ case VIR_STORAGE_NET_PROTOCOL_TFTP:
+ case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external active snapshots are not supported on "
"'network' disks using '%s'
protocol"),
- virDomainDiskProtocolTypeToString(disk->protocol));
+ virStorageNetProtocolTypeToString(disk->protocol));
return -1;
}
@@ -12561,22 +12561,22 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virDomainDiskProtocol) disk->src.protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_NBD:
- case VIR_DOMAIN_DISK_PROTOCOL_RBD:
- case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG:
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
- case VIR_DOMAIN_DISK_PROTOCOL_ISCSI:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTP:
- case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_FTP:
- case VIR_DOMAIN_DISK_PROTOCOL_FTPS:
- case VIR_DOMAIN_DISK_PROTOCOL_TFTP:
- case VIR_DOMAIN_DISK_PROTOCOL_LAST:
+ switch ((enum virStorageNetProtocol) disk->src.protocol) {
+ case VIR_STORAGE_NET_PROTOCOL_NBD:
+ case VIR_STORAGE_NET_PROTOCOL_RBD:
+ case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ case VIR_STORAGE_NET_PROTOCOL_HTTP:
+ case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+ case VIR_STORAGE_NET_PROTOCOL_FTP:
+ case VIR_STORAGE_NET_PROTOCOL_FTPS:
+ case VIR_STORAGE_NET_PROTOCOL_TFTP:
+ case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("internal inactive snapshots are not supported on
"
"'network' disks using '%s'
protocol"),
- virDomainDiskProtocolTypeToString(disk->src.protocol));
+ virStorageNetProtocolTypeToString(disk->src.protocol));
return -1;
}
break;
@@ -12637,8 +12637,8 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
goto cleanup;
if (dom_disk->src.type == VIR_STORAGE_TYPE_NETWORK &&
- (dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG ||
- dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
+ (dom_disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_SHEEPDOG ||
+ dom_disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD)) {
break;
}
if (vm->def->disks[i]->src.format > 0 &&
@@ -12814,7 +12814,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
case VIR_STORAGE_TYPE_NETWORK:
switch (snap->protocol) {
- case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
if (!(newhosts = virStorageNetHostDefCopy(snap->nhosts, snap->hosts)))
goto cleanup;
@@ -12828,7 +12828,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("snapshots on volumes using '%s' protocol
"
"are not supported"),
- virDomainDiskProtocolTypeToString(snap->protocol));
+ virStorageNetProtocolTypeToString(snap->protocol));
goto cleanup;
}
break;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7fb455d..b389d0a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1543,7 +1543,7 @@ qemuMigrationIsSafe(virDomainDefPtr def)
else if (rc == 1)
continue;
} else if (disk->src.type == VIR_STORAGE_TYPE_NETWORK &&
- disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
+ disk->src.protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
continue;
}
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e0fba3f..a4481b2 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1187,7 +1187,7 @@ virStorageFileBackendForType(int type,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("missing storage backend for network files "
"using %s protocol"),
- virDomainDiskProtocolTypeToString(protocol));
+ virStorageNetProtocolTypeToString(protocol));
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("missing storage backend for '%s' storage"),
diff --git a/src/storage/storage_backend_gluster.c
b/src/storage/storage_backend_gluster.c
index 7b38fcb..d5d042f 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -611,7 +611,7 @@ virStorageFileBackendGlusterStat(virStorageFilePtr file,
virStorageFileBackend virStorageFileBackendGluster = {
.type = VIR_STORAGE_TYPE_NETWORK,
- .protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
+ .protocol = VIR_STORAGE_NET_PROTOCOL_GLUSTER,
.backendInit = virStorageFileBackendGlusterInit,
.backendDeinit = virStorageFileBackendGlusterDeinit,
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2e78472..2ed5617 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -73,6 +73,17 @@ VIR_ENUM_IMPL(virStorageFileFeature,
"lazy_refcounts",
)
+VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
+ "nbd",
+ "rbd",
+ "sheepdog",
+ "gluster",
+ "iscsi",
+ "http",
+ "https",
+ "ftp",
+ "ftps",
+ "tftp")
VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST,
"tcp",
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 3de7f2a..fccf0b9 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -100,6 +100,24 @@ struct _virStorageFileMetadata {
/* Information related to network storage */
+enum virStorageNetProtocol {
+ VIR_STORAGE_NET_PROTOCOL_NBD,
+ VIR_STORAGE_NET_PROTOCOL_RBD,
+ VIR_STORAGE_NET_PROTOCOL_SHEEPDOG,
+ VIR_STORAGE_NET_PROTOCOL_GLUSTER,
+ VIR_STORAGE_NET_PROTOCOL_ISCSI,
+ VIR_STORAGE_NET_PROTOCOL_HTTP,
+ VIR_STORAGE_NET_PROTOCOL_HTTPS,
+ VIR_STORAGE_NET_PROTOCOL_FTP,
+ VIR_STORAGE_NET_PROTOCOL_FTPS,
+ VIR_STORAGE_NET_PROTOCOL_TFTP,
+
+ VIR_STORAGE_NET_PROTOCOL_LAST
+};
+
+VIR_ENUM_DECL(virStorageNetProtocol)
+
+
enum virStorageNetHostTransport {
VIR_STORAGE_NET_HOST_TRANS_TCP,
VIR_STORAGE_NET_HOST_TRANS_UNIX,
--
1.9.0