Skip to contentSkip to conversation

Assign an unlabeled resource the __UNLABELED__ label

PATCH New Stefan Berger 1 participant 1 message Apr 3, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +6 -4
Index: 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:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel