From: Stefan Berger Subject: [PATCH] [XEND] [ACM] Assign an unlabeled resource the __UNLABELED__ label Date: Wed, 02 Apr 2008 20:59:34 -0400 Message-ID: <1207184374.8634.9.camel@gsal-3.watson.ibm.com> Reply-To: stefanb@us.ibm.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-dy+iPvA7YmZ+mW7HmPCz" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-dy+iPvA7YmZ+mW7HmPCz Content-Type: text/plain Content-Transfer-Encoding: 7bit Assign an unlabeled resource the __UNLABELED__ label rather than failing the lookup in the dictionary and catching the exception. Signed-off-by: Stefan Berger --=-dy+iPvA7YmZ+mW7HmPCz Content-Disposition: attachment; filename=assign_label_to_unlabeled_resource.diff Content-Type: text/x-patch; name=assign_label_to_unlabeled_resource.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +++ root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py @@ -1159,11 +1160,13 @@ def __resources_compatible_with_vmlabel( for key, value in resources.items(): if key in [ 'vbd', 'tap' ]: for res in resources[key]: - try: + if not res in access_control: + label = [xsconstants.ACM_POLICY_ID, + xspol.get_name(), + ACM_LABEL_UNLABELED] + else: label = access_control[res] - if not collect_labels(reslabels, label, polname): - return False - except: + if not collect_labels(reslabels, label, polname): return False elif key in [ 'vif' ]: for xapi_label in value: --=-dy+iPvA7YmZ+mW7HmPCz Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-dy+iPvA7YmZ+mW7HmPCz--