]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: command: Set port number only for TCP transport
authorPeter Krempa <pkrempa@redhat.com>
Fri, 7 Jul 2017 13:29:07 +0000 (15:29 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 14 Jul 2017 14:05:46 +0000 (16:05 +0200)
Setting port number for protocols using UNIX transport does not make
sense. Move the setter code to the appropriate block.

src/qemu/qemu_command.c

index e290abff63b4a7e23a6cebe5d4c5177c5c25cadc..3f4108a5485863b82900e63f910e49be8d9aba8c 100644 (file)
@@ -949,6 +949,10 @@ qemuBuildNetworkDriveURI(virStorageSourcePtr src,
         goto cleanup;
 
     if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
+        if ((uri->port = qemuNetworkDriveGetPort(src->protocol,
+                                                 src->hosts->port)) < 0)
+            goto cleanup;
+
         if (VIR_STRDUP(uri->scheme,
                        virStorageNetProtocolTypeToString(src->protocol)) < 0)
             goto cleanup;
@@ -959,10 +963,6 @@ qemuBuildNetworkDriveURI(virStorageSourcePtr src,
             goto cleanup;
     }
 
-    if ((uri->port = qemuNetworkDriveGetPort(src->protocol,
-                                             src->hosts->port)) < 0)
-        goto cleanup;
-
     if (src->path) {
         if (src->volume) {
             if (virAsprintf(&uri->path, "/%s%s",