render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 0823b17d4ddc02a0bfca9fece7ff5ae3fd106a91 Mon Sep 17 00:00:00 2001
Message-Id: <0823b17d4ddc02a0bfca9fece7ff5ae3fd106a91@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 16 May 2017 10:44:49 +0200
Subject: [PATCH] Split out virDomainIOMMUDefFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Make adding subelements easier.

(cherry picked from commit d34ac94351255721ae86eba561cd2ba1d620ab7b)
Signed-off-by: Ján Tomko <jtomko@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/conf/domain_conf.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a918ecd59..4096b9caf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24068,6 +24068,15 @@ virDomainDefIothreadShouldFormat(virDomainDefPtr def)
 }
 
 
+static void
+virDomainIOMMUDefFormat(virBufferPtr buf,
+                        const virDomainIOMMUDef *iommu)
+{
+    virBufferAsprintf(buf, "<iommu model='%s'/>\n",
+                      virDomainIOMMUModelTypeToString(iommu->model));
+}
+
+
 /* This internal version appends to an existing buffer
  * (possibly with auto-indent), rather than flattening
  * to string.
@@ -24814,10 +24823,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             goto error;
     }
 
-    if (def->iommu) {
-        virBufferAsprintf(buf, "<iommu model='%s'/>\n",
-                          virDomainIOMMUModelTypeToString(def->iommu->model));
-    }
+    if (def->iommu)
+        virDomainIOMMUDefFormat(buf, def->iommu);
 
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</devices>\n");
-- 
2.13.0