mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 20:51:26 +00:00
qemu: domain: Use switch statement in qemuDomainPrepareDiskSourceTLS
Select protocol using a switch with all cases enumerated. This will simplify checking unsupported protocols and adding new support. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8db9b4f9a7
commit
3f5054f145
@ -9954,7 +9954,7 @@ qemuProcessPrepareStorageSourceTLSVxhs(virStorageSourcePtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* qemuProcessPrepareDiskSourceTLS:
|
/* qemuProcessPrepareStorageSourceTLS:
|
||||||
* @source: source for a disk
|
* @source: source for a disk
|
||||||
* @cfg: driver configuration
|
* @cfg: driver configuration
|
||||||
*
|
*
|
||||||
@ -9968,11 +9968,34 @@ static int
|
|||||||
qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
|
qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
|
||||||
virQEMUDriverConfigPtr cfg)
|
virQEMUDriverConfigPtr cfg)
|
||||||
{
|
{
|
||||||
|
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (src->type == VIR_STORAGE_TYPE_NETWORK &&
|
switch ((virStorageNetProtocol) src->protocol) {
|
||||||
src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
|
case VIR_STORAGE_NET_PROTOCOL_VXHS:
|
||||||
qemuProcessPrepareStorageSourceTLSVxhs(src, cfg) < 0)
|
if (qemuProcessPrepareStorageSourceTLSVxhs(src, cfg) < 0)
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
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_SSH:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||||||
|
case VIR_STORAGE_NET_PROTOCOL_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virStorageNetProtocol, src->protocol);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user