[PATCH 8/9] domain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE

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

 



This is an internal flag that prevents our two entry points to
XML parsing (virDomainDefParse and virDomainDeviceDefParse) from
running post parse callbacks. This is expected to be used in
cases when we already have full domain/device XML and we are just
parsing it back (i.e. virDomainDefCopy or virDomainDeviceDefCopy)

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 8 ++++++++
 src/conf/domain_conf.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 89a3f62..7e4aba6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4396,6 +4396,10 @@ virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
 {
     int ret;
 
+    /* fill in configuration only in certain places */
+    if (flags & VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE)
+        return 0;
+
     if (xmlopt->config.devicesPostParseCallback) {
         ret = xmlopt->config.devicesPostParseCallback(dev, def, caps, flags,
                                                       xmlopt->config.priv,
@@ -4554,6 +4558,10 @@ virDomainDefPostParseOpaque(virDomainDefPtr def,
         .parseFlags = parseFlags,
     };
 
+    /* fill in configuration only in certain places */
+    if (parseFlags & VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE)
+        return 0;
+
     /* this must be done before the hypervisor-specific callback,
      * in case presence of a controller at a specific index is checked
      */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 17ade4b..7b097ab 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2647,6 +2647,8 @@ typedef enum {
     VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 9,
     /* skip definition validation checks meant to be executed on define time only */
     VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 10,
+    /* skip post parse callback */
+    VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE = 1 << 11,
 } virDomainDefParseFlags;
 
 typedef enum {
-- 
2.8.4

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