ia64/xen-unstable

changeset 17823:d77214a97e04

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

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 10 13:50:31 2008 +0100 (2008-06-10)
parents 189597fbb882
children f70dff36213b
files tools/python/xen/xm/xenapi_create.py
line diff
     1.1 --- a/tools/python/xen/xm/xenapi_create.py	Tue Jun 10 13:49:54 2008 +0100
     1.2 +++ b/tools/python/xen/xm/xenapi_create.py	Tue Jun 10 13:50:31 2008 +0100
     1.3 @@ -518,6 +518,9 @@ class sxp2xml:
     1.4          vtpms_sxp = map(lambda x: x[1], [device for device in devices
     1.5                                           if device[1][0] == "vtpm"])
     1.6  
     1.7 +        vfbs_sxp = map(lambda x: x[1], [device for device in devices
     1.8 +                                        if device[1][0] == "vfb"])
     1.9 +
    1.10          # Create XML Document
    1.11          
    1.12          impl = getDOMImplementation()
    1.13 @@ -657,6 +660,10 @@ class sxp2xml:
    1.14  
    1.15          map(vm.appendChild, consoles)
    1.16  
    1.17 +        vfbs = map(lambda vfb: self.extract_vfb(vfb, document), vfbs_sxp)
    1.18 +
    1.19 +        map(vm.appendChild, vfbs)
    1.20 +
    1.21          # Platform variables...
    1.22  
    1.23          platform = self.extract_platform(image, document)
    1.24 @@ -774,6 +781,46 @@ class sxp2xml:
    1.25  
    1.26          return vtpm
    1.27  
    1.28 +    def extract_vfb(self, vfb_sxp, document):
    1.29 +
    1.30 +        vfb = document.createElement("console")
    1.31 +        vfb.attributes["protocol"] = "rfb"
    1.32 +
    1.33 +        if get_child_by_name(vfb_sxp, "type", "") == "vnc":
    1.34 +            vfb.appendChild(self.mk_other_config(
    1.35 +                "type", "vnc",
    1.36 +                document))
    1.37 +            vfb.appendChild(self.mk_other_config(
    1.38 +                "vncunused", get_child_by_name(vfb_sxp, "vncunused", "1"),
    1.39 +                document))
    1.40 +            vfb.appendChild(self.mk_other_config(
    1.41 +                "vnclisten",
    1.42 +                get_child_by_name(vfb_sxp, "vnclisten", "127.0.0.1"),
    1.43 +                document))
    1.44 +            vfb.appendChild(self.mk_other_config(
    1.45 +                "vncdisplay", get_child_by_name(vfb_sxp, "vncdisplay", "0"),
    1.46 +                document))
    1.47 +            vfb.appendChild(self.mk_other_config(
    1.48 +                "vncpasswd", get_child_by_name(vfb_sxp, "vncpasswd", ""),
    1.49 +                document))
    1.50 +
    1.51 +        if get_child_by_name(vfb_sxp, "type", "") == "sdl":
    1.52 +            vfb.appendChild(self.mk_other_config(
    1.53 +                "type", "sdl",
    1.54 +                document))
    1.55 +            vfb.appendChild(self.mk_other_config(
    1.56 +                "display", get_child_by_name(vfb_sxp, "display", ""),
    1.57 +                document))
    1.58 +            vfb.appendChild(self.mk_other_config(
    1.59 +                "xauthority",
    1.60 +                get_child_by_name(vfb_sxp, "xauthority", ""),
    1.61 +                document))
    1.62 +            vfb.appendChild(self.mk_other_config(
    1.63 +                "opengl", get_child_by_name(vfb_sxp, "opengl", "1"),
    1.64 +                document))
    1.65 +
    1.66 +        return vfb
    1.67 +
    1.68      _eths = -1
    1.69  
    1.70      def mk_other_config(self, key, value, document):