qemu: command: Set port number only for TCP transport

Setting port number for protocols using UNIX transport does not make
sense. Move the setter code to the appropriate block.
This commit is contained in:
Peter Krempa 2017-07-07 15:29:07 +02:00
parent 602b4c3010
commit dbf06d907e
1 changed files with 4 additions and 4 deletions

View 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",