Changeset cebcdce
- Timestamp:
- Dec 1, 2011 5:10:32 PM (13 years ago)
- Branches:
- compt_changes, info-ops, master
- Children:
- 7f57435
- Parents:
- 32b4536
- Location:
- fedd/federation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
r32b4536 rcebcdce 1032 1032 if a not in attr: attr.append(a) 1033 1033 1034 def merge_os(os, e): 1035 if len(e.os) == 0: 1036 # No OS at all: 1037 if os.get_attribute('emulab_access:image'): 1038 os.set_attribute('emulab_access:initial_image', 1039 os.get_attribute('emulab_access:image')) 1040 e.os = [ os ] 1041 elif len(e.os) == 1: 1042 # There's one OS, copy the initial image and replace 1043 eos = e.os[0] 1044 initial = eos.get_attribute('emulab_access:initial_image') 1045 if initial: 1046 os.set_attribute('emulab_access:initial_image', initial) 1047 e.os = [ os] 1048 else: 1049 # Multiple OSes, replace or append 1050 for eos in e.os: 1051 if os.name == eos.name: 1052 eos.version = os.version 1053 eos.version = os.distribution 1054 eos.version = os.distributionversion 1055 for a in os.attribute: 1056 if eos.get_attribute(a.attribute): 1057 eos.remove_attribute(a.attribute) 1058 eos.set_attribute(a.attribute, a.value) 1059 break 1060 else: 1061 e.os.append(os) 1062 1063 1064 if t is None: return 1034 1065 # Copy the assigned names into the return topology 1035 1066 for e in t.elements: … … 1042 1073 e.status = info.node[e.name].status 1043 1074 os = info.node[e.name].getOS() 1044 if os: e.os = [ os ]1075 if os: merge_os(os, e) 1045 1076 else: 1046 1077 # Simple debugging assignment -
fedd/federation/emulab_segment.py
r32b4536 rcebcdce 33 33 version=self.osversion) 34 34 if self.image and rv: 35 rv.set_attribute(' image', self.image)35 rv.set_attribute('emulab_access:image', self.image) 36 36 return rv 37 37 … … 295 295 raise service_error(service_error.internal, 296 296 "Cannot get node mapping of segment:%s/%s" % (pid, eid)) 297 def get_i mage(self, node, top):297 def get_initial_image(self, node, top): 298 298 for e in top.elements: 299 299 if isinstance(e, topdl.Computer): 300 300 if node == e.name: 301 if e.os: 302 return e.os[0].get_attribute('image') 301 if e.os and len(e.os) == 1: 302 return e.os[0].get_attribute( 303 'emulab_access:initial_image') 303 304 return None 304 305 … … 326 327 return False 327 328 elif state == 'initial': 328 image = self.get_i mage(lnode, top)329 image = self.get_initial_image(lnode, top) 329 330 if image: 330 331 pid, iid = image.split('/') -
fedd/federation/local_emulab_segment.py
r32b4536 rcebcdce 141 141 def __call__(self, parent, op, targets, param, top): 142 142 for l, p in targets.items(): 143 self.log.info("[operation_segment]: Calling op on %s(%s)" % (l,p)) 143 self.log.info("[operation_segment]: Calling op %s on %s(%s)" % \ 144 (op, l,p)) 144 145 self.do_operation(op, l, p, param, top) 145 146 return True
Note: See TracChangeset
for help on using the changeset viewer.