[libvirt] add ivshmem property master
Martin Kletzander
mkletzan at redhat.com
Fri Feb 1 08:34:11 UTC 2019
[Please use git send-email or a normal client, this attachment is difficult to
go through, not to mention that the diff is completely broken]
On Fri, Feb 01, 2019 at 08:16:20AM +0000, 吴 雨霖 wrote:
>[Problem Description]
>
> I read qemu-doc.texi in qemu-mster 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.”
>
> However, 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, qemu support ivshmem property master=on.
>
> So, I suggest adding code to support property master=on in libvirt.
>
QEMU supports that, but libvirt doesn't. I remember there was a reason
for it, but I can't seem to recall what the particular reason was.
What is the reason for you to need master=on?
>
>
>[Code Review]
>
>
>
> The below is the part of source code in qemu-master. There's no definition here about ivshmem master.
>
>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;
>
>};
>
>[changed code]
>
>src/conf/domain_conf.c
>
>src/conf/domain_conf.h
>
>
>
>[Detail of Source Code Modification]
>
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 9f75dc4..b41be37 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -14665,7 +14665,6 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
> xmlNodePtr save = ctxt->node;
> xmlNodePtr server = NULL;
>
>-
> if (VIR_ALLOC(def) < 0)
> return NULL;
>
>-
> if (VIR_ALLOC(def) < 0)
> return NULL;
>
>@@ -14685,12 +14684,28 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
> VIR_FREE(tmp);
> }
>
>+
> if (!(def->name = virXMLPropString(node, "name"))) {
> virReportError(VIR_ERR_XML_ERROR, "%s",
> _("shmem element must contain 'name' attribute"));
> goto cleanup;
> }
>
>+
>+ if ((tmp = virXMLPropString(node, "master"))) {
>+ int val;
>+
>+ if ((val = virTristateSwitchTypeFromString(tmp)) <= 0) {
>+ virReportError(VIR_ERR_XML_ERROR,
>+ _("invalid ivshmem master setting for shmem: '%s'"),
>+ tmp);
>+ goto cleanup;
>+ }
>+ def->master = val;
>+ VIR_FREE(tmp);
>+ }
>+
>+
> if (virDomainParseScaledValue("./size[1]", NULL, ctxt,
> &def->size, 1, ULLONG_MAX, false) < 0)
> goto cleanup;
>diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>index f1e6e4e..615d721 100644
>--- a/src/conf/domain_conf.h
>+++ b/src/conf/domain_conf.h
>@@ -1727,8 +1727,10 @@ typedef enum {
>
>struct _virDomainShmemDef {
> char *name;
>+
> unsigned long long size;
> int model; /* enum virDomainShmemModel */
>+ virTristateSwitch master;
> struct {
> bool enabled;
> virDomainChrSourceDef chr;
>}
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190201/49f3d187/attachment-0001.sig>
More information about the libvir-list
mailing list