ia64/xen-unstable

changeset 16218:f0c98631b2e5

xm-test: various fixes
- recently I added an other_config field to the VTPM record which now
needs to be accounted for otherwise the test determines a bad key
- the dry-run command was throwing a different type of exception
(ACMError) than what was caught (XSMError)
- the tests based on the raw Xen-API need to build the PV_args
parameters from the old 'root' and 'extra' parameters.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir@xensource.com>
date Thu Oct 25 09:22:28 2007 +0100 (2007-10-25)
parents 2b11cb52f6a0
children a2222599b97b
files tools/python/xen/xm/create.py tools/xm-test/lib/XmTestLib/XenAPIDomain.py tools/xm-test/tests/security-acm/08_security-acm_xapi.py tools/xm-test/tests/vtpm/09_vtpm-xapi.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Wed Oct 24 17:21:17 2007 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Thu Oct 25 09:22:28 2007 +0100
     1.3 @@ -1228,7 +1228,7 @@ def config_security_check(config, verbos
     1.4              if verbose:
     1.5                  print "   %s: PERMITTED" % (resource)
     1.6  
     1.7 -        except security.XSMError:
     1.8 +        except security.ACMError:
     1.9              print "   %s: DENIED" % (resource)
    1.10              (poltype, res_label, res_policy) = security.get_res_label(resource)
    1.11              if not res_label:
     2.1 --- a/tools/xm-test/lib/XmTestLib/XenAPIDomain.py	Wed Oct 24 17:21:17 2007 +0100
     2.2 +++ b/tools/xm-test/lib/XmTestLib/XenAPIDomain.py	Thu Oct 25 09:22:28 2007 +0100
     2.3 @@ -38,7 +38,8 @@ class XenAPIConfig:
     2.4                                          'memory_dynamic_max' ],
     2.5                             'kernel' : 'PV_kernel',
     2.6                             'ramdisk': 'PV_ramdisk',
     2.7 -                           'root'   : 'PV_args'}
     2.8 +                           'root'   : 'PV_args',
     2.9 +                           'extra'  : 'PV_args' }
    2.10          if isACMEnabled():
    2.11              #A default so every VM can start with ACM enabled
    2.12              self.opts["security_label"] = "ACM:xm-test:red"
    2.13 @@ -47,6 +48,8 @@ class XenAPIConfig:
    2.14          """Set an option in the config"""
    2.15          if name == "memory":
    2.16              value <<= 20
    2.17 +        if name == "root":
    2.18 +            value = "root=" + value
    2.19          if name in self.opttrlate.keys():
    2.20              _name = self.opttrlate[name]
    2.21          else:
    2.22 @@ -56,7 +59,11 @@ class XenAPIConfig:
    2.23              for _n in _name:
    2.24                  self.opts[_n] = value
    2.25          else:
    2.26 -            self.opts[_name] = value
    2.27 +            if not self.opts.get(_name) or \
    2.28 +               not _name in [ "PV_args" ]:
    2.29 +                self.opts[_name] = value
    2.30 +            else:
    2.31 +                self.opts[_name] += " " + value
    2.32  
    2.33      def getOpt(self, name):
    2.34          """Return the value of a config option"""
     3.1 --- a/tools/xm-test/tests/security-acm/08_security-acm_xapi.py	Wed Oct 24 17:21:17 2007 +0100
     3.2 +++ b/tools/xm-test/tests/security-acm/08_security-acm_xapi.py	Thu Oct 25 09:22:28 2007 +0100
     3.3 @@ -19,6 +19,9 @@ vm_label_green  = xsconstants.ACM_POLICY
     3.4  vdi_label_red   = xsconstants.ACM_POLICY_ID + ":xm-test:red"
     3.5  vdi_label_green = xsconstants.ACM_POLICY_ID + ":xm-test:green"
     3.6  
     3.7 +vm_label_unlabeled = xsconstants.ACM_POLICY_ID + ":xm-test:" + \
     3.8 +                     acmpolicy.ACM_LABEL_UNLABELED
     3.9 +
    3.10  vdi_file = "/dev/ram0"
    3.11  vdi_path = "phy:" + vdi_file
    3.12  
    3.13 @@ -105,7 +108,7 @@ if int(res) != 0:
    3.14      FAIL("Should be able to unlabel the domain while it's halted.")
    3.15  
    3.16  res = session.xenapi.VM.get_security_label(vm_uuid)
    3.17 -if res != "":
    3.18 +if res != vm_label_unlabeled:
    3.19      FAIL("Unexpected VM security label after removal: %s" % res)
    3.20  
    3.21  res = session.xenapi.VM.set_security_label(vm_uuid, vm_label_red, res)
     4.1 --- a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py	Wed Oct 24 17:21:17 2007 +0100
     4.2 +++ b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py	Thu Oct 25 09:22:28 2007 +0100
     4.3 @@ -17,7 +17,7 @@ from vtpm_utils import *
     4.4  import commands
     4.5  import os
     4.6  
     4.7 -VTPM_RECORD_KEYS = [ 'backend', 'VM', 'uuid' ]
     4.8 +VTPM_RECORD_KEYS = [ 'backend', 'VM', 'uuid', 'other_config' ]
     4.9  
    4.10  try:
    4.11      # XmTestAPIDomain tries to establish a connection to XenD