]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vz: Do not use magic constants when building capabilities
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 14 Mar 2017 13:28:45 +0000 (14:28 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 11:13:29 +0000 (13:13 +0200)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/vz/vz_driver.c

index b5d2964f34fb5ad2e125d000ef75ea5330a24df8..3536491c399432c6b703d05619600cf7e383f028 100644 (file)
@@ -119,9 +119,12 @@ vzBuildCapabilities(void)
     if (nodeCapsInitNUMA(caps) < 0)
         goto error;
 
-    for (i = 0; i < 2; i++)
-        for (j = 0; j < 2; j++)
-            for (k = 0; k < 2; k++)
+
+    verify(ARRAY_CARDINALITY(archs) == ARRAY_CARDINALITY(emulators));
+
+    for (i = 0; i < ARRAY_CARDINALITY(os_types); i++)
+        for (j = 0; j < ARRAY_CARDINALITY(archs); j++)
+            for (k = 0; k < ARRAY_CARDINALITY(emulators); k++)
                 if (vzCapsAddGuestDomain(caps, ostypes[i], archs[j],
                                          emulators[k], virt_types[k]) < 0)
                     goto error;