virStorageSource *src,
unsigned int flags)
{
- virStorageNetProtocol protocol;
xmlNodePtr tmpnode;
if (virXMLPropEnum(node, "protocol", virStorageNetProtocolTypeFromString,
- VIR_XML_PROP_REQUIRED, &protocol) < 0)
+ VIR_XML_PROP_REQUIRED, &src->protocol) < 0)
return -1;
- src->protocol = protocol;
-
if (!(src->path = virXMLPropString(node, "name")) &&
src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) {
virReportError(VIR_ERR_XML_ERROR, "%s",
return -1;
}
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
virStorageType type;
char *path;
char *fdgroup; /* name of group of file descriptors the user wishes to use instead of 'path' */
- int protocol; /* virStorageNetProtocol */
+ virStorageNetProtocol protocol;
char *volume; /* volume name for remote storage */
char *snapshot; /* for storage systems supporting internal snapshots */
char *configFile; /* some storage systems use config file as part of
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
break;
}
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
driver = "gluster";
if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget)))
return NULL;
break;
-
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
case VIR_STORAGE_NET_PROTOCOL_FTP:
src->readahead == 0 &&
src->reconnectDelay == 0) {
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
break;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
driver = "gluster";
if (!(location = qemuBlockStorageSourceGetGlusterProps(src, false)))
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
return 0;
- switch ((virStorageNetProtocol) src->protocol) {
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_VXHS:
/* vxhs is no longer supported */
break;
break;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((virStorageNetProtocol) domdisk->src->protocol) {
+ switch (domdisk->src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((virStorageNetProtocol) disk->src->protocol) {
+ switch (disk->src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
const char *path = NULL;
int transport = 0;
g_auto(GStrv) scheme = NULL;
+ int protocol;
if (!(uri = virURIParse(uristr))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
return -1;
if (!scheme[0] ||
- (src->protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) {
+ (protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid backing protocol '%1$s'"),
NULLSTR(scheme[0]));
return -1;
}
+ src->protocol = protocol;
if (scheme[1]) {
if ((transport = virStorageNetHostTransportTypeFromString(scheme[1])) < 0) {
const char *path)
{
const char *p;
- g_autofree char *protocol = NULL;
+ g_autofree char *protocol_str = NULL;
+ int protocol;
if (!(p = strchr(path, ':'))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
return -1;
}
- protocol = g_strndup(path, p - path);
+ protocol_str = g_strndup(path, p - path);
- if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) < 0) {
+ if ((protocol = virStorageNetProtocolTypeFromString(protocol_str)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid backing protocol '%1$s'"),
- protocol);
+ protocol_str);
return -1;
}
- switch ((virStorageNetProtocol) src->protocol) {
+ src->protocol = protocol;
+
+ switch (src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
if (virStorageSourceParseNBDColonString(path, src) < 0)
return -1;
case VIR_STORAGE_NET_PROTOCOL_NONE:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("backing store parser is not implemented for protocol %1$s"),
- protocol);
+ protocol_str);
return -1;
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_NFS:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("malformed backing store path for protocol %1$s"),
- protocol);
+ protocol_str);
return -1;
}