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

[Libvir] [PATCH] Add xen and hvm guest types to test drive caps



The attached patch adds xen and hvm guest types to the test driver's 
capabilities. It was currently set to offer only a 'linux' type which
doesn't seem to follow the conventions of the other drivers, so I
removed that. Please yell if I'm wrong :)

Thanks,
Cole
diff --git a/src/test.c b/src/test.c
index f401d7d..9b2ca56 100644
--- a/src/test.c
+++ b/src/test.c
@@ -984,6 +984,8 @@ static char *testGetCapabilities (virConnectPtr conn)
     char *xml;
     int cell1[] = { 0, 2, 4, 6, 8, 10, 12, 14 };
     int cell2[] = { 1, 3, 5, 7, 9, 11, 13, 15 };
+    const char *guest_types[] = { "hvm", "xen" };
+    int num_guest_types = 2, i;
 
     if ((caps = virCapabilitiesNew(TEST_MODEL, 0, 0)) == NULL)
         goto no_memory;
@@ -998,29 +1000,33 @@ static char *testGetCapabilities (virConnectPtr conn)
     if (virCapabilitiesAddHostNUMACell(caps, 1, 8, cell2) < 0)
         goto no_memory;
 
-    if ((guest = virCapabilitiesAddGuest(caps,
-                                         "linux",
-                                         TEST_MODEL,
-                                         TEST_MODEL_WORDSIZE,
-                                         NULL,
-                                         NULL,
-                                         0,
-                                         NULL)) == NULL)
-        goto no_memory;
-
-    if (virCapabilitiesAddGuestDomain(guest,
-                                      "test",
-                                      NULL,
-                                      NULL,
-                                      0,
-                                      NULL) == NULL)
-        goto no_memory;
-
-
-    if (virCapabilitiesAddGuestFeature(guest, "pae", 1, 1) == NULL)
-        goto no_memory;
-    if (virCapabilitiesAddGuestFeature(guest ,"nonpae", 1, 1) == NULL)
-        goto no_memory;
+    for (i = 0; i < num_guest_types; ++i) {
+
+        if ((guest = virCapabilitiesAddGuest(caps,
+                                             guest_types[i],
+                                             TEST_MODEL,
+                                             TEST_MODEL_WORDSIZE,
+                                             NULL,
+                                             NULL,
+                                             0,
+                                             NULL)) == NULL)
+            goto no_memory;
+
+        if (virCapabilitiesAddGuestDomain(guest,
+                                          "test",
+                                          NULL,
+                                          NULL,
+                                          0,
+                                          NULL) == NULL)
+            goto no_memory;
+
+        if (strcmp(guest_types[i], "xen")) {
+            if (virCapabilitiesAddGuestFeature(guest, "pae", 1, 1) == NULL)
+                goto no_memory;
+            if (virCapabilitiesAddGuestFeature(guest ,"nonpae", 1, 1) == NULL)
+                goto no_memory;
+        }
+    }
 
     if ((xml = virCapabilitiesFormatXML(caps)) == NULL)
         goto no_memory;

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