ia64/xen-unstable

changeset 12194:63d1b02dad34

Import the xen-unstable changeset
11863:7633398447846679342b197a79bc375b996d9026, with conflict resolution by
Ewan Mellor.

[XM] Allow empty resource strings (e.g., when creating an empty CDROM
device). Also clean up error/acces-denied path.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Oct 23 12:23:57 2006 +0100 (2006-10-23)
parents de99c7f7aba4
children 505cd4708946
files tools/python/xen/util/security.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/util/security.py	Mon Oct 23 09:57:24 2006 +0100
     1.2 +++ b/tools/python/xen/util/security.py	Mon Oct 23 12:23:57 2006 +0100
     1.3 @@ -601,8 +601,15 @@ def unify_resname(resource):
     1.4      """Makes all resource locations absolute. In case of physical
     1.5      resources, '/dev/' is added to local file names"""
     1.6  
     1.7 +    if not resource:
     1.8 +        return resource
     1.9 +
    1.10      # sanity check on resource name
    1.11 -    (type, resfile) = resource.split(":")
    1.12 +    try:
    1.13 +        (type, resfile) = resource.split(":")
    1.14 +    except:
    1.15 +        err("Resource spec '%s' contains no ':' delimiter" % resource)
    1.16 +
    1.17      if type == "phy":
    1.18          if not resfile.startswith("/"):
    1.19              resfile = "/dev/" + resfile
     2.1 --- a/tools/python/xen/xm/create.py	Mon Oct 23 09:57:24 2006 +0100
     2.2 +++ b/tools/python/xen/xm/create.py	Mon Oct 23 12:23:57 2006 +0100
     2.3 @@ -1161,6 +1161,8 @@ def config_security_check(config, verbos
     2.4          except security.ACMError:
     2.5              print "   %s: DENIED" % (resource)
     2.6              (res_label, res_policy) = security.get_res_label(resource)
     2.7 +            if not res_label:
     2.8 +                res_label = ""
     2.9              print "   --> res: %s (%s)" % (str(res_label),
    2.10                                             str(res_policy))
    2.11              print "   --> dom: %s (%s)" % (str(domain_label),
    2.12 @@ -1202,7 +1204,7 @@ def main(argv):
    2.13          PrettyPrint.prettyprint(config)
    2.14      else:
    2.15          if not create_security_check(config):
    2.16 -            raise OptionError('Security Configuration prevents domain from starting')
    2.17 +            raise security.ACMError('Security Configuration prevents domain from starting')
    2.18          else:
    2.19              dom = make_domain(opts, config)
    2.20              if opts.vals.console_autoconnect: