[PATCH 5/8] qemu: Implement vimDomainNormalizeXML

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0763f9b..1f35c06 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15653,6 +15653,50 @@ cleanup:
     return ret;
 }
 
+static int
+qemuDomainNormalizeXML(virDomainPtr dom,
+                       const char *xmlIn,
+                       char **xmlOut,
+                       unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    int ret = -1;
+    virDomainDeviceDefPtr dev_def = NULL;
+    virCapsPtr caps = NULL;
+
+    /* Flags checked by virDomainDefFormat */
+
+    if (!(vm = qemuDomObjFromDomain(dom)))
+        return ret;
+
+    if (virDomainNormalizeXMLEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
+        goto cleanup;
+
+    if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
+        flags |= QEMU_DOMAIN_FORMAT_LIVE_FLAGS;
+
+    if (!(dev_def = virDomainDeviceDefParse(xmlIn, vm->def, caps,
+                                            driver->xmlopt,
+                                            flags)))
+        goto cleanup;
+
+    if (xmlOut &&
+        !(*xmlOut = virDomainDeviceDefFormat(dev_def, flags)))
+        goto cleanup;
+
+    ret = 0;
+
+cleanup:
+    virDomainDeviceDefFree(dev_def);
+    virObjectUnref(caps);
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
 
 static int
 qemuNodeGetInfo(virConnectPtr conn,
@@ -15954,6 +15998,7 @@ static virDriver qemuDriver = {
     .domainMigratePerform3Params = qemuDomainMigratePerform3Params, /* 1.1.0 */
     .domainMigrateFinish3Params = qemuDomainMigrateFinish3Params, /* 1.1.0 */
     .domainMigrateConfirm3Params = qemuDomainMigrateConfirm3Params, /* 1.1.0 */
+    .domainNormalizeXML = qemuDomainNormalizeXML, /* 1.1.3 */
 };
 
 
-- 
1.8.1.5

--
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]