[libvirt] [PATCH v3 0/2] lxc: Fix a bug related to IPv{4, 6} gateway persistent setting.
by Julio Faracco
This serie fixes a bug related to IPv{4,6} gateway settings when it is
defined and used with multiple network definitions. Basically, this data
is being carried on to the next network settings because the pointer is
not being cleaned up/initialized properly. The idea behind the fix was
create a new way to initialize the data without knowing the structure
attributes. The old way has a high probability to cause new bugs.
This serie add a new test case to cover this scenario too. It will be so
important to network index implemented on LXC 3.X.
v1-v2: Fixing tabs inside the code.
Julio Faracco (2):
lxc: Initializing IPv6 and IPv4 gateway to overwrite old settings.
tests: Adding test case to include multiple network definitions.
src/lxc/lxc_native.c | 27 ++++++-----
.../lxcconf2xml-miscnetwork-v3.config | 23 ++++++++++
.../lxcconf2xml-miscnetwork.config | 23 ++++++++++
.../lxcconf2xml-miscnetwork.xml | 45 +++++++++++++++++++
tests/lxcconf2xmltest.c | 2 +
5 files changed, 106 insertions(+), 14 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml
--
2.19.1
5 years, 11 months
[libvirt] [PATCH] qemu: Don't use -mem-prealloc among with .prealloc=yes
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1624223
There are two ways to request memory preallocation on cmd line:
-mem-prealloc and .prealloc attribute to memory-backend-file.
However, as it turns out it's not safe to use both at the same
time. Prefer -mem-prealloc as it is more backward compatible
compared to switching to "-numa node,memdev= + -object
memory-backend-file".
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 37 +++++++++++++------
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_domain.h | 3 ++
src/qemu/qemu_hotplug.c | 3 +-
.../hugepages-numa-default-dimm.args | 2 +-
6 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e338d3172e..0294030f0e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3123,6 +3123,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* @def: domain definition object
* @mem: memory definition object
* @autoNodeset: fallback nodeset in case of automatic NUMA placement
+ * @forbidPrealloc: don't set prealloc attribute
* @force: forcibly use one of the backends
*
* Creates a configuration object that represents memory backend of given guest
@@ -3136,6 +3137,9 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* Then, if one of the two memory-backend-* should be used, the @qemuCaps is
* consulted to check if qemu does support it.
*
+ * If @forbidPrealloc is true then 'prealloc' attribute of the backend is not
+ * set. This may come handy when global -mem-prealloc is already specified.
+ *
* Returns: 0 on success,
* 1 on success and if there's no need to use memory-backend-*
* -1 on error.
@@ -3148,6 +3152,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virDomainDefPtr def,
virDomainMemoryDefPtr mem,
virBitmapPtr autoNodeset,
+ bool forbidPrealloc,
bool force)
{
const char *backendType = "memory-backend-file";
@@ -3265,11 +3270,13 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
if (mem->nvdimmPath) {
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
goto cleanup;
- prealloc = true;
+ if (!forbidPrealloc)
+ prealloc = true;
} else if (useHugepage) {
if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
goto cleanup;
- prealloc = true;
+ if (!forbidPrealloc)
+ prealloc = true;
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
@@ -3398,7 +3405,8 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
mem.info.alias = alias;
if ((rc = qemuBuildMemoryBackendProps(&props, alias, cfg, priv->qemuCaps,
- def, &mem, priv->autoNodeset, false)) < 0)
+ def, &mem, priv->autoNodeset,
+ priv->memPrealloc, false)) < 0)
goto cleanup;
if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0)
@@ -3435,7 +3443,8 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
goto cleanup;
if (qemuBuildMemoryBackendProps(&props, alias, cfg, priv->qemuCaps,
- def, mem, priv->autoNodeset, true) < 0)
+ def, mem, priv->autoNodeset,
+ priv->memPrealloc, true) < 0)
goto cleanup;
if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0)
@@ -7443,7 +7452,8 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
static int
qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
- virCommandPtr cmd)
+ virCommandPtr cmd,
+ qemuDomainObjPrivatePtr priv)
{
const long system_page_size = virGetSystemPageSizeKB();
char *mem_path = NULL;
@@ -7465,8 +7475,10 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
return 0;
}
- if (def->mem.allocation != VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
+ if (def->mem.allocation != VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) {
virCommandAddArgList(cmd, "-mem-prealloc", NULL);
+ priv->memPrealloc = true;
+ }
virCommandAddArgList(cmd, "-mem-path", mem_path, NULL);
VIR_FREE(mem_path);
@@ -7479,7 +7491,8 @@ static int
qemuBuildMemCommandLine(virCommandPtr cmd,
virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ qemuDomainObjPrivatePtr priv)
{
if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
return -1;
@@ -7498,15 +7511,17 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
virDomainDefGetMemoryInitial(def) / 1024);
}
- if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
+ if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) {
virCommandAddArgList(cmd, "-mem-prealloc", NULL);
+ priv->memPrealloc = true;
+ }
/*
* Add '-mem-path' (and '-mem-prealloc') parameter here if
* the hugepages and no numa node is specified.
*/
if (!virDomainNumaGetNodeCount(def->numa) &&
- qemuBuildMemPathStr(cfg, def, cmd) < 0)
+ qemuBuildMemPathStr(cfg, def, cmd, priv) < 0)
return -1;
if (def->mem.locked && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_REALTIME_MLOCK)) {
@@ -7613,7 +7628,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
}
if (!needBackend &&
- qemuBuildMemPathStr(cfg, def, cmd) < 0)
+ qemuBuildMemPathStr(cfg, def, cmd, priv) < 0)
goto cleanup;
for (i = 0; i < ncells; i++) {
@@ -10250,7 +10265,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0)
goto error;
- if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps) < 0)
+ if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps, priv) < 0)
goto error;
if (qemuBuildSmpCommandLine(cmd, def) < 0)
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 98d4ac90b5..656479ac45 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -129,6 +129,7 @@ int qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virDomainDefPtr def,
virDomainMemoryDefPtr mem,
virBitmapPtr autoNodeset,
+ bool forbidPrealloc,
bool force);
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ba3fff607a..0307acfe6a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1944,6 +1944,8 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
VIR_FREE(priv->libDir);
VIR_FREE(priv->channelTargetDir);
+ priv->memPrealloc = false;
+
/* remove automatic pinning data */
virBitmapFree(priv->autoNodeset);
priv->autoNodeset = NULL;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 80bd4bde91..7ccbff8d26 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -370,6 +370,9 @@ struct _qemuDomainObjPrivate {
/* qemuProcessStartCPUs stores the reason for starting vCPUs here for the
* RESUME event handler to use it */
virDomainRunningReason runningReason;
+
+ /* true if global -mem-prealloc appears on cmd line */
+ bool memPrealloc;
};
# define QEMU_DOMAIN_PRIVATE(vm) \
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0a63741b9e..6ead926f09 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2458,7 +2458,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
goto cleanup;
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
- priv->qemuCaps, vm->def, mem, NULL, true) < 0)
+ priv->qemuCaps, vm->def, mem, NULL,
+ priv->memPrealloc, true) < 0)
goto cleanup;
if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
index 143d8b041f..df90f7aad9 100644
--- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
+++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-mem-prealloc \
-mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \
-numa node,nodeid=0,cpus=0-1,mem=1024 \
--object memory-backend-file,id=memdimm0,prealloc=yes,\
+-object memory-backend-file,id=memdimm0,\
mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,\
host-nodes=1-3,policy=bind \
-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
--
2.18.1
5 years, 11 months
[libvirt] [PATCH] tools: relax x509 Subject regexes to allow numbers and more
by Daniel P. Berrangé
The virt-pki-validate tool is extracting components in the x509
certificate Subject field. Unfortunately the regex it is is using is far
too strict, and so truncating valid data. It needs to consider ',' as a
field separator, and if that's not there take all data until the EOL.
With the broken regex:
$ echo " Subject: O=Test,CN=guestHyp1ver" | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'
guestHyp
And with the fixed regex
$ echo "Subject: O=Test,CN=guestHyp1ver" | sed 's+.*CN=\([^,]*\).*+\1+'
guestHyp1ver
Reported-by: Kashyap Chamarthy <kchamart(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
tools/virt-pki-validate.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index b04680ddef..c3fadbba64 100755
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -201,14 +201,14 @@ then
echo Client certificate $LIBVIRT/clientcert.pem should be world readable
echo "as root do: chown root:root $LIBVIRT/clientcert.pem ; chmod 644 $LIBVIRT/clientcert.pem"
else
- S_ORG=`"$CERTOOL" -i --infile "$LIBVIRT/clientcert.pem" | grep Subject: | sed 's+.*O=\([a-zA-Z \._-]*\).*+\1+'`
+ S_ORG=`"$CERTOOL" -i --infile "$LIBVIRT/clientcert.pem" | grep Subject: | sed 's+.*O=\([^,]*\).*+\1+'`
if [ "$ORG" != "$S_ORG" ]
then
echo The CA certificate and the client certificate do not match
echo CA organization: $ORG
echo Client organization: $S_ORG
fi
- CLIENT=`"$CERTOOL" -i --infile "$LIBVIRT/clientcert.pem" | grep Subject: | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'`
+ CLIENT=`"$CERTOOL" -i --infile "$LIBVIRT/clientcert.pem" | grep Subject: | sed 's+.*CN=\(.[^,]*\).*+\1+'`
echo Found client certificate $LIBVIRT/clientcert.pem for $CLIENT
if [ ! -e "$LIBVIRTP/clientkey.pem" ]
then
@@ -248,14 +248,14 @@ then
echo Server certificate $LIBVIRT/servercert.pem should be world readable
echo "as root do: chown root:root $LIBVIRT/servercert.pem ; chmod 644 $LIBVIRT/servercert.pem"
else
- S_ORG=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*O=\([a-zA-Z\. _-]*\).*+\1+'`
+ S_ORG=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*O=\([^,]*\).*+\1+'`
if [ "$ORG" != "$S_ORG" ]
then
echo The CA certificate and the server certificate do not match
echo CA organization: $ORG
echo Server organization: $S_ORG
fi
- S_HOST=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'`
+ S_HOST=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*CN=\([^,]*\).*+\1+'`
if test "$S_HOST" != "`hostname -s`" && test "$S_HOST" != "`hostname`"
then
echo The server certificate does not seem to match the host name
--
2.19.2
5 years, 11 months
[libvirt] Adding MTU DHCP option when specified
by Casey Callendrello
Hi there,
I was working on some MTU testing for OpenShift, and I realized that, while
libvirt does allow specifying the MTU of the bridge interface, it doesn't
plumb it through the DHCP server.
This is really easy - it's just an extra line in the dnsmasq.conf file,
e.g.:
dhcp-option-force=option:mtu,9000
Any interest in this as a patch? And, apologies if this has been discussed
to death (though I searched around and didn't find anything).
Cheers,
-- Casey C.
5 years, 11 months
[libvirt] [PATCH v2] qemu: disable external snapshot of readonly disk
by Nikolay Shirokovskiy
Disable external snapshot of readonly disk for inactive domains
as this operation is not very useful. As to active domains
such snapshot was not possible before already but error message was
not helpful so now it will be better.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
Diff from v1 [1]
================
- move check to qemuDomainSnapshotPrepareDiskExternal
- disable such snapshot for inactive domain as well
[1] [PATCH] qemu: snapshot: better error for active external readonly disk
https://www.redhat.com/archives/libvir-list/2018-October/msg01322.html
continues in
https://www.redhat.com/archives/libvir-list/2018-November/msg00265.html
src/qemu/qemu_driver.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e249..e747a5b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14514,6 +14514,13 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
int ret = -1;
struct stat st;
+ if (disk->src->readonly) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external snapshot for readonly disk %s "
+ "is not supported"), disk->dst);
+ return -1;
+ }
+
if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0)
return -1;
--
1.8.3.1
5 years, 11 months
[libvirt] [PATCH 1/2] libxl: add missing cleanup on error path in libxlDomainPMWakeup
by Marek Marczykowski-Górecki
Since domain was suspended before and on failed wakeup is destroyed,
send an event.
Also, add missing libxlDomainCleanup.
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5aa68a7c43..eb719345e8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1527,6 +1527,9 @@ libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags)
libxlDomainDestroyInternal(driver, vm);
vm->def->id = -1;
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED);
+ event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_FAILED);
+ libxlDomainCleanup(driver, vm);
endjob:
libxlDomainObjEndJob(driver, vm);
--
2.17.2
5 years, 11 months
[libvirt] [PATCH] On Xen, domains may be destroyed without libvirt being involved
by Demi M. Obenour
This can happen via `xl destroy`, for example. When this happens,
libvirt is stuck in an inconsistent state: libvirt believes the domain
is still running, but attempts to use libvirt’s APIs to shutdown the
domain fail. The only way out of this situation is to restart libvirt.
To prevent this from happening, process LIBXL_EVENT_TYPE_DOMAIN_DEATH as
well as LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN, but only if libvirt has not
already begun to destroy the domain.
Signed-off-by: Demi Obenour <demiobenour(a)gmail.com>
---
src/conf/domain_conf.h | 4 ++++
src/libxl/libxl_domain.c | 24 +++++++++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b24e6ec3de..d3520bde15 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2620,6 +2620,10 @@ struct _virDomainObj {
unsigned int updated : 1;
unsigned int removing : 1;
+ /* Only used by the Xen backend */
+ unsigned int being_destroyed_by_libvirt : 1;
+ unsigned int already_destroyed : 1;
+
virDomainDefPtr def; /* The current definition */
virDomainDefPtr newDef; /* New definition to activate at shutdown */
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 5fe3f44fbe..680e5f209f 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -482,9 +482,21 @@ libxlDomainShutdownThread(void *opaque)
goto cleanup;
}
+ VIR_INFO("Domain %d died", event->domid);
+
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
+ if (LIBXL_EVENT_TYPE_DOMAIN_DEATH == ev->type) {
+ if (vm->being_destroyed_by_libvirt) {
+ VIR_INFO("VM %d already being destroyed by libvirt",
event->domid);
+ goto cleanup;
+ }
+
+ VIR_INFO("Marking VM %d as already destroyed", event->domid);
+ vm->already_destroyed = true;
+ }
+
if (xl_reason == LIBXL_SHUTDOWN_REASON_POWEROFF) {
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF,
VIR_DOMAIN_SHUTOFF_SHUTDOWN);
@@ -620,7 +632,8 @@ libxlDomainEventHandler(void *data,
VIR_LIBXL_EVENT_CONST libxl_event *event)
virThread thread;
libxlDriverConfigPtr cfg;
- if (event->type != LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) {
+ if (LIBXL_EVENT_TYPE_DOMAIN_DEATH != event->type &&
+ LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN != event->type) {
VIR_INFO("Unhandled event type %d", event->type);
goto error;
}
@@ -629,18 +642,16 @@ libxlDomainEventHandler(void *data,
VIR_LIBXL_EVENT_CONST libxl_event *event)
* Start a thread to handle shutdown. We don't want to be tying up
* libxl's event machinery by doing a potentially lengthy shutdown.
*/
- if (VIR_ALLOC(shutdown_info) < 0)
- goto error;
+ while (VIR_ALLOC(shutdown_info) < 0) {}
shutdown_info->driver = driver;
shutdown_info->event = (libxl_event *)event;
- if (virThreadCreate(&thread, false, libxlDomainShutdownThread,
+ while (virThreadCreate(&thread, false, libxlDomainShutdownThread,
shutdown_info) < 0) {
/*
* Not much we can do on error here except log it.
*/
VIR_ERROR(_("Failed to create thread to handle domain shutdown"));
- goto error;
}
/*
@@ -752,6 +763,9 @@ libxlDomainDestroyInternal(libxlDriverPrivatePtr driver,
{
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
int ret = -1;
+ if (vm->already_destroyed)
+ return -1;
+ vm->being_destroyed_by_libvirt = true;
/* Unlock virDomainObj during destroy, which can take considerable
* time on large memory domains.
--
2.17.2
5 years, 11 months
[libvirt] libvirt-csharp for .NET Standard/Core
by Brian Wengel
Anyone out there manage to port *libvirt-csharp* to *.NET Standard* (or
Core)?
Or perhaps it could be in the future?
I think .Core is getting more mature on Linux and I would love to have more
direct access to libvirt in my .Core code :-)
Best regards
Brian Wengel
Denmark
5 years, 11 months
[libvirt] [bug report] Requested operation is not valid: migration with shmem device is not supported
by 吴 雨霖
1.Description of problem:
It report use migration with shmem device is not supported , when I use the command "virsh migrate --live" to migrate a VM to another host.
2.Version-Release number of selected component (if applicable):
libvirt 3.9.0
qemu-kvm 2.8.1
3.Steps to Reproduce:
1) Add serveral lines below to guest configuration
<shmem name='my_shmem1'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
</shmem>
2) virsh start guest-1
3) virsh migrate --live guest-1 qemu+ssh://target/system
Actual results:
error: Requested operation is not valid: migration with shmem device is not supported
4.Code Review
When using the command “virsh create guset-1.xml,it produce corresponding command below.
“qemu-kvm -device ivshmem-plain, id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0xa”
I read qemu-doc.texi in qemu-2.8.1 source code, which have a explain of migrating ivshmem below
“With device property @option{master=on}, the guest will copy the shared
memory on migration to the destination host. With @option{master=off},
the guest will not be able to migrate with the device attached.”
But libvirt library can not recognize the property “master=on”. When I directly used command "qemu-kvm -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,master=on,bus=pci.0,addr=0xa” to launch a guest, it can migrate in live.
I review the code about qemu code with branch 2.8.1 and master from https://github.com/libvirt/libvirt, it have no configuration definition for “master=on”
The below is the part of source code
domain_conf.h
struct _virDomainShmemDef {
char *name;
unsigned long long size;
int model; /* enum virDomainShmemModel */
struct {
bool enabled;
virDomainChrSourceDef chr;
} server;
struct {
bool enabled;
unsigned vectors;
virTristateSwitch ioeventfd;
} msi;
virDomainDeviceInfo info;
};
5 years, 11 months
[libvirt] 转发: [bug confirm] Requested operation is not valid: migration with shmem device is not supported
by 吴 雨霖
1.Description of problem:
It report use migration with shmem device is not supported , when I use the command "virsh migrate --live" to migrate a VM to another host.
2.Version-Release number of selected component (if applicable):
libvirt 3.9.0
qemu-kvm 2.8.1
3.Steps to Reproduce:
1) Add serveral lines below to guest configuration
<shmem name='my_shmem1'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
</shmem>
2) virsh start guest-1
3) virsh migrate --live guest-1 qemu+ssh://target/system
Actual results:
error: Requested operation is not valid: migration with shmem device is not supported
4.Code Review
When using the command “virsh create guset-1.xml,it produce corresponding command below.
“qemu-kvm -device ivshmem-plain, id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0xa”
I read qemu-doc.texi in qemu-2.8.1 source code, which have a explain of migrating ivshmem below
“With device property @option{master=on}, the guest will copy the shared
memory on migration to the destination host. With @option{master=off},
the guest will not be able to migrate with the device attached.”
But libvirt library can not recognize the property “master=on”. When I directly used command "qemu-kvm -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,master=on,bus=pci.0,addr=0xa” to launch a guest, it can migrate in live.
I review the code about qemu code with branch 2.8.1 and master from https://github.com/libvirt/libvirt, it have no configuration definition for “master=on”
The below is the part of source code
domain_conf.h
struct _virDomainShmemDef {
char *name;
unsigned long long size;
int model; /* enum virDomainShmemModel */
struct {
bool enabled;
virDomainChrSourceDef chr;
} server;
struct {
bool enabled;
unsigned vectors;
virTristateSwitch ioeventfd;
} msi;
virDomainDeviceInfo info;
};
5 years, 11 months