Changeset ec36918


Ignore:
Timestamp:
Nov 10, 2010 2:58:07 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
version-3.01, version-3.02
Children:
b6ca289
Parents:
d23d7bd
Message:

Changes to deal with ProtoGENI's changes and occasional flakiness in mapping interface names. We use MAC addres to differentiate interfaces rather than name.

We aslo record the rspec used to request resources as well as the manifest to improve debugging.

Some changes were also made to simplify slice renewal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/protogeni_access.py

    rd23d7bd rec36918  
    344344                        self.d[self.current_key] = {
    345345                                'hostname': attrs.get('hostname', None),
    346                                 'interfaces': { }
     346                                'interfaces': { },
     347                                'mac': { }
    347348                                }
    348349                elif name == 'interface' and self.current_key:
     
    350351                            [attrs.get('virtual_id','')] = \
    351352                            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
    352360            #  When a node is finished, clear current_key
    353361            def end_element(self, name):
     
    652660
    653661        ifconfig = "/sbin/ifconfig"
     662        findif = '/usr/local/etc/emulab/findif'
    654663        stage_file = stage_file_type(user, self.staging_host, stagingdir)
    655664        pname = node.get('hostname', None)
     
    666675                    if not i.get_attribute('portal')]:
    667676                pinf = node['interfaces'].get(i.name, None)
     677                pmac = node['mac'].get(i.name, None)
    668678                addr = i.get_attribute('ip4_address')
    669679                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
    671685                    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)
    674688                else:
    675689                    self.log.error("Missing interface or address for %s" \
     
    930944                    "ProtoGENI: %s %s" % (e.code, e))
    931945
    932         return (slice_urn, slice_cred, manifest)
     946        return (slice_urn, slice_cred, manifest, rspec)
    933947
    934948    def wait_for_slice(self, segment_commands, slice_cred, slice_urn, ctxt,
     
    9971011                certfile, certpw)
    9981012
    999         if not ctxt: return False
     1013        if not ctxt: return False, {}
    10001014
    10011015        self.set_up_staging_filespace(segment_commands, user, host, stagingdir)
    10021016        slicename = self.get_free_slicename(segment_commands, user, gcred, ctxt)
    10031017        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(
    10051019                segment_commands, slicename, rspec, gcred, ctxt)
    10061020
     
    10231037                                user, host, "%s/%s" % (stagingdir, f)):
    10241038                            self.log.error("Scp failed")
    1025                             return False
     1039                            return False, {}
    10261040
    10271041
     
    10321046            self.log.error('Sliver failed to start on ProtoGENI')
    10331047            self.delete_slice(segment_commands, slice_cred, slice_urn, ctxt)
    1034             return False
     1048            return False, {}
    10351049        elif status == 'timeout':
    10361050            self.log.error('Sliver failed to start on ProtoGENI (timeout)')
    10371051            self.delete_slice(segment_commands, slice_cred, slice_urn, ctxt)
    1038             return False
     1052            return False, {}
    10391053        else:
    10401054            # All good: save ProtoGENI info in shared state
     
    10441058            self.allocation[aid]['slice_credential'] = slice_cred
    10451059            self.allocation[aid]['manifest'] = manifest
     1060            self.allocation[aid]['rspec'] = rspec
    10461061            self.allocation[aid]['certfile'] = certfile
    10471062            self.allocation[aid]['certpw'] = certpw
     
    13961411            param = {
    13971412                    '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,
    14111414                    'type': 'Slice',
    14121415                    }
     
    14181421            return None
    14191422        try:
    1420             print 'Calling RenewSlice (CM)'
    14211423            param = {
    14221424                    'credentials': [new_scred,],
Note: See TracChangeset for help on using the changeset viewer.