[PATCH 3/4] cpu_s390: Implement virCPUValidateFeatures

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

 



Only feature policy is checked on s390, which was previously done in
virCPUUpdate, but that's not the correct place for the check once we
have virCPUValidateFeatures.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/cpu/cpu_s390.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
index 2ef03367d7..3d10f920ba 100644
--- a/src/cpu/cpu_s390.c
+++ b/src/cpu/cpu_s390.c
@@ -78,14 +78,6 @@ virCPUs390Update(virCPUDefPtr guest,
          goto cleanup;
 
      for (i = 0; i < guest->nfeatures; i++) {
-         if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
-             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                            _("only cpu feature policies 'require' and "
-                              "'disable' are supported for %s"),
-                            guest->features[i].name);
-             goto cleanup;
-        }
-
         if (virCPUDefUpdateFeature(updated,
                                    guest->features[i].name,
                                    guest->features[i].policy) < 0)
@@ -102,6 +94,26 @@ virCPUs390Update(virCPUDefPtr guest,
      return ret;
 }
 
+
+static int
+virCPUs390ValidateFeatures(virCPUDefPtr cpu)
+{
+    size_t i;
+
+    for (i = 0; i < cpu->nfeatures; i++) {
+        if (cpu->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("only cpu feature policies 'require' and "
+                             "'disable' are supported for %s"),
+                           cpu->features[i].name);
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+
 struct cpuArchDriver cpuDriverS390 = {
     .name = "s390",
     .arch = archs,
@@ -111,4 +123,5 @@ struct cpuArchDriver cpuDriverS390 = {
     .encode     = NULL,
     .baseline   = NULL,
     .update     = virCPUs390Update,
+    .validateFeatures = virCPUs390ValidateFeatures,
 };
-- 
2.14.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]
  Powered by Linux