direct-io.hg

changeset 10989:009e250505e9

Added a couple of unit tests for the sxp parsing.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Aug 09 10:13:36 2006 +0100 (2006-08-09)
parents 688012fc0e79
children 724af97aea47
files tools/python/xen/xend/tests/test_sxp.py tools/python/xen/xend/tests/xend-config.sxp
line diff
     1.1 --- a/tools/python/xen/xend/tests/test_sxp.py	Wed Aug 09 10:13:34 2006 +0100
     1.2 +++ b/tools/python/xen/xend/tests/test_sxp.py	Wed Aug 09 10:13:36 2006 +0100
     1.3 @@ -14,5 +14,26 @@ class test_sxp(unittest.TestCase):
     1.4          t('(String) (Thing)', [['String'], ['Thing']])
     1.5  
     1.6  
     1.7 +    def testParseFixed(self):
     1.8 +        fin = file('../xen/xend/tests/xend-config.sxp', 'rb')
     1.9 +        try:
    1.10 +            config = xen.xend.sxp.parse(fin)
    1.11 +            self.assertEqual(
    1.12 +                xen.xend.sxp.child_value(
    1.13 +                config,
    1.14 +                'xend-relocation-hosts-allow'),
    1.15 +                '^localhost$ ^localhost\\.localdomain$')
    1.16 +        finally:
    1.17 +            fin.close()
    1.18 +
    1.19 +
    1.20 +    def testParseConfigExample(self):
    1.21 +        fin = file('../../examples/xend-config.sxp', 'rb')
    1.22 +        try:
    1.23 +            config = xen.xend.sxp.parse(fin)
    1.24 +        finally:
    1.25 +            fin.close()
    1.26 +
    1.27 +
    1.28  def test_suite():
    1.29      return unittest.makeSuite(test_sxp)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/python/xen/xend/tests/xend-config.sxp	Wed Aug 09 10:13:36 2006 +0100
     2.3 @@ -0,0 +1,132 @@
     2.4 +# -*- sh -*-
     2.5 +
     2.6 +#
     2.7 +# Xend configuration file.
     2.8 +#
     2.9 +
    2.10 +# This example configuration is appropriate for an installation that 
    2.11 +# utilizes a bridged network configuration. Access to xend via http
    2.12 +# is disabled.  
    2.13 +
    2.14 +# Commented out entries show the default for that entry, unless otherwise
    2.15 +# specified.
    2.16 +
    2.17 +#(logfile /var/log/xend.log)
    2.18 +#(loglevel DEBUG)
    2.19 +
    2.20 +#(xend-http-server no)
    2.21 +#(xend-unix-server no)
    2.22 +#(xend-tcp-xmlrpc-server no)
    2.23 +#(xend-unix-xmlrpc-server yes)
    2.24 +#(xend-relocation-server no)
    2.25 +(xend-relocation-server yes)
    2.26 +
    2.27 +#(xend-unix-path /var/lib/xend/xend-socket)
    2.28 +
    2.29 +# Port xend should use for the HTTP interface, if xend-http-server is set.
    2.30 +#(xend-port            8000)
    2.31 +
    2.32 +# Port xend should use for the relocation interface, if xend-relocation-server
    2.33 +# is set.
    2.34 +#(xend-relocation-port 8002)
    2.35 +
    2.36 +# Address xend should listen on for HTTP connections, if xend-http-server is
    2.37 +# set.
    2.38 +# Specifying 'localhost' prevents remote connections.
    2.39 +# Specifying the empty string '' (the default) allows all connections.
    2.40 +#(xend-address '')
    2.41 +#(xend-address localhost)
    2.42 +
    2.43 +# Address xend should listen on for relocation-socket connections, if
    2.44 +# xend-relocation-server is set.
    2.45 +# Meaning and default as for xend-address above.
    2.46 +#(xend-relocation-address '')
    2.47 +
    2.48 +# The hosts allowed to talk to the relocation port.  If this is empty (the
    2.49 +# default), then all connections are allowed (assuming that the connection
    2.50 +# arrives on a port and interface on which we are listening; see
    2.51 +# xend-relocation-port and xend-relocation-address above).  Otherwise, this
    2.52 +# should be a space-separated sequence of regular expressions.  Any host with
    2.53 +# a fully-qualified domain name or an IP address that matches one of these
    2.54 +# regular expressions will be accepted.
    2.55 +#
    2.56 +# For example:
    2.57 +#  (xend-relocation-hosts-allow '^localhost$ ^.*\\.example\\.org$')
    2.58 +#
    2.59 +#(xend-relocation-hosts-allow '')
    2.60 +(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')
    2.61 +
    2.62 +# The limit (in kilobytes) on the size of the console buffer
    2.63 +#(console-limit 1024)
    2.64 +
    2.65 +##
    2.66 +# To bridge network traffic, like this:
    2.67 +#
    2.68 +# dom0: fake eth0 -> vif0.0 -+
    2.69 +#                            |
    2.70 +#                          bridge -> real eth0 -> the network
    2.71 +#                            |
    2.72 +# domU: fake eth0 -> vifN.0 -+
    2.73 +#
    2.74 +# use
    2.75 +#
    2.76 +# (network-script network-bridge)
    2.77 +#
    2.78 +# Your default ethernet device is used as the outgoing interface, by default. 
    2.79 +# To use a different one (e.g. eth1) use
    2.80 +#
    2.81 +# (network-script 'network-bridge netdev=eth1')
    2.82 +#
    2.83 +# The bridge is named xenbr0, by default.  To rename the bridge, use
    2.84 +#
    2.85 +# (network-script 'network-bridge bridge=<name>')
    2.86 +#
    2.87 +# It is possible to use the network-bridge script in more complicated
    2.88 +# scenarios, such as having two outgoing interfaces, with two bridges, and
    2.89 +# two fake interfaces per guest domain.  To do things like this, write
    2.90 +# yourself a wrapper script, and call network-bridge from it, as appropriate.
    2.91 +#
    2.92 +(network-script network-bridge)
    2.93 +
    2.94 +# The script used to control virtual interfaces.  This can be overridden on a
    2.95 +# per-vif basis when creating a domain or a configuring a new vif.  The
    2.96 +# vif-bridge script is designed for use with the network-bridge script, or
    2.97 +# similar configurations.
    2.98 +#
    2.99 +# If you have overridden the bridge name using
   2.100 +# (network-script 'network-bridge bridge=<name>') then you may wish to do the
   2.101 +# same here.  The bridge name can also be set when creating a domain or
   2.102 +# configuring a new vif, but a value specified here would act as a default.
   2.103 +#
   2.104 +# If you are using only one bridge, the vif-bridge script will discover that,
   2.105 +# so there is no need to specify it explicitly.
   2.106 +#
   2.107 +(vif-script vif-bridge)
   2.108 +
   2.109 +
   2.110 +## Use the following if network traffic is routed, as an alternative to the
   2.111 +# settings for bridged networking given above.
   2.112 +#(network-script network-route)
   2.113 +#(vif-script     vif-route)
   2.114 +
   2.115 +
   2.116 +## Use the following if network traffic is routed with NAT, as an alternative
   2.117 +# to the settings for bridged networking given above.
   2.118 +#(network-script network-nat)
   2.119 +#(vif-script     vif-nat)
   2.120 +
   2.121 +
   2.122 +# Dom0 will balloon out when needed to free memory for domU.
   2.123 +# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to.
   2.124 +# If dom0-min-mem=0, dom0 will never balloon out.
   2.125 +(dom0-min-mem 196)
   2.126 +
   2.127 +# In SMP system, dom0 will use dom0-cpus # of CPUS
   2.128 +# If dom0-cpus = 0, dom0 will take all cpus available
   2.129 +(dom0-cpus 0)
   2.130 +
   2.131 +# Whether to enable core-dumps when domains crash.
   2.132 +#(enable-dump no)
   2.133 +
   2.134 +# The tool used for initiating virtual TPM migration
   2.135 +#(external-migration-tool '')