mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-10 04:58:12 -05:00
qemu: caps: Always assume QEMU_CAPS_SMP_TOPOLOGY
Support for SMP topology was added by qemu commit dc6b1c09849484fbbc50 prior to 0.12.0, our minimum supported qemu version. $ git describe --tags dc6b1c09849484fbbc50803307e4c7a3d81eab62 v0.11.0-rc0-449-gdc6b1c0 $ git describe --tags --contains dc6b1c09849484fbbc50803307e4c7a3d81eab v0.12.0-rc0~1477
This commit is contained in:
@@ -1232,10 +1232,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
|
||||
|
||||
if (strstr(help, "-sdl"))
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL);
|
||||
if (strstr(help, "cores=") &&
|
||||
strstr(help, "threads=") &&
|
||||
strstr(help, "sockets="))
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
|
||||
|
||||
if (strstr(help, ",vhost="))
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
|
||||
@@ -3384,7 +3380,6 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC);
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
|
||||
|
||||
@@ -85,7 +85,7 @@ typedef enum {
|
||||
X_QEMU_CAPS_BALLOON, /* -balloon available */
|
||||
X_QEMU_CAPS_DEVICE, /* Is the -device arg available */
|
||||
QEMU_CAPS_SDL, /* Is the new -sdl arg available */
|
||||
QEMU_CAPS_SMP_TOPOLOGY, /* -smp has sockets/cores/threads */
|
||||
X_QEMU_CAPS_SMP_TOPOLOGY, /* -smp has sockets/cores/threads */
|
||||
QEMU_CAPS_NETDEV, /* -netdev flag & netdev_add/remove */
|
||||
|
||||
/* 30 */
|
||||
|
||||
+14
-26
@@ -6862,8 +6862,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
||||
|
||||
static int
|
||||
qemuBuildSmpCommandLine(virCommandPtr cmd,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
const virDomainDef *def)
|
||||
{
|
||||
char *smp;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
@@ -6872,29 +6871,18 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
|
||||
|
||||
virBufferAsprintf(&buf, "%u", virDomainDefGetVcpus(def));
|
||||
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY)) {
|
||||
if (virDomainDefHasVcpusOffline(def))
|
||||
virBufferAsprintf(&buf, ",maxcpus=%u",
|
||||
virDomainDefGetVcpusMax(def));
|
||||
/* sockets, cores, and threads are either all zero
|
||||
* or all non-zero, thus checking one of them is enough */
|
||||
if (def->cpu && def->cpu->sockets) {
|
||||
virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets);
|
||||
virBufferAsprintf(&buf, ",cores=%u", def->cpu->cores);
|
||||
virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
|
||||
} else {
|
||||
virBufferAsprintf(&buf, ",sockets=%u",
|
||||
virDomainDefGetVcpusMax(def));
|
||||
virBufferAsprintf(&buf, ",cores=%u", 1);
|
||||
virBufferAsprintf(&buf, ",threads=%u", 1);
|
||||
}
|
||||
} else if (virDomainDefHasVcpusOffline(def)) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
/* FIXME - consider hot-unplugging cpus after boot for older qemu */
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting current vcpu count less than maximum is "
|
||||
"not supported with this QEMU binary"));
|
||||
return -1;
|
||||
if (virDomainDefHasVcpusOffline(def))
|
||||
virBufferAsprintf(&buf, ",maxcpus=%u", virDomainDefGetVcpusMax(def));
|
||||
/* sockets, cores, and threads are either all zero
|
||||
* or all non-zero, thus checking one of them is enough */
|
||||
if (def->cpu && def->cpu->sockets) {
|
||||
virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets);
|
||||
virBufferAsprintf(&buf, ",cores=%u", def->cpu->cores);
|
||||
virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
|
||||
} else {
|
||||
virBufferAsprintf(&buf, ",sockets=%u", virDomainDefGetVcpusMax(def));
|
||||
virBufferAsprintf(&buf, ",cores=%u", 1);
|
||||
virBufferAsprintf(&buf, ",threads=%u", 1);
|
||||
}
|
||||
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
@@ -9183,7 +9171,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
|
||||
if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuBuildSmpCommandLine(cmd, def, qemuCaps) < 0)
|
||||
if (qemuBuildSmpCommandLine(cmd, def) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0)
|
||||
|
||||
Reference in New Issue
Block a user