mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu_process: merge graphics code into qemuProcessSetupGraphics
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
9f51c1c7c7
commit
9d88cbea87
@ -4402,16 +4402,21 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
for (i = 0; i < vm->def->ngraphics; ++i) {
|
for (i = 0; i < vm->def->ngraphics; ++i) {
|
||||||
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
|
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
|
||||||
|
char *listenAddr = NULL;
|
||||||
|
|
||||||
switch (graphics->type) {
|
switch (graphics->type) {
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
||||||
if (qemuProcessVNCAllocatePorts(driver, graphics, allocate) < 0)
|
if (qemuProcessVNCAllocatePorts(driver, graphics, allocate) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
listenAddr = cfg->vncListen;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||||
if (qemuProcessSPICEAllocatePorts(driver, cfg, graphics, allocate) < 0)
|
if (qemuProcessSPICEAllocatePorts(driver, cfg, graphics, allocate) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
listenAddr = cfg->spiceListen;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
||||||
@ -4420,6 +4425,14 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
|
|||||||
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (graphics->nListens == 0 && listenAddr) {
|
||||||
|
if (virDomainGraphicsListenAppendAddress(graphics,
|
||||||
|
listenAddr) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
graphics->listens[0].fromConfig = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -5177,40 +5190,10 @@ qemuProcessPrepareDomain(virConnectPtr conn,
|
|||||||
if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
|
if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_DEBUG("Setting up ports for graphics");
|
VIR_DEBUG("Setting graphics devices");
|
||||||
if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
|
if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Fill in run-time values for graphics devices. */
|
|
||||||
for (i = 0; i < vm->def->ngraphics; i++) {
|
|
||||||
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
|
|
||||||
char *listenAddr = NULL;
|
|
||||||
|
|
||||||
switch (graphics->type) {
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
|
||||||
listenAddr = cfg->vncListen;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
|
||||||
listenAddr = cfg->spiceListen;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (graphics->nListens == 0 && listenAddr) {
|
|
||||||
if (virDomainGraphicsListenAppendAddress(graphics,
|
|
||||||
listenAddr) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
graphics->listens[0].fromConfig = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* "volume" type disk's source must be translated before
|
/* "volume" type disk's source must be translated before
|
||||||
* cgroup and security setting.
|
* cgroup and security setting.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user