Skip to contentSkip to conversation

XM on XenAPI: Add PVFB support

PATCH New Yosuke Iwamatsu 1 participant 1 message Jun 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XM on XenAPI: Add PVFB support

Hi,

This patch adds pv virtual framebuffer support
in xenapi_create.py.

Regards,
-----------------------
Yosuke Iwamatsu
NEC Corporation

xm on xenapi: Add PVFB support in xenapi_create.py.

tools/python/xen/xm/xenapi_create.py +47 -0
diff -r 7a0f1bf86516 tools/python/xen/xm/xenapi_create.py
@@ -518,6 +518,9 @@ class sxp2xml:
         vtpms_sxp = map(lambda x: x[1], [device for device in devices
                                          if device[1][0] == "vtpm"])
 
+        vfbs_sxp = map(lambda x: x[1], [device for device in devices
+                                        if device[1][0] == "vfb"])
+
         # Create XML Document
         
         impl = getDOMImplementation()
@@ -656,6 +659,10 @@ class sxp2xml:
         consoles = self.extract_consoles(image, document)
 
         map(vm.appendChild, consoles)
+
+        vfbs = map(lambda vfb: self.extract_vfb(vfb, document), vfbs_sxp)
+
+        map(vm.appendChild, vfbs)
 
         # Platform variables...
 
@@ -773,6 +780,46 @@ class sxp2xml:
              = get_child_by_name(vtpm_sxp, "backend", "0")
 
         return vtpm
+
+    def extract_vfb(self, vfb_sxp, document):
+
+        vfb = document.createElement("console")
+        vfb.attributes["protocol"] = "rfb"
+
+        if get_child_by_name(vfb_sxp, "type", "") == "vnc":
+            vfb.appendChild(self.mk_other_config(
+                "type", "vnc",
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "vncunused", get_child_by_name(vfb_sxp, "vncunused", "1"),
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "vnclisten",
+                get_child_by_name(vfb_sxp, "vnclisten", "127.0.0.1"),
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "vncdisplay", get_child_by_name(vfb_sxp, "vncdisplay", "0"),
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "vncpasswd", get_child_by_name(vfb_sxp, "vncpasswd", ""),
+                document))
+
+        if get_child_by_name(vfb_sxp, "type", "") == "sdl":
+            vfb.appendChild(self.mk_other_config(
+                "type", "sdl",
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "display", get_child_by_name(vfb_sxp, "display", ""),
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "xauthority",
+                get_child_by_name(vfb_sxp, "xauthority", ""),
+                document))
+            vfb.appendChild(self.mk_other_config(
+                "opengl", get_child_by_name(vfb_sxp, "opengl", "1"),
+                document))
+
+        return vfb
 
     _eths = -1
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel