Changeset ec36918
- Timestamp:
- Nov 10, 2010 2:58:07 PM (14 years ago)
- Branches:
- version-3.01, version-3.02
- Children:
- b6ca289
- Parents:
- d23d7bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/protogeni_access.py
rd23d7bd rec36918 344 344 self.d[self.current_key] = { 345 345 'hostname': attrs.get('hostname', None), 346 'interfaces': { } 346 'interfaces': { }, 347 'mac': { } 347 348 } 348 349 elif name == 'interface' and self.current_key: … … 350 351 [attrs.get('virtual_id','')] = \ 351 352 attrs.get('component_id', None) 353 elif name == 'interface_ref': 354 # Collect mac address information from an interface_ref. 355 # These appear after the node info has been parsed. 356 nid = attrs.get('virtual_node_id', None) 357 ifid = attrs.get('virtual_interface_id', None) 358 mac = attrs.get('MAC', None) 359 self.d[nid]['mac'][ifid] = mac 352 360 # When a node is finished, clear current_key 353 361 def end_element(self, name): … … 652 660 653 661 ifconfig = "/sbin/ifconfig" 662 findif = '/usr/local/etc/emulab/findif' 654 663 stage_file = stage_file_type(user, self.staging_host, stagingdir) 655 664 pname = node.get('hostname', None) … … 666 675 if not i.get_attribute('portal')]: 667 676 pinf = node['interfaces'].get(i.name, None) 677 pmac = node['mac'].get(i.name, None) 668 678 addr = i.get_attribute('ip4_address') 669 679 netmask = i.get_attribute('ip4_netmask') or '255.255.255.0' 670 if pinf and addr: 680 # The interface names in manifests are not to be trusted, so we 681 # find the interface to configure using the local node's script 682 # to match mac address to interface name. 683 if pinf and addr and pmac: 684 print >>script, '# %s' % pinf 671 685 print >>script, \ 672 "%s %s%s netmask %s" % \673 (ifconfig, pinf, addr, netmask)686 "%s `%s %s` %s netmask %s" % \ 687 (ifconfig, findif, pmac, addr, netmask) 674 688 else: 675 689 self.log.error("Missing interface or address for %s" \ … … 930 944 "ProtoGENI: %s %s" % (e.code, e)) 931 945 932 return (slice_urn, slice_cred, manifest )946 return (slice_urn, slice_cred, manifest, rspec) 933 947 934 948 def wait_for_slice(self, segment_commands, slice_cred, slice_urn, ctxt, … … 997 1011 certfile, certpw) 998 1012 999 if not ctxt: return False 1013 if not ctxt: return False, {} 1000 1014 1001 1015 self.set_up_staging_filespace(segment_commands, user, host, stagingdir) 1002 1016 slicename = self.get_free_slicename(segment_commands, user, gcred, ctxt) 1003 1017 self.log.info("Creating %s" % slicename) 1004 slice_urn, slice_cred, manifest = self.allocate_slice(1018 slice_urn, slice_cred, manifest, rpsec = self.allocate_slice( 1005 1019 segment_commands, slicename, rspec, gcred, ctxt) 1006 1020 … … 1023 1037 user, host, "%s/%s" % (stagingdir, f)): 1024 1038 self.log.error("Scp failed") 1025 return False 1039 return False, {} 1026 1040 1027 1041 … … 1032 1046 self.log.error('Sliver failed to start on ProtoGENI') 1033 1047 self.delete_slice(segment_commands, slice_cred, slice_urn, ctxt) 1034 return False 1048 return False, {} 1035 1049 elif status == 'timeout': 1036 1050 self.log.error('Sliver failed to start on ProtoGENI (timeout)') 1037 1051 self.delete_slice(segment_commands, slice_cred, slice_urn, ctxt) 1038 return False 1052 return False, {} 1039 1053 else: 1040 1054 # All good: save ProtoGENI info in shared state … … 1044 1058 self.allocation[aid]['slice_credential'] = slice_cred 1045 1059 self.allocation[aid]['manifest'] = manifest 1060 self.allocation[aid]['rspec'] = rspec 1046 1061 self.allocation[aid]['certfile'] = certfile 1047 1062 self.allocation[aid]['certpw'] = certpw … … 1396 1411 param = { 1397 1412 'credential': cred, 1398 'hrn': name, 1399 'type': 'Slice', 1400 } 1401 slice = segment_commands.slice_authority_call('Resolve', 1402 param, ctxt) 1403 uuid = slice.get('uuid', None) 1404 if uuid == None: 1405 sys.exit('No uuid for %s' % slicename) 1406 1407 print 'Calling GetCredential (uuid)' 1408 param = { 1409 'credential': cred, 1410 'uuid': uuid, 1413 'urn': slice_urn, 1411 1414 'type': 'Slice', 1412 1415 } … … 1418 1421 return None 1419 1422 try: 1420 print 'Calling RenewSlice (CM)'1421 1423 param = { 1422 1424 'credentials': [new_scred,],
Note: See TracChangeset
for help on using the changeset viewer.