提交 afc107c2 编写于 作者: E Erik Skultety

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: NErik Skultety <eskultet@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 57e78a9e
...@@ -8184,26 +8184,44 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, ...@@ -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)
{ {
size_t i;
for (i = 0; i < def->ngraphics; i++) {
virDomainGraphicsDefPtr graphics = def->graphics[i];
switch (graphics->type) { switch (graphics->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_SDL: case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
return qemuBuildGraphicsSDLCommandLine(cfg, cmd, qemuCaps, graphics); if (qemuBuildGraphicsSDLCommandLine(cfg, cmd,
qemuCaps, graphics) < 0)
return -1;
break;
case VIR_DOMAIN_GRAPHICS_TYPE_VNC: case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
return qemuBuildGraphicsVNCCommandLine(cfg, cmd, qemuCaps, graphics); if (qemuBuildGraphicsVNCCommandLine(cfg, cmd,
qemuCaps, graphics) < 0)
return -1;
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
return qemuBuildGraphicsSPICECommandLine(cfg, cmd, qemuCaps, graphics); if (qemuBuildGraphicsSPICECommandLine(cfg, cmd,
qemuCaps, graphics) < 0)
return -1;
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP: case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported graphics type '%s'"), _("unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(graphics->type)); virDomainGraphicsTypeToString(graphics->type));
return -1; 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, ...@@ -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,
def->graphics[i]) < 0)
goto error; goto error;
}
if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册