If 'optional' is set on enabled and a migratable domain XML is requested
the 'optional' value is removed.

Signed-off-by: Boris Fiuczynski <fiu...@linux.ibm.com>
---
 src/conf/domain_conf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7191e37a6c..6f451a9bfe 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27019,7 +27019,8 @@ virDomainFeatureTCGFormat(virBuffer *buf,
 
 static int
 virDomainDefFormatFeatures(virBuffer *buf,
-                           virDomainDef *def)
+                           virDomainDef *def,
+                           bool migratable)
 {
     g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
     size_t i;
@@ -27357,6 +27358,9 @@ virDomainDefFormatFeatures(virBuffer *buf,
             break;
 
         case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN:
+            if (migratable && def->features[i] == 
VIR_QUADSTATE_OPTION_OPTIONAL)
+                break;
+
             if (def->features[i] != VIR_QUADSTATE_OPTION_ABSENT)
                 virBufferAsprintf(&childBuf, "<async-teardown 
enabled='%s'/>\n",
                                   
virQuadstateOptionTypeToString(def->features[i]));
@@ -27649,7 +27653,7 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
         virBufferAddLit(buf, "</idmap>\n");
     }
 
-    if (virDomainDefFormatFeatures(buf, def) < 0)
+    if (virDomainDefFormatFeatures(buf, def, migratable) < 0)
         return -1;
 
     if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0)
-- 
2.41.0

Reply via email to