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];
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 &&
if (virPortAllocatorSetUsed(driver->remotePorts,
graphics->data.spice.port,
true) < 0)
- goto cleanup;
+ return -1;
graphics->data.spice.portReserved = true;
}
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];