[libvirt] [PATCH v2 2/4] virDomainCreateXML: Make domain definition transient

Martin Kletzander mkletzan at redhat.com
Thu Sep 24 09:00:38 UTC 2015


On Wed, Sep 23, 2015 at 03:00:35PM +0200, Michal Privoznik wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=871452
>
>So, you want to create a domain from XML. The domain already
>exists in libvirt's database of domains. It's okay, because name
>and UUID matches. However, on domain startup, internal
>representation of the domain is overwritten with your XML even
>though we claim that the XML you've provided is a transient one.
>The bug is to be found across nearly all the drivers.
>Le sigh.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/bhyve/bhyve_driver.c   | 1 +
> src/libxl/libxl_driver.c   | 1 +
> src/lxc/lxc_driver.c       | 1 +
> src/openvz/openvz_driver.c | 1 +
> src/qemu/qemu_driver.c     | 1 +
> src/test/test_driver.c     | 1 +
> src/uml/uml_driver.c       | 1 +
> src/vmware/vmware_driver.c | 1 +
> 8 files changed, 8 insertions(+)
>

It's sad that VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE now exists just
because of vmware, otherwise VIR_DOMAIN_OBJ_LIST_ADD_LIVE could do
just that.  Anyway, thanks for fixing it.

>diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
>index 7f365b1..d44cf2c 100644
>--- a/src/bhyve/bhyve_driver.c
>+++ b/src/bhyve/bhyve_driver.c
>@@ -918,6 +918,7 @@ bhyveDomainCreateXML(virConnectPtr conn,
>
>     if (!(vm = virDomainObjListAdd(privconn->domains, def,
>                                    privconn->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE, NULL)))
>         goto cleanup;
>     def = NULL;
>diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>index 5048957..fc6dcec 100644
>--- a/src/libxl/libxl_driver.c
>+++ b/src/libxl/libxl_driver.c
>@@ -974,6 +974,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
>
>     if (!(vm = virDomainObjListAdd(driver->domains, def,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
>index e5e6c5a..b408be0 100644
>--- a/src/lxc/lxc_driver.c
>+++ b/src/lxc/lxc_driver.c
>@@ -1229,6 +1229,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
>
>     if (!(vm = virDomainObjListAdd(driver->domains, def,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
>index fc8db7e..d78e2f5 100644
>--- a/src/openvz/openvz_driver.c
>+++ b/src/openvz/openvz_driver.c
>@@ -1093,6 +1093,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
>     if (!(vm = virDomainObjListAdd(driver->domains,
>                                    vmdef,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 30d2d98..2a4b026 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -1745,6 +1745,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
>
>     if (!(vm = virDomainObjListAdd(driver->domains, def,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>diff --git a/src/test/test_driver.c b/src/test/test_driver.c
>index b40b079..01ab1e3 100644
>--- a/src/test/test_driver.c
>+++ b/src/test/test_driver.c
>@@ -1616,6 +1616,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
>     if (!(dom = virDomainObjListAdd(privconn->domains,
>                                     def,
>                                     privconn->xmlopt,
>+                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                     VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                     NULL)))
>         goto cleanup;
>diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
>index d4b03b3..14598fc 100644
>--- a/src/uml/uml_driver.c
>+++ b/src/uml/uml_driver.c
>@@ -1615,6 +1615,7 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml,
>
>     if (!(vm = virDomainObjListAdd(driver->domains, def,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
>index 152af39..a12b03a 100644
>--- a/src/vmware/vmware_driver.c
>+++ b/src/vmware/vmware_driver.c
>@@ -704,6 +704,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
>     if (!(vm = virDomainObjListAdd(driver->domains,
>                                    vmdef,
>                                    driver->xmlopt,
>+                                   VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
>                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                    NULL)))
>         goto cleanup;
>--
>2.4.9
>
>--
>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: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150924/744eeb92/attachment-0001.sig>


More information about the libvir-list mailing list