From ffb3f694481d0343180fbb9daf4b180d8440d4cc Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Tue, 14 Mar 2017 14:28:45 +0100 Subject: [PATCH] vz: Do not use magic constants when building capabilities Signed-off-by: Martin Kletzander --- src/vz/vz_driver.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index b5d2964f34..3536491c39 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -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; -- GitLab