[Libvirt-cim] [PATCH] Add a default graphics device to all domains so that we create the

Dan Smith danms at us.ibm.com
Wed Jun 11 15:33:50 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1213198304 25200
# Node ID cb1993563ebbca5bb4f7392f42d33019af7668bc
# Parent  ad4804559dd83bd2afd10fa0768b087f6a9914a9
Add a default graphics device to all domains so that we create the
<graphics ...> tag in the resulting XML.  Later, this will be replaced
by a proper conversion of a console RASD, like the rest of the devices.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r ad4804559dd8 -r cb1993563ebb src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Tue Jun 10 12:02:09 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Wed Jun 11 08:31:44 2008 -0700
@@ -192,6 +192,22 @@
         return 1;
 }
 
+static bool default_graphics_device(CMPIInstance *inst,
+                                    struct domain *domain)
+{
+        free(domain->dev_graphics);
+        domain->dev_graphics = calloc(1, sizeof(*domain->dev_graphics));
+        if (domain->dev_graphics == NULL) {
+                CU_DEBUG("Failed to allocate default graphics device");
+                return false;
+        }
+
+        domain->dev_graphics->dev.graphics.type = strdup("vnc");
+        domain->dev_graphics->dev.graphics.port = strdup("-1");
+
+        return true;
+}
+
 static int vssd_to_domain(CMPIInstance *inst,
                           struct domain *domain)
 {
@@ -240,6 +256,10 @@
         else {
                 CU_DEBUG("Unknown domain prefix: %s", pfx);
         }
+
+        if (!default_graphics_device(inst, domain))
+                ret = 0;
+
  out:
         free(pfx);
 




More information about the Libvirt-cim mailing list