def destroy_zone_bundle(zone_bundle):
    proc_pool = library.RecursiveMultiprocessingPool(len(zone_bundle['zones']))
    proc_pool_results = [
        proc_pool.apply_async(destroy_zone, (zone, ))
        for zone in zone_bundle['zones']
    ]
    [result.get() for result in proc_pool_results]
Example #2
0
def deploy_zone_bundle(zone_bundle_input, deployment_name):
    zone_bundle = copy.deepcopy(zone_bundle_input)
    proc_pool = library.RecursiveMultiprocessingPool(len(zone_bundle['zones']))
    proc_pool_results = [
        proc_pool.apply_async(deploy_zone_set_server_ip,
                              (zone, deployment_name))
        for zone in zone_bundle['zones']
    ]
    zone_bundle['zones'] = [result.get() for result in proc_pool_results]
    return zone_bundle
Example #3
0
def install_irods_on_zone_resource_servers(resource_servers,
                                           version_to_packages_map,
                                           install_dev_package):
    n = len(resource_servers)
    if n > 0:
        proc_pool = library.RecursiveMultiprocessingPool(n)
        proc_pool_results = [
            proc_pool.apply_async(install_irods_on_zone_resource_server,
                                  (resource_server, version_to_packages_map,
                                   install_dev_package))
            for resource_server in resource_servers
        ]
        resource_servers = [result.get() for result in proc_pool_results]
    return resource_servers
Example #4
0
def install_irods_on_zone_bundle(zone_bundle, version_to_packages_map,
                                 mungefs_packages_dir, install_dev_package):
    proc_pool = library.RecursiveMultiprocessingPool(len(zone_bundle['zones']))
    proc_pool_results = [
        proc_pool.apply_async(install_irods_on_zone,
                              (zone, version_to_packages_map,
                               mungefs_packages_dir, install_dev_package))
        for zone in zone_bundle['zones']
    ]
    zone_bundle_updated = copy.deepcopy(zone_bundle)
    zone_bundle_updated['zones'] = [
        result.get() for result in proc_pool_results
    ]
    return zone_bundle_updated
Example #5
0
def deploy_zone_set_server_ip(zone_input, deployment_name):
    logger = logging.getLogger(__name__)
    zone = copy.deepcopy(zone_input)

    def generate_vm_name(server, deployment_name):
        zone_name = server['server_config']['zone_name']
        hostname = server['hostname']
        return '{0} :: {1} :: {2}'.format(deployment_name, zone_name, hostname)

    for server in library.get_servers_from_zone(zone):
        if 'deployment_information' not in server:
            server['deployment_information'] = {}
        server['deployment_information']['vm_name'] = generate_vm_name(
            server, deployment_name)

    servers = library.get_servers_from_zone(zone)
    proc_pool = library.RecursiveMultiprocessingPool(len(servers))
    proc_pool_results = [
        proc_pool.apply_async(
            library.deploy_vm_return_ip,
            (server['deployment_information']['vm_name'],
             (server['host_system_information']['os_distribution_name'],
              server['host_system_information']
              ['os_distribution_version'].split('.')[0])))
        for server in servers
    ]

    for server, result in zip(servers, proc_pool_results):
        ip_address = result.get()
        server['deployment_information']['ip_address'] = ip_address
        logger.info(server['hostname'] + ' :: ' + ip_address)

    database_config = zone['icat_server']['database_config']
    if database_config['catalog_database_type'] == 'oracle':
        zone_name = zone['icat_server']['server_config']['zone_name']
        db_vm_name = '{0} :: {1} :: Oracle DB'.format(deployment_name,
                                                      zone_name)
        db_ip_address = library.deploy_vm_return_ip(db_vm_name, 'Oracle')
        if 'deployment_information' not in database_config:
            database_config['deployment_information'] = {}
        database_config['deployment_information']['vm_name'] = db_vm_name
        database_config['deployment_information']['ip_address'] = db_ip_address
    return zone