[libvirt] [PATCHv2 4/8] conf: Add RNG device ABI compatibility check

Peter Krempa pkrempa at redhat.com
Thu Feb 21 14:47:36 UTC 2013


---

Notes:
    Version 2:
    - ACKed, no change, doesn't make sense to push alone

 src/conf/domain_conf.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 082f1f5..b6de57c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11700,6 +11700,36 @@ virDomainMemballoonDefCheckABIStability(virDomainMemballoonDefPtr src,


 static bool
+virDomainRNGDefCheckABIStability(virDomainRNGDefPtr src,
+                                 virDomainRNGDefPtr dst)
+{
+    if (!src && !dst)
+        return true;
+
+    if (!src || !dst) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain RNG device count '%d' "
+                         "does not match source count '%d'"),
+                       src ? 1 : 0, dst ? 1 : 0);
+        return false;
+    }
+
+    if (src->model != dst->model) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target RNG model '%s' does not match source '%s'"),
+                       virDomainRNGModelTypeToString(dst->model),
+                       virDomainRNGModelTypeToString(src->model));
+        return false;
+    }
+
+    if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
+        return false;
+
+    return true;
+}
+
+
+static bool
 virDomainHubDefCheckABIStability(virDomainHubDefPtr src,
                                  virDomainHubDefPtr dst)
 {
@@ -12100,6 +12130,9 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
                                                  dst->memballoon))
         return false;

+    if (!virDomainRNGDefCheckABIStability(src->rng, dst->rng))
+        return false;
+
     return true;
 }

-- 
1.8.1.1




More information about the libvir-list mailing list