提交 a53e5040 编写于 作者: M Martin Kletzander

qemu: rework '-serial none'

Limiting ourselves to qemu without QEMU_CAPS_DEVICE capability, we
used '-serial none' only if there was no serial device defined in the
domain XML.  This means that if we want to have a possibility of the
device being defined in XML, but not used in the command-line
(e.g. when it's pointless), we'll fail to attach '-serial none' to the
command-line (when skipping the device's command-line building and the
device being the only one).

Since there is no such device, this patch doesn't actually do
anything, but enables easier future additions in this manner.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 5b189541
/* /*
* qemu_command.c: QEMU command generation * qemu_command.c: QEMU command generation
* *
* Copyright (C) 2006-2013 Red Hat, Inc. * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2006 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -7710,6 +7710,7 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -7710,6 +7710,7 @@ qemuBuildCommandLine(virConnectPtr conn,
int vnc = 0; int vnc = 0;
int spice = 0; int spice = 0;
int usbcontroller = 0; int usbcontroller = 0;
int actualSerials = 0;
bool usblegacy = false; bool usblegacy = false;
bool mlock = false; bool mlock = false;
int contOrder[] = { int contOrder[] = {
...@@ -8806,11 +8807,7 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -8806,11 +8807,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgBuffer(cmd, &opt); virCommandAddArgBuffer(cmd, &opt);
} }
if (!def->nserials) { if (def->nserials) {
/* If we have -device, then we set -nodefault already */
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
virCommandAddArgList(cmd, "-serial", "none", NULL);
} else {
for (i = 0; i < def->nserials; i++) { for (i = 0; i < def->nserials; i++) {
virDomainChrDefPtr serial = def->serials[i]; virDomainChrDefPtr serial = def->serials[i];
char *devstr; char *devstr;
...@@ -8834,9 +8831,14 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -8834,9 +8831,14 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArg(cmd, devstr); virCommandAddArg(cmd, devstr);
VIR_FREE(devstr); VIR_FREE(devstr);
} }
actualSerials++;
} }
} }
/* If we have -device, then we set -nodefault already */
if (!actualSerials && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
virCommandAddArgList(cmd, "-serial", "none", NULL);
if (!def->nparallels) { if (!def->nparallels) {
/* If we have -device, then we set -nodefault already */ /* If we have -device, then we set -nodefault already */
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册