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

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

 



---

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

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