[PATCH 1/4] qemu_process: separate graphics port reservation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 22b27b3..f110a66 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4348,12 +4348,10 @@ qemuProcessStartHook(virQEMUDriverPtr driver,
 
 
 static int
-qemuProcessSetupGraphics(virQEMUDriverPtr driver,
-                         virDomainObjPtr vm)
+qemuProcessGraphicsReservePorts(virQEMUDriverPtr driver,
+                                virDomainObjPtr vm)
 {
-    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     size_t i;
-    int ret = -1;
 
     for (i = 0; i < vm->def->ngraphics; ++i) {
         virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
@@ -4362,7 +4360,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
             if (virPortAllocatorSetUsed(driver->remotePorts,
                                         graphics->data.vnc.port,
                                         true) < 0)
-                goto cleanup;
+                return -1;
             graphics->data.vnc.portReserved = true;
 
         } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
@@ -4371,7 +4369,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
                 if (virPortAllocatorSetUsed(driver->remotePorts,
                                             graphics->data.spice.port,
                                             true) < 0)
-                    goto cleanup;
+                    return -1;
                 graphics->data.spice.portReserved = true;
             }
 
@@ -4379,12 +4377,27 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
                 if (virPortAllocatorSetUsed(driver->remotePorts,
                                             graphics->data.spice.tlsPort,
                                             true) < 0)
-                    goto cleanup;
+                    return -1;
                 graphics->data.spice.tlsPortReserved = true;
             }
         }
     }
 
+    return 0;
+}
+
+
+static int
+qemuProcessSetupGraphics(virQEMUDriverPtr driver,
+                         virDomainObjPtr vm)
+{
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    size_t i;
+    int ret = -1;
+
+    if (qemuProcessGraphicsReservePorts(driver, vm) < 0)
+        goto cleanup;
+
     for (i = 0; i < vm->def->ngraphics; ++i) {
         virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
 
-- 
2.8.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]