[libvirt] [PATCH 23/38] qemu: domain: Process only one object in qemuDomainPrepareDiskSourceTLS
Ján Tomko
jtomko at redhat.com
Wed May 30 17:07:39 UTC 2018
On Wed, May 30, 2018 at 02:41:19PM +0200, Peter Krempa wrote:
>Remove the loop from qemuDomainPrepareDiskSourceTLS and rename it to
>qemuDomainPrepareStorageSourceTLS. Currently there is no backing chain
>to prepare so fixing one device is equivalent. In the future it will be
>reused in a function which will do the looping.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_domain.c | 62 +++++++++++++++++++++++---------------------------
> 1 file changed, 29 insertions(+), 33 deletions(-)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index 2737d7b7f2..5e8ff675c8 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -9948,40 +9948,36 @@ qemuProcessPrepareStorageSourceTlsVxhs(virStorageSourcePtr src,
> * Returns 0 on success, -1 on bad config/failure
> */
> static int
>-qemuDomainPrepareDiskSourceTLS(virStorageSourcePtr src,
>- virQEMUDriverConfigPtr cfg)
>+qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
>+ virQEMUDriverConfigPtr cfg)
> {
>- virStorageSourcePtr n;
>-
>- for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
>- if (virStorageSourceGetActualType(n) != VIR_STORAGE_TYPE_NETWORK)
>- continue;
>+ if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
>+ return 0;
>
>- switch ((virStorageNetProtocol) n->protocol) {
>- case VIR_STORAGE_NET_PROTOCOL_VXHS:
>- if (qemuProcessPrepareStorageSourceTlsVxhs(n, cfg) < 0)
>- return -1;
>- break;
>+ switch ((virStorageNetProtocol) src->protocol) {
>+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
>+ 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_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, n->protocol);
>- return -1;
>- }
>+ case VIR_STORAGE_NET_PROTOCOL_NONE:
>+ case VIR_STORAGE_NET_PROTOCOL_LAST:
>+ default:
>+ virReportEnumRangeError(virStorageNetProtocol, src->protocol);
>+ return -1;
> }
>
> return 0;
This change would look much nicer before the previous patch.
Reviewed-by: Ján Tomko <jtomko at redhat.com>
and unless you switch them:
Sighed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180530/f5c35f32/attachment-0001.sig>
More information about the libvir-list
mailing list