add ivshmem property master

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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.
 
[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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux