[libvirt PATCH] manpages/virsh: Clarify the meaning of the '--current' flag
by Kashyap Chamarthy
Currently the documentation says:
"If *--current* is specified, affect the current guest state."
It's not entirely clear what states can "current" imply. E.g. `virsh
detach-device --current [...]` — does this affect the live guest state
or offline state?
Answer: It affects the "current" state, which can either be live or
offline.
Spell that out; it's clearer that way. Fix all occurrences (i.e. as
many as I could spot) of this.
(Thanks: Dan Berrangé on IRC for clarifying.)
Signed-off-by: Kashyap Chamarthy <kchamart(a)redhat.com>
---
For 'iothreadset', the documentation says:
"If *--current* is specified or *--live* is not specified, then
handle as if *--live* was specified."
Does the above make sense? I don't know the implementation detail here.
So I just added a parenthetical note on what the word "current" means.
---
docs/manpages/virsh.rst | 84 ++++++++++++++++++++++++++---------------
1 file changed, 54 insertions(+), 30 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 1a2cf09fb7..3c8d0434ab 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -1090,7 +1090,8 @@ reset the value back to the default.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
When setting the disk io parameters both *--live* and *--config* flags may be
given, but *--current* is exclusive. For querying only one of *--live*,
*--config* or *--current* can be specified. If no flag is specified, behavior
@@ -1152,7 +1153,8 @@ any existing per-device write_bytes_sec for other devices remain unchanged.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -1986,7 +1988,8 @@ respectfully with average value of zero.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -2089,7 +2092,8 @@ The *--live*, *--config*, and *--current* flags are only valid when using
the *--period* option in order to set the collection period for the balloon
driver. If *--live* is specified, only the running guest collection period
is affected. If *--config* is specified, affect the next boot of a persistent
-guest. If *--current* is specified, affect the current guest state.
+guest. If *--current* is specified, affect the current guest state,
+which can either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
@@ -2582,7 +2586,8 @@ See ``vcpupin`` for *cpulist*.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -2746,7 +2751,7 @@ If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
If *--config* is specified, affect the next boot of a persistent guest.
If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+affect the current guest state, which can either be live or offline.
iothreaddel
@@ -2767,7 +2772,7 @@ If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
If *--config* is specified, affect the next boot of a persistent guest.
If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+affect the current guest state, which can either be live or offline.
iothreadinfo
@@ -2787,7 +2792,8 @@ the guest is not running, an error is returned.
If *--config* is specified, get the IOThreads data from the next boot of
a persistent guest.
If *--current* is specified or *--live* and *--config* are not specified,
-then get the IOThread data based on the current guest state.
+then get the IOThread data based on the current guest state, which can
+either be live or offline.
iothreadpin
@@ -2814,7 +2820,7 @@ If *--live* is specified, affect a running guest. If the guest is not running,
an error is returned.
If *--config* is specified, affect the next boot of a persistent guest.
If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+affect the current guest state, which can either be live or offline.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -2851,7 +2857,8 @@ next start, restore, etc.
If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
If *--current* is specified or *--live* is not specified, then handle
-as if *--live* was specified.
+as if *--live* was specified. (Where "current" here means whatever the
+present guest state is: live or offline.)
managedsave
@@ -2998,7 +3005,8 @@ For example, vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3393,7 +3401,8 @@ excluding a node.
If *--live* is specified, set scheduler information of a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
For running guests in Linux hosts, the changes made in the domain's
numa parameters does not imply that the guest memory will be moved to a
@@ -3486,7 +3495,8 @@ the *--perf* flag.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3715,7 +3725,8 @@ ESX (allocation scheduler): reservation, limit, shares
If *--live* is specified, set scheduler information of a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
``Note``: The cpu_shares parameter has a valid value range of 0-262144; Negative
values are wrapped to positive, and larger values are capped at the maximum.
@@ -3957,7 +3968,8 @@ setmaxmem
Change the maximum memory allocation limit for a guest domain.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3988,7 +4000,8 @@ setmem
Change the memory allocation for a guest domain.
If *--live* is specified, perform a memory balloon of a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -4038,7 +4051,8 @@ specified together if supported by the hypervisor. If this command is run
before the guest has finished booting, the guest may fail to process
the change.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
When no flags are given, the *--live*
flag is assumed and the guest domain must be active. In this situation it
@@ -4084,9 +4098,9 @@ others.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state. This is the
-default. Both *--live* and *--config* flags may be given, but *--current* is
-exclusive.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline. This is the default. Both *--live* and
+*--config* flags may be given, but *--current* is exclusive.
shutdown
@@ -4356,7 +4370,8 @@ also be allowed. The '-' denotes the range and the '^' denotes exclusive.
For pinning the *vcpu* to all physical cpus specify 'r' as a *cpulist*.
If *--live* is specified, affect a running guest.
If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, affect the current guest state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -4411,7 +4426,8 @@ needed if the PCI device does not use managed mode.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4480,7 +4496,8 @@ is printed instead.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4568,7 +4585,8 @@ attached is printed instead.
If ``--live`` is specified, affect a running domain.
If ``--config`` is specified, affect the next startup of a persistent domain.
-If ``--current`` is specified, affect the current domain state.
+If ``--current`` is specified, affect the current domain state, which
+can either be live or offline.
Both ``--live`` and ``--config`` flags may be given, but ``--current`` is
exclusive. When no flag is specified legacy API is used whose behavior
depends on the hypervisor driver.
@@ -4615,7 +4633,8 @@ returns.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4643,7 +4662,8 @@ removal of the device is notified asynchronously via libvirt events
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive.
@@ -4663,7 +4683,8 @@ from the domain.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4699,7 +4720,8 @@ present on the domain.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4732,7 +4754,8 @@ libvirt XML format for a device.
If *--live* is specified, affect a running domain.
If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--current* is specified, affect the current domain state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. Not specifying any flag is the same as specifying *--current*.
@@ -5223,7 +5246,8 @@ instance of <ip> will get the modification.
If *--live* is specified, affect a running network.
If *--config* is specified, affect the next startup of a persistent network.
-If *--current* is specified, affect the current network state.
+If *--current* is specified, affect the current network state, which can
+either be live or offline.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. Not specifying any flag is the same as specifying *--current*.
--
2.26.2
4 years, 4 months
[libvirt PATCH] Partially revert "qemu: fix missing error reports in capabilities probing"
by Daniel P. Berrangé
This partially reverts commit 5331c4804f4f419b9e75741084f926e52413d3a1.
The original commit mistakenly thought virFileCacheLookup did not set
an error. In fact the only case it doesn't set an error for is when
the cache key is NULL. This in fact the fault of the caller for passing
an invalid cache key, so doesn't need to be handled.
This caller bug was fixed by checking for a NULL binary in the
virQEMUCapsCacheLookupDefault method.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 5 -----
src/qemu/qemu_domain.c | 4 +---
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b27a5e5c81..7264fe300f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5636,11 +5636,6 @@ virQEMUCapsCacheLookup(virFileCachePtr cache,
priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
ret = virFileCacheLookup(cache, binary);
- if (!ret) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("no capabilities available for %s"), binary);
- return NULL;
- }
VIR_DEBUG("Returning caps %p for %s", ret, binary);
return ret;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4a2daffc0a..6147333381 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5256,10 +5256,8 @@ qemuDomainPostParseDataAlloc(const virDomainDef *def,
virQEMUDriverPtr driver = opaque;
if (!(*parseOpaque = virQEMUCapsCacheLookup(driver->qemuCapsCache,
- def->emulator))) {
- virResetLastError();
+ def->emulator)))
return 1;
- }
return 0;
}
--
2.26.2
4 years, 4 months
[PATCH] qemuDomainPostParseDataAlloc: Don't reset error if looking up caps fails
by Michal Privoznik
When starting the QEMU driver we load all domain XMLs. This
means, that post parse callbacks are run for each XML, but they
are allowed to fail because we will run them again when starting
a domain. In the case I am fixing, we were unable to look up QEMU
capabilities (in both post parse runs) and reported appropriate
error, sort of. It can be found in the logs, but the caller
doesn't get it because after 5331c4804f4 it is reset. Therefore,
as reported here [1], if we are unable to start QEMU for caps
probing the following will happen:
virsh start fedora
error: Failed to start domain fedora
error: An error occurred, but the cause is unknown
1: https://www.redhat.com/archives/libvir-list/2020-July/msg00673.html
Fixes: 5331c4804f4
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c365d92ae0..f31690c50a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5307,7 +5307,6 @@ qemuDomainPostParseDataAlloc(const virDomainDef *def,
if (!(*parseOpaque = virQEMUCapsCacheLookup(driver->qemuCapsCache,
def->emulator))) {
- virResetLastError();
return 1;
}
--
2.26.2
4 years, 4 months
[PATCH] qemu: pre-create the dbus directory in qemuStateInitialize
by Bihong Yu
>From 187323ce736dcd9b1a177d552630b0c6859a4798 Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong(a)huawei.com>
Date: Tue, 14 Jul 2020 15:44:05 +0800
Subject: [PATCH] qemu: pre-create the dbus directory in qemuStateInitialize
There are races condiction to make '/run/libvirt/qemu/dbus' directory in
virDirCreateNoFork() while concurrent start VMs, and get "failed to create
directory '/run/libvirt/qemu/dbus': File exists" error message. pre-create the
dbus directory in qemuStateInitialize.
Signed-off-by:Bihong Yu <yubihong(a)huawei.com>
---
src/qemu/qemu_dbus.c | 4 +---
src/qemu/qemu_dbus.h | 2 +-
src/qemu/qemu_driver.c | 4 ++++
src/qemu/qemu_process.c | 3 ---
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c
index 51f6c94..0e0306a 100644
--- a/src/qemu/qemu_dbus.c
+++ b/src/qemu/qemu_dbus.c
@@ -34,10 +34,8 @@ VIR_LOG_INIT("qemu.dbus");
int
-qemuDBusPrepareHost(virQEMUDriverPtr driver)
+qemuDBusPreparePath(virQEMUDriverConfigPtr cfg)
{
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
-
return virDirCreate(cfg->dbusStateDir, 0770, cfg->user, cfg->group,
VIR_DIR_CREATE_ALLOW_EXIST);
}
diff --git a/src/qemu/qemu_dbus.h b/src/qemu/qemu_dbus.h
index 474eb10..6ce9f7b 100644
--- a/src/qemu/qemu_dbus.h
+++ b/src/qemu/qemu_dbus.h
@@ -21,7 +21,7 @@
#include "qemu_conf.h"
#include "qemu_domain.h"
-int qemuDBusPrepareHost(virQEMUDriverPtr driver);
+int qemuDBusPreparePath(virQEMUDriverConfigPtr cfg);
char *qemuDBusGetAddress(virQEMUDriverPtr driver,
virDomainObjPtr vm);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d185666..52b68c9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -50,6 +50,7 @@
#include "qemu_security.h"
#include "qemu_checkpoint.h"
#include "qemu_backup.h"
+#include "qemu_dbus.h"
#include "virerror.h"
#include "virlog.h"
@@ -790,6 +791,9 @@ qemuStateInitialize(bool privileged,
cfg->migrationPortMax)) == NULL)
goto error;
+ if (qemuDBusPreparePath(cfg) < 0)
+ goto error;
+
if (qemuSecurityInit(qemu_driver) < 0)
goto error;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index eba14ed..46620ca 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6449,9 +6449,6 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- if (qemuDBusPrepareHost(driver) < 0)
- return -1;
-
if (qemuPrepareNVRAM(cfg, vm) < 0)
return -1;
--
1.8.3.1
4 years, 4 months
[libvirt PATCH 2/3] qemu: Do not set default value //cpu/@migratable for running domains
by Jiri Denemark
Commit v6.4.0-61-g201bd5db63 started to fill the default value for
//cpu/@migratable attribute according to QEMU support. However, active
domains either have the migratable attribute already set or the
capabilities we use for checking the QEMU support were created by older
libvirt which didn't probe for this specific capability.
https://bugzilla.redhat.com/show_bug.cgi?id=1857967
Reported-by: Mark Mielke <mark.mielke(a)gmail.com>
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_domain.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4a2daffc0a..2c944ce051 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3986,9 +3986,13 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def,
}
}
- if (qemuCaps &&
+ /* Running domains were either started before QEMU_CAPS_CPU_MIGRATABLE was
+ * introduced and thus we can't rely on it or they already have the
+ * migratable default set. */
+ if (def->id == -1 &&
+ qemuCaps &&
def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
- !def->cpu->migratable) {
+ def->cpu->migratable == VIR_TRISTATE_SWITCH_ABSENT) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_MIGRATABLE))
def->cpu->migratable = VIR_TRISTATE_SWITCH_ON;
else if (ARCH_IS_X86(def->os.arch))
--
2.27.0
4 years, 4 months
[PATCH 1/2] qemu: add support for shmem-{plain, doorbell} role
by Wang Xin
Role(master or peer) controls how the domain behaves on migration.
For more details about migration with ivshmem, see
https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/system/ivshmem.rst;h...
It's a optional attribute in libvirt, and qemu will choose default
role for ivshmem device if the user is not specified.
With device property 'role', the value can be 'master' or 'peer'.
- 'master' (means 'master=on' in qemu), the guest will copy
the shared memory on migration to the destination host.
- 'peer' (means 'master=off' in qemu), the migration is disabled.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
Signed-off-by: Yang Hang <yanghang44(a)huawei.com>
Signed-off-by: Wang Xin <wangxinxin.wang(a)huawei.com>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f5ee97de81..d4d90ad44d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -9141,7 +9141,7 @@ qemu-kvm -net nic,model=? /dev/null
<pre>
...
<devices>
- <shmem name='my_shmem0'>
+ <shmem name='my_shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
</shmem>
@@ -9159,9 +9159,15 @@ qemu-kvm -net nic,model=? /dev/null
<dt><code>shmem</code></dt>
<dd>
The <code>shmem</code> element has one mandatory attribute,
- <code>name</code> to identify the shared memory. This attribute cannot
- be directory specific to <code>.</code> or <code>..</code> as well as
- it cannot involve path separator <code>/</code>.
+ <code>name</code> to identify the shared memory. Optional attribute
+ <code>role</code> can be set to values "master" or "peer". The former
+ will mean that upon migration, the data in the shared memory is migrated
+ with the domain. There should be only one "master" per shared memory object.
+ Migration with "peer" role is disabled. If migration of such domain is required,
+ the shmem device needs to be unplugged before migration and plugged in at the
+ destination upon successful migration. This attribute cannot be directory
+ specific to <code>.</code> or <code>..</code> as well as it cannot involve path
+ separator <code>/</code>.
</dd>
<dt><code>model</code></dt>
<dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a810f569c6..09d4ad3e96 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4417,6 +4417,14 @@
<param name="pattern">[^/]*</param>
</data>
</attribute>
+ <optional>
+ <attribute name="role">
+ <choice>
+ <value>master</value>
+ <value>peer</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
<optional>
<element name="model">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bcebfc633f..83a005a479 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1325,6 +1325,13 @@ VIR_ENUM_IMPL(virDomainShmemModel,
"ivshmem-doorbell",
);
+VIR_ENUM_IMPL(virDomainShmemRole,
+ VIR_DOMAIN_SHMEM_ROLE_LAST,
+ "default",
+ "master",
+ "peer",
+);
+
VIR_ENUM_IMPL(virDomainLaunchSecurity,
VIR_DOMAIN_LAUNCH_SECURITY_LAST,
"",
@@ -15341,6 +15348,19 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
goto cleanup;
}
+ if (def->model != VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
+ tmp = virXMLPropString(node, "role");
+ if (tmp) {
+ if ((def->role = virDomainShmemRoleTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Unknown shmem role type '%s'"), tmp);
+ goto cleanup;
+ }
+
+ VIR_FREE(tmp);
+ }
+ }
+
if (virParseScaledValue("./size[1]", NULL, ctxt,
&def->size, 1, ULLONG_MAX, false) < 0)
goto cleanup;
@@ -18563,6 +18583,9 @@ virDomainShmemDefEquals(virDomainShmemDefPtr src,
if (src->model != dst->model)
return false;
+ if (src->role != dst->role)
+ return false;
+
if (src->server.enabled != dst->server.enabled)
return false;
@@ -23742,6 +23765,15 @@ virDomainShmemDefCheckABIStability(virDomainShmemDefPtr src,
return false;
}
+ if (src->role != dst->role) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target shared memory role '%s' does not match "
+ "source role '%s'"),
+ virDomainShmemRoleTypeToString(dst->role),
+ virDomainShmemRoleTypeToString(src->role));
+ return false;
+ }
+
if (src->model != dst->model) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target shared memory model '%s' does not match "
@@ -27340,8 +27372,12 @@ virDomainShmemDefFormat(virBufferPtr buf,
virDomainShmemDefPtr def,
unsigned int flags)
{
- virBufferEscapeString(buf, "<shmem name='%s'>\n", def->name);
+ virBufferEscapeString(buf, "<shmem name='%s'", def->name);
+ if (def->role)
+ virBufferEscapeString(buf, " role='%s'",
+ virDomainShmemRoleTypeToString(def->role));
+ virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
virBufferAsprintf(buf, "<model type='%s'/>\n",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 241149af24..855c144ddb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1771,10 +1771,19 @@ typedef enum {
VIR_DOMAIN_SHMEM_MODEL_LAST
} virDomainShmemModel;
+typedef enum {
+ VIR_DOMAIN_SHMEM_ROLE_DEFAULT,
+ VIR_DOMAIN_SHMEM_ROLE_MASTER,
+ VIR_DOMAIN_SHMEM_ROLE_PEER,
+
+ VIR_DOMAIN_SHMEM_ROLE_LAST
+} virDomainShmemRole;
+
struct _virDomainShmemDef {
char *name;
unsigned long long size;
int model; /* enum virDomainShmemModel */
+ int role; /* enum virDomainShmemRole */
struct {
bool enabled;
virDomainChrSourceDef chr;
@@ -3624,6 +3633,7 @@ VIR_ENUM_DECL(virDomainMemoryAllocation);
VIR_ENUM_DECL(virDomainIOMMUModel);
VIR_ENUM_DECL(virDomainVsockModel);
VIR_ENUM_DECL(virDomainShmemModel);
+VIR_ENUM_DECL(virDomainShmemRole);
VIR_ENUM_DECL(virDomainLaunchSecurity);
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 73b72c9e10..3f28943575 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -597,6 +597,8 @@ virDomainShmemDefInsert;
virDomainShmemDefRemove;
virDomainShmemModelTypeFromString;
virDomainShmemModelTypeToString;
+virDomainShmemRoleTypeFromString;
+virDomainShmemRoleTypeToString;
virDomainShutdownReasonTypeFromString;
virDomainShutdownReasonTypeToString;
virDomainShutoffReasonTypeFromString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 24e99e13b8..5ad7964b90 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8474,11 +8474,24 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
virBufferAdd(&buf, virDomainShmemModelTypeToString(shmem->model), -1);
virBufferAsprintf(&buf, ",id=%s", shmem->info.alias);
- if (shmem->server.enabled)
+ if (shmem->server.enabled) {
virBufferAsprintf(&buf, ",chardev=char%s", shmem->info.alias);
- else
+ } else {
virBufferAsprintf(&buf, ",memdev=shmmem-%s", shmem->info.alias);
+ switch ((virDomainShmemRole) shmem->role) {
+ case VIR_DOMAIN_SHMEM_ROLE_MASTER:
+ virBufferAddLit(&buf, ",master=on");
+ break;
+ case VIR_DOMAIN_SHMEM_ROLE_PEER:
+ virBufferAddLit(&buf, ",master=off");
+ break;
+ case VIR_DOMAIN_SHMEM_ROLE_DEFAULT:
+ case VIR_DOMAIN_SHMEM_ROLE_LAST:
+ break;
+ }
+ }
+
if (shmem->msi.vectors)
virBufferAsprintf(&buf, ",vectors=%u", shmem->msi.vectors);
if (shmem->msi.ioeventfd) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 78e64344f6..5ae85c7ae7 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1261,10 +1261,22 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
}
}
- if (vm->def->nshmems) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("migration with shmem device is not supported"));
- return false;
+ for (i = 0; i < vm->def->nshmems; i++) {
+ virDomainShmemDefPtr shmem = vm->def->shmems[i];
+
+ if (shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("migration with legacy shmem device is not supported"));
+ return false;
+ }
+ if (shmem->role == VIR_DOMAIN_SHMEM_ROLE_PEER) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain's shmem device '%s' has role='%s', "
+ "try unplugging it first"),
+ shmem->name,
+ virDomainShmemRoleTypeToString(shmem->role));
+ return false;
+ }
}
for (i = 0; i < vm->def->nnets; i++) {
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
index 68f592fb21..338017aa28 100644
--- a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
@@ -1,4 +1,4 @@
-<shmem name='shmem0'>
+<shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
index a6930bfa69..8013264989 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
@@ -45,7 +45,7 @@
<alias name='input1'/>
</input>
<memballoon model='none'/>
- <shmem name='shmem0'>
+ <shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
index 757b6b0980..0490310760 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
@@ -45,7 +45,7 @@
<alias name='input1'/>
</input>
<memballoon model='none'/>
- <shmem name='shmem0'>
+ <shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuxml2argvdata/shmem-plain-doorbell.args b/tests/qemuxml2argvdata/shmem-plain-doorbell.args
index 6ed86b7448..aa41d5391a 100644
--- a/tests/qemuxml2argvdata/shmem-plain-doorbell.args
+++ b/tests/qemuxml2argvdata/shmem-plain-doorbell.args
@@ -30,10 +30,10 @@ size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0x3 \
-object memory-backend-file,id=shmmem-shmem1,mem-path=/dev/shm/shmem1,\
size=134217728,share=yes \
--device ivshmem-plain,id=shmem1,memdev=shmmem-shmem1,bus=pci.0,addr=0x5 \
+-device ivshmem-plain,id=shmem1,memdev=shmmem-shmem1,master=off,bus=pci.0,addr=0x5 \
-object memory-backend-file,id=shmmem-shmem2,mem-path=/dev/shm/shmem2,\
size=268435456,share=yes \
--device ivshmem-plain,id=shmem2,memdev=shmmem-shmem2,bus=pci.0,addr=0x4 \
+-device ivshmem-plain,id=shmem2,memdev=shmmem-shmem2,master=on,bus=pci.0,addr=0x4 \
-device ivshmem-doorbell,id=shmem3,chardev=charshmem3,ioeventfd=on,bus=pci.0,\
addr=0x6 \
-chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
diff --git a/tests/qemuxml2argvdata/shmem-plain-doorbell.xml b/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
index e248d637a5..7c76e0fbba 100644
--- a/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
+++ b/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
@@ -22,11 +22,11 @@
<shmem name='shmem0'>
<model type='ivshmem-plain'/>
</shmem>
- <shmem name='shmem1'>
+ <shmem name='shmem1' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>128</size>
</shmem>
- <shmem name='shmem2'>
+ <shmem name='shmem2' role='master'>
<model type='ivshmem-plain'/>
<size unit='M'>256</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml b/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
index c5dd0f4598..64c0a7d753 100644
--- a/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
+++ b/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
@@ -26,12 +26,12 @@
<size unit='M'>4</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</shmem>
- <shmem name='shmem1'>
+ <shmem name='shmem1' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>128</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</shmem>
- <shmem name='shmem2'>
+ <shmem name='shmem2' role='master'>
<model type='ivshmem-plain'/>
<size unit='M'>256</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c17e3303b0..6cb2718767 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1135,7 +1135,8 @@ mymain(void)
DO_TEST("tap-vhost", NONE);
DO_TEST("tap-vhost-incorrect", NONE);
DO_TEST("shmem", NONE);
- DO_TEST("shmem-plain-doorbell", NONE);
+ DO_TEST("shmem-plain-doorbell",
+ QEMU_CAPS_DEVICE_IVSHMEM_PLAIN, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
DO_TEST("smbios", NONE);
DO_TEST("smbios-multiple-type2", NONE);
DO_TEST("smbios-type-fwcfg", NONE);
--
2.26.0.windows.1
4 years, 4 months
[PATCH 00/11] Implement initiator IQN config for iSCSI hostdevs (and cleanups)
by Peter Krempa
Last patch implements the initiator IQN, the rest is cleanups and
preparation.
Note that this series depends on:
https://www.redhat.com/archives/libvir-list/2020-July/msg00567.html
https://www.redhat.com/archives/libvir-list/2020-July/msg00717.html
Peter Krempa (11):
virDomainHostdevDefFormatSubsys: Use virXMLFormatElement
virDomainHostdevDefFormatSubsys: Split out formatting of USB subsystem
virDomainHostdevDefFormatSubsys: Split out formatting of PCI subsystem
virDomainHostdevDefFormatSubsys: Split out formatting of SCSI
subsystem
virDomainHostdevDefFormatSubsysSCSI: Avoid ternary operator when
formatting address
virDomainHostdevDefFormatSubsys: Split out formatting of vHBA
subsystem
virDomainHostdevDefFormatSubsys: Split out formatting of mdev
subsystem
virDomainHostdevSubsysSCSIDefParseXML: Use typecasted switch
virDomainHostdevSubsysSCSIiSCSIDefParseXML: Use XPath to fetch
elements
docs: formatdomain-devices: Split out '<hostdev>' into separate file
conf: Add support for initiator IQN setting for iSCSI hostdevs
docs/formatdomain-devices-hostdev.rst.in | 344 ++++++++++++++++++
docs/formatdomain-devices.rst.in | 338 +----------------
docs/schemas/domaincommon.rng | 3 +
src/conf/domain_conf.c | 329 ++++++++++-------
...hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 3 +-
...ostdev-scsi-virtio-scsi.x86_64-latest.args | 1 +
.../hostdev-scsi-virtio-scsi.xml | 3 +
.../hostdev-scsi-virtio-scsi.xml | 3 +
8 files changed, 545 insertions(+), 479 deletions(-)
create mode 100644 docs/formatdomain-devices-hostdev.rst.in
--
2.26.2
4 years, 4 months
[GSoC][PATCH v4 0/4] removal of qemu_domainjob dependencies
by Prathamesh Chavan
The following series of patches work on isolating the qemu_domainjob
from its dependency on other files such as `qemu_migration_params`,
`qemu_monitor`, etc. This is done by the introduction of a
`privateData` structure, which is further handled by a structure
of callback functions.
Previous version of this patch can be found here[1].
This new version improves the previous patches in accordance
with the review by Michal. Both domainJob and domainJobInfo
now passes the callback structure, instead of assigning each
variable manually.
[1]: https://www.redhat.com/archives/libvir-list/2020-July/msg00423.html
Prathamesh Chavan (4):
qemu_domain: remove passing `qemuDomainObjPrivatePtr` as param
qemu_domainjob: moved PrivateXML parse-job and format-job
qemu_domainjob: introduce `privateData` for `qemuDomainJob`
qemu_domainjob: introduce `privateData` for `qemuDomainJobInfo`
src/qemu/qemu_backup.c | 15 +-
src/qemu/qemu_domain.c | 254 +-----------------
src/qemu/qemu_domain.h | 28 ++
src/qemu/qemu_domainjob.c | 425 ++++++++++++++++++++++++++++---
src/qemu/qemu_domainjob.h | 83 ++++--
src/qemu/qemu_driver.c | 21 +-
src/qemu/qemu_migration.c | 42 ++-
src/qemu/qemu_migration_cookie.c | 7 +-
src/qemu/qemu_migration_params.c | 9 +-
src/qemu/qemu_process.c | 26 +-
10 files changed, 566 insertions(+), 344 deletions(-)
--
2.25.1
4 years, 4 months
kvm-hint-dedicated requires host CPU passthrough?
by Stefan Hajnoczi
Hi,
libvirt refuses to set KVM_HINTS_DEDICATED when the CPU model is not
host-passthrough.
Is there a reason for this limitation?
My understanding is that KVM_HINTS_DEDICATED means the vCPU is pinned to
a host CPU that is not shared with other tasks. Any KVM vCPU should be
able to support this feature, regardless of whether host-passthrough is
used or not.
Stefan
4 years, 4 months
[PATCH 00/18] qemu: Switch (i)SCSI host devices to -blockdev
by Peter Krempa
Peter Krempa (18):
qemuBlockStorageSourceGetBackendProps: Convert boolean arguments to
flags
qemuBlockStorageSourceGetBackendProps: Allow skipping
"discard":"unmap"
qemuBlockStorageSourceAttachData: Add field for ad-hoc storage node
name
virDomainHostdevDefFormatSubsys: Format private data for a
virStorageSource
virDomainHostdevSubsysSCSIiSCSIDefParseXML: Parse private data of
virStorageSource
qemustatusxml2xmltest: Add tests for iSCSI hostdev private data
handling
qemuDomainSecretHostdevDestroy: Don't clear secinfo alias
qemu: domain: Regenerate hostdev source private data
qemu: hotplug: Don't regenerate iSCSI secret alias
qemuBuildHostdevCommandLine: Extract (i)SCSI code
qemuBuildSCSIHostdevDevStr: Pass in backend alias
qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
qemu: command: Create qemuBlockStorageSourceAttachData for (i)SCSI
hostdevs
qemuBuildHostdevSCSICommandLine: Use new infrastructure
qemuDomainAttachHostSCSIDevice: Use new infrastructure
qemuDomainRemoveHostDevice: Use new infrastructure for (i)SCSI
qemu: caps: Enable QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
qemuBuildSCSIHostdevDrvStr: unexport
src/conf/domain_conf.c | 71 +++++---
src/qemu/qemu_block.c | 41 +++--
src/qemu/qemu_block.h | 12 +-
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 167 ++++++++++++------
src/qemu/qemu_command.h | 15 +-
src/qemu/qemu_domain.c | 58 +++++-
src/qemu/qemu_hotplug.c | 70 ++------
tests/qemublocktest.c | 18 +-
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../disk-secinfo-upgrade-in.xml | 20 +++
.../disk-secinfo-upgrade-out.xml | 30 ++++
tests/qemustatusxml2xmldata/modern-in.xml | 18 ++
.../hostdev-scsi-lsi.x86_64-latest.args | 52 +++---
...ostdev-scsi-virtio-scsi.x86_64-latest.args | 46 ++---
23 files changed, 426 insertions(+), 205 deletions(-)
--
2.26.2
4 years, 4 months