提交 f87be33a 编写于 作者: J John Ferlan

qemu: Introduce qemuBuildHubCommandLine

Add new function to manage adding the hub -device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also make qemuBuildHubDevStr static to the module since it's only
used here.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 4908772e
......@@ -3798,8 +3798,8 @@ qemuBuildUSBHostdevDevStr(virDomainDefPtr def,
}
char *
qemuBuildHubDevStr(virDomainDefPtr def,
static char *
qemuBuildHubDevStr(const virDomainDef *def,
virDomainHubDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
......@@ -3834,6 +3834,28 @@ qemuBuildHubDevStr(virDomainDefPtr def,
}
static int
qemuBuildHubCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
size_t i;
for (i = 0; i < def->nhubs; i++) {
virDomainHubDefPtr hub = def->hubs[i];
char *optstr;
virCommandAddArg(cmd, "-device");
if (!(optstr = qemuBuildHubDevStr(def, hub, qemuCaps)))
return -1;
virCommandAddArg(cmd, optstr);
VIR_FREE(optstr);
}
return 0;
}
char *
qemuBuildUSBHostdevUSBDevStr(virDomainHostdevDefPtr dev)
{
......@@ -7824,16 +7846,8 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuBuildControllerDevCommandLine(cmd, def, qemuCaps) < 0)
goto error;
for (i = 0; i < def->nhubs; i++) {
virDomainHubDefPtr hub = def->hubs[i];
char *optstr;
virCommandAddArg(cmd, "-device");
if (!(optstr = qemuBuildHubDevStr(def, hub, qemuCaps)))
goto error;
virCommandAddArg(cmd, optstr);
VIR_FREE(optstr);
}
if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
goto error;
if ((virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) {
/* bootDevs will get translated into either bootindex=N or boot=on
......
......@@ -210,9 +210,6 @@ char *qemuBuildSCSIHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
char *qemuBuildHubDevStr(virDomainDefPtr def,
virDomainHubDefPtr dev,
virQEMUCapsPtr qemuCaps);
char *qemuBuildRedirdevDevStr(virDomainDefPtr def,
virDomainRedirdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册