mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu: command: Move graphics iteration to its own function
It should be the command line helper who takes care of the iteration rather than the caller. Signed-off-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
57e78a9ebb
commit
afc107c20f
@ -8184,26 +8184,44 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
|
|||||||
static int
|
static int
|
||||||
qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
|
qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
|
||||||
virCommandPtr cmd,
|
virCommandPtr cmd,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virDomainDefPtr def,
|
||||||
virDomainGraphicsDefPtr graphics)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
switch (graphics->type) {
|
size_t i;
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
|
||||||
return qemuBuildGraphicsSDLCommandLine(cfg, cmd, qemuCaps, graphics);
|
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
for (i = 0; i < def->ngraphics; i++) {
|
||||||
return qemuBuildGraphicsVNCCommandLine(cfg, cmd, qemuCaps, graphics);
|
virDomainGraphicsDefPtr graphics = def->graphics[i];
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
switch (graphics->type) {
|
||||||
return qemuBuildGraphicsSPICECommandLine(cfg, cmd, qemuCaps, graphics);
|
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
||||||
|
if (qemuBuildGraphicsSDLCommandLine(cfg, cmd,
|
||||||
|
qemuCaps, graphics) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
break;
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
if (qemuBuildGraphicsVNCCommandLine(cfg, cmd,
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
qemuCaps, graphics) < 0)
|
||||||
_("unsupported graphics type '%s'"),
|
return -1;
|
||||||
virDomainGraphicsTypeToString(graphics->type));
|
|
||||||
return -1;
|
break;
|
||||||
|
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||||
|
if (qemuBuildGraphicsSPICECommandLine(cfg, cmd,
|
||||||
|
qemuCaps, graphics) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
||||||
|
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("unsupported graphics type '%s'"),
|
||||||
|
virDomainGraphicsTypeToString(graphics->type));
|
||||||
|
return -1;
|
||||||
|
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virDomainGraphicsType, graphics->type);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -10354,11 +10372,8 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0)
|
if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < def->ngraphics; ++i) {
|
if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps) < 0)
|
||||||
if (qemuBuildGraphicsCommandLine(cfg, cmd, qemuCaps,
|
goto error;
|
||||||
def->graphics[i]) < 0)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0)
|
if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user