Example #1
0
def get_oar_job_vm5k_resources(jobs):
    """Retrieve the hosts list and (ip, mac) list from a list of oar_job and
    return the resources dict needed by vm5k_deployment """
    resources = {}
    for oar_job_id, site in jobs:
        logger.detail('Retrieving resources from %s:%s', style.emph(site),
                      oar_job_id)
        oar_job_id = int(oar_job_id)
        wait_oar_job_start(oar_job_id, site)
        logger.debug('Retrieving hosts')
        hosts = [host.address for host in get_oar_job_nodes(oar_job_id, site)]
        logger.debug('Retrieving subnet')
        ip_mac, _ = get_oar_job_subnets(oar_job_id, site)
        kavlan = None
        if len(ip_mac) == 0:
            logger.debug('Retrieving kavlan')
            kavlan = get_oar_job_kavlan(oar_job_id, site)
            if kavlan:
                assert (len(kavlan) == 1)
                kavlan = kavlan[0]
                ip_mac = get_kavlan_ip_mac(kavlan, site)
        resources[site] = {
            'hosts': hosts,
            'ip_mac': ip_mac[300:],
            'kavlan': kavlan
        }
    return resources
Example #2
0
def get_oar_job_vm5k_resources(jobs):
    """Retrieve the hosts list and (ip, mac) list from a list of oar_job and
    return the resources dict needed by vm5k_deployment """
    resources = {}
    for oar_job_id, site in jobs:
        logger.detail('Retrieving resources from %s:%s',
                      style.emph(site), oar_job_id)
        oar_job_id = int(oar_job_id)
        wait_oar_job_start(oar_job_id, site)
        logger.debug('Retrieving hosts')
        hosts = [host.address for host in get_oar_job_nodes(oar_job_id, site)]
        logger.debug('Retrieving subnet')
        ip_mac, _ = get_oar_job_subnets(oar_job_id, site)
        kavlan = None
        if len(ip_mac) == 0:
            logger.debug('Retrieving kavlan')
            kavlan = get_oar_job_kavlan(oar_job_id, site)
            if kavlan:
                assert(len(kavlan) == 1)
                kavlan = kavlan[0]
                ip_mac = get_kavlan_ip_mac(kavlan, site)
        resources[site] = {'hosts': hosts,
                           'ip_mac': ip_mac[300:],
                           'kavlan': kavlan}
    return resources
Example #3
0
    def get_resources(self):
        """Retrieve the hosts address list and (ip, mac) list from a list of oar_result and
        return the resources which is a dict needed by g5k_provisioner
        """
        logger.info("Getting resources specs")
        self.resources = dict()
        self.hosts = list()

        for oar_job_id, site in self.oar_result:
            logger.info('Waiting for the reserved nodes on %s to be up' % site)
            if not wait_oar_job_start(oar_job_id, site):
                logger.error('The reserved resources cannot be used.\nThe program is terminated.')
                exit()

        for oar_job_id, site in self.oar_result:
            logger.info('Retrieving resource information on %s' % site)
            logger.debug('Retrieving hosts')
            hosts = [host.address for host in get_oar_job_nodes(oar_job_id, site)]

            # if len(hosts) != self.clusters[site]:

            logger.debug('Retrieving subnet')
            ip_mac, _ = get_oar_job_subnets(oar_job_id, site)
            kavlan = None
            if len(ip_mac) == 0:
                logger.debug('Retrieving kavlan')
                kavlan = get_oar_job_kavlan(oar_job_id, site)
                if kavlan:
                    ip_mac = self.get_kavlan_ip_mac(kavlan, site)
            self.resources[site] = {'hosts': hosts,
                                    'ip_mac': ip_mac,
                                    'kavlan': kavlan}

        for site, resource in self.resources.items():
            self.hosts += resource['hosts']
Example #4
0
def grid_reload_from_id(gridjob):
    logger.info("Reloading the resources from oargrid job %s", gridjob)
    gridjob = int(gridjob)
    nodes = ex5.get_oargrid_job_nodes(gridjob)

    job_sites = ex5.get_oargrid_job_oar_jobs(gridjob)
    vlans = []
    subnets = []
    for (job_id, site) in job_sites:
        vlan_ids = ex5.get_oar_job_kavlan(job_id, site)
        vlans.extend([{
            "site": site,
            "vlan_id": vlan_id
        } for vlan_id in vlan_ids])
        # NOTE(msimonin): this currently returned only one subnet
        # even if several are reserved
        # We'll need to patch execo the same way it has been patched for vlans
        ipmac, info = ex5.get_oar_job_subnets(job_id, site)
        if not ipmac:
            logger.debug("No subnet information found for this job")
            continue
        subnet = {
            "site": site,
            "ipmac": ipmac,
        }
        subnet.update(info)
        # Mandatory key when it comes to concretize resources
        subnet.update({"network": info["ip_prefix"]})
        subnets.append(subnet)
    return nodes, vlans, subnets
Example #5
0
def get_network_info_from_job_id(job_id, site, vlans, subnets):
    vlan_ids = ex5.get_oar_job_kavlan(job_id, site)
    vlans.extend([{"site": site, "vlan_id": vlan_id} for vlan_id in vlan_ids])
    # NOTE(msimonin): this currently returned only one subnet
    # even if several are reserved
    # We'll need to patch execo the same way it has been patched for vlans
    ipmac, info = ex5.get_oar_job_subnets(job_id, site)
    if not ipmac:
        logger.debug("No subnet information found for this job")
        return vlans, subnets
    subnet = {
        "site": site,
        "ipmac": ipmac,
    }
    subnet.update(info)
    # Mandatory key when it comes to concretize resources
    subnet.update({"network": info["ip_prefix"]})
    subnets.append(subnet)
    return vlans, subnets
Example #6
0
 def prepare_subnet(self):
     # subnet_params is a dict: http://execo.gforge.inria.fr/doc/latest-stable/execo_g5k.html#get-oar-job-subnets
     (ip_mac_list,
      subnet_params) = g5k.get_oar_job_subnets(*self.subnet_job)
     self.subnet = subnet_params['ip_prefix']
     self.subnet_ip_mac = ip_mac_list