merge changes from trunk in
authorMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 22 Feb 2010 18:53:46 +0000 (18:53 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 22 Feb 2010 18:53:46 +0000 (18:53 +0000)
PLC/Methods/AddSliceTag.py

index bca219d..b9f51bd 100644 (file)
@@ -105,7 +105,7 @@ class AddSliceTag(Method):
             system_slice_tags = SliceTags(self.api, {'tagname': 'system', 'value': '1'}).dict('slice_id')
             system_slice_ids = system_slice_tags.keys()
            if slice['slice_id'] not in system_slice_ids and node_id not in slice['node_ids']:
-                raise PLCInvalidArgument, "Node not in the specified slice %s not in %s"%(slice['slice_id'],system_slice_ids)
+                raise PLCInvalidArgument, "AddSliceTag: slice %s not on specified node %s nor is it a system slice (%r)"%(slice['name'],node['hostname'],system_slice_ids)
             slice_tag['node_id'] = node['node_id']
 
        # Sliver attribute shared accross nodes if nodegroup is sepcified
@@ -125,6 +125,12 @@ class AddSliceTag(Method):
                                                             'tagname': tag_type['tagname'], 
                                                             'value': value})
         for slice_tag_check in slice_tags_check:
+            # do not compare between slice tag and sliver tag
+            if 'node_id' not in slice_tag and slice_tag_check['node_id'] is not None:
+                continue
+            # do not compare between sliver tag and slice tag
+            if 'node_id' in slice_tag and slice_tag['node_id'] is not None and slice_tag_check['node_id'] is None:
+                continue
             if 'node_id' in slice_tag and slice_tag['node_id'] == slice_tag_check['node_id']:
                raise PLCInvalidArgument, "Sliver attribute already exists"
            if 'nodegroup_id' in slice_tag and slice_tag['nodegroup_id'] == slice_tag_check['nodegroup_id']: