Blob Blame History Raw
From 244b42c385fc611380bfb2532905a63ce4380254 Mon Sep 17 00:00:00 2001
Message-Id: <244b42c385fc611380bfb2532905a63ce4380254@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 16 May 2017 10:44:58 +0200
Subject: [PATCH] conf: split out virDomainIOMMUDefCheckABIStability
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit 3a276c6524026b661ed7bee4539fc5387b963611)
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 | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e77b542f3..7bf480f2a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19810,6 +19810,22 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src,
 
 
 static bool
+virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src,
+                                   virDomainIOMMUDefPtr dst)
+{
+    if (src->model != dst->model) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain IOMMU device model '%s' "
+                         "does not match source '%s'"),
+                       virDomainIOMMUModelTypeToString(dst->model),
+                       virDomainIOMMUModelTypeToString(src->model));
+        return false;
+    }
+    return true;
+}
+
+
+static bool
 virDomainDefVcpuCheckAbiStability(virDomainDefPtr src,
                                   virDomainDefPtr dst)
 {
@@ -20275,14 +20291,8 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
     }
 
     if (src->iommu &&
-        src->iommu->model != dst->iommu->model) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain IOMMU device model '%s' "
-                         "does not match source '%s'"),
-                       virDomainIOMMUModelTypeToString(dst->iommu->model),
-                       virDomainIOMMUModelTypeToString(src->iommu->model));
+        !virDomainIOMMUDefCheckABIStability(src->iommu, dst->iommu))
         goto error;
-    }
 
     /* Coverity is not very happy with this - all dead_error_condition */
 #if !STATIC_ANALYSIS
-- 
2.13.0