From: Keir Fraser Date: Thu, 3 Apr 2008 10:33:10 +0000 (+0100) Subject: xend, acm: Assign an unlabeled resource the __UNLABELED__ label X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14231^2~82 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4586f27b6c68500feb702015793a240ea92120d7;p=xen.git xend, acm: Assign an unlabeled resource the __UNLABELED__ label Assign an unlabeled resource the __UNLABELED__ label rather than failing the lookup in the dictionary and catching the exception. Signed-off-by: Stefan Berger --- diff --git a/tools/python/xen/util/xsm/acm/acm.py b/tools/python/xen/util/xsm/acm/acm.py index ed93e28485..8a5c270ad0 100644 --- a/tools/python/xen/util/xsm/acm/acm.py +++ b/tools/python/xen/util/xsm/acm/acm.py @@ -1146,11 +1146,13 @@ def __resources_compatible_with_vmlabel(xspol, dominfo, 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: