[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XM] Allow empty resource strings (e.g., when creating an empty CDROM



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 7633398447846679342b197a79bc375b996d9026
# Parent  6f72d00fc1ece1473df04b8b53b9cb458d704f9b
[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@xxxxxxxxxxxxx>
---
 tools/python/xen/util/security.py |    9 ++++++++-
 tools/python/xen/xm/create.py     |    4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff -r 6f72d00fc1ec -r 763339844784 tools/python/xen/util/security.py
--- a/tools/python/xen/util/security.py Mon Oct 23 11:46:41 2006 +0100
+++ b/tools/python/xen/util/security.py Mon Oct 23 12:23:57 2006 +0100
@@ -601,8 +601,15 @@ def unify_resname(resource):
     """Makes all resource locations absolute. In case of physical
     resources, '/dev/' is added to local file names"""
 
+    if not resource:
+        return resource
+
     # sanity check on resource name
-    (type, resfile) = resource.split(":")
+    try:
+        (type, resfile) = resource.split(":")
+    except:
+        err("Resource spec '%s' contains no ':' delimiter" % resource)
+
     if type == "phy":
         if not resfile.startswith("/"):
             resfile = "/dev/" + resfile
diff -r 6f72d00fc1ec -r 763339844784 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Mon Oct 23 11:46:41 2006 +0100
+++ b/tools/python/xen/xm/create.py     Mon Oct 23 12:23:57 2006 +0100
@@ -1143,6 +1143,8 @@ def config_security_check(config, verbos
         except security.ACMError:
             print "   %s: DENIED" % (resource)
             (res_label, res_policy) = security.get_res_label(resource)
+            if not res_label:
+                res_label = ""
             print "   --> res:"+res_label+" ("+res_policy+")"
             print "   --> dom:"+domain_label+" ("+domain_policy+")"
             answer = 0
@@ -1181,7 +1183,7 @@ def main(argv):
         PrettyPrint.prettyprint(config)
     else:
         if not create_security_check(config):
-            raise OptionError('Security Configuration prevents domain from 
starting')
+            raise security.ACMError('Security Configuration prevents domain 
from starting')
         else:
             dom = make_domain(opts, config)
             if opts.vals.console_autoconnect:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.