1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemu_process: separate graphics port reservation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-05-09 14:20:08 +02:00
parent 4a5f8669cc
commit 446aebbcf6

View File

@ -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];