Ejemplo n.º 1
0
def upgrade_control_plane(orig_id, seed_id):
    orig_env = environment_obj.Environment(orig_id)
    seed_env = environment_obj.Environment(seed_id)
    controllers = list(env_util.get_controllers(seed_env))
    update_neutron_config(orig_env, seed_env)
    # enable all services on seed env
    if len(controllers) > 1:
        maintenance.stop_cluster(seed_env)
    else:
        maintenance.start_corosync_services(seed_env)
        maintenance.start_upstart_services(seed_env)
    # disable cluster services on orig env
    maintenance.stop_cluster(orig_env)
    # switch networks to seed env
    roles = ['primary-controller', 'controller']
    # disable physical connectivity for orig env
    for node, info in env_util.iter_deployment_info(orig_env, roles):
        network.delete_patch_ports(node, info)
    # enable physical connectivity for seed env
    for node, info in env_util.iter_deployment_info(seed_env, roles):
        network.delete_overlay_networks(node, info)
        network.create_patch_ports(node, info)
    # enable all services on seed env
    if len(controllers) > 1:
        maintenance.start_cluster(seed_env)
        maintenance.start_corosync_services(seed_env)
        maintenance.start_upstart_services(seed_env)
Ejemplo n.º 2
0
def test_delete_overlay_network(mocker):
    node = Mock()
    deployment_info = {
        'network_scheme': {
            'transformations': [{
                'action': 'add-br',
                'name': 'br-ex',
                'provider': 'ovs',
            }, {
                'action': 'add-br',
                'name': 'br-mgmt',
            }]
        }
    }

    mock_ssh = mocker.patch('octane.util.ssh.call')

    mock_ovs_tuns = mocker.patch('octane.helpers.network.list_tunnels_ovs')
    mock_ovs_tuns.return_value = ['br-ex--gre-10.10.10.2']

    mock_lnx_tun = mocker.patch('octane.helpers.network.list_tunnels_lnx')
    mock_lnx_tun.return_value = ['gre3-3']

    expected_args = [
        call(['ovs-vsctl', 'del-port', 'br-ex', 'br-ex--gre-10.10.10.2'],
             node=node),
        call(['brctl', 'delif', 'br-mgmt', 'gre3-3'], node=node),
        call(['ip', 'link', 'delete', 'gre3-3'], node=node),
    ]

    network.delete_overlay_networks(node, deployment_info)

    assert mock_ssh.call_args_list == expected_args
Ejemplo n.º 3
0
def test_delete_overlay_network(mocker):
    node = Mock()
    deployment_info = {
        'network_scheme': {
            'transformations': [{
                'action': 'add-br',
                'name': 'br-ex',
                'provider': 'ovs',
            }, {
                'action': 'add-br',
                'name': 'br-mgmt',
            }]
        }
    }

    mock_ssh = mocker.patch('octane.util.ssh.call')

    mock_ovs_tuns = mocker.patch('octane.helpers.network.list_tunnels_ovs')
    mock_ovs_tuns.return_value = ['br-ex--gre-10.10.10.2']

    mock_lnx_tun = mocker.patch('octane.helpers.network.list_tunnels_lnx')
    mock_lnx_tun.return_value = ['gre3-3']

    expected_args = [
        call(['ovs-vsctl', 'del-port', 'br-ex', 'br-ex--gre-10.10.10.2'],
             node=node),
        call(['brctl', 'delif', 'br-mgmt', 'gre3-3'], node=node),
        call(['ip', 'link', 'delete', 'gre3-3'], node=node),
    ]

    network.delete_overlay_networks(node, deployment_info)

    assert mock_ssh.call_args_list == expected_args
Ejemplo n.º 4
0
def upgrade_control_plane(orig_id, seed_id):
    orig_env = environment_obj.Environment(orig_id)
    seed_env = environment_obj.Environment(seed_id)
    controllers = list(env_util.get_controllers(seed_env))
    update_neutron_config(orig_env, seed_env)
    # enable all services on seed env
    if len(controllers) > 1:
        maintenance.stop_cluster(seed_env)
    else:
        maintenance.start_corosync_services(seed_env)
        maintenance.start_upstart_services(seed_env)
    # disable cluster services on orig env
    maintenance.stop_cluster(orig_env)
    # switch networks to seed env
    roles = ['primary-controller', 'controller']
    # disable physical connectivity for orig env
    for node, info in env_util.iter_deployment_info(orig_env, roles):
        network.delete_patch_ports(node, info)
    # enable physical connectivity for seed env
    for node, info in env_util.iter_deployment_info(seed_env, roles):
        network.delete_overlay_networks(node, info)
        network.create_patch_ports(node, info)
    # enable all services on seed env
    if len(controllers) > 1:
        maintenance.start_cluster(seed_env)
        maintenance.start_corosync_services(seed_env)
        maintenance.start_upstart_services(seed_env)
Ejemplo n.º 5
0
def connect_to_networks(env):
    deployment_info = []
    controllers = list(env_util.get_controllers(env))
    backup_path = os.path.join(magic_consts.FUEL_CACHE,
                               'deployment_{0}.orig'.format(env.id))
    for filename in os.listdir(backup_path):
        filepath = os.path.join(backup_path, filename)
        with open(filepath) as info_file:
            info = yaml.safe_load(info_file)
            deployment_info.append(info)
    for node in controllers:
        for info in deployment_info:
            if info['role'] in ('primary-controller', 'controller'):
                network.delete_overlay_networks(node, info)
                network.create_patch_ports(node, info)
Ejemplo n.º 6
0
def connect_to_networks(env):
    deployment_info = []
    controllers = list(env_util.get_controllers(env))
    backup_path = os.path.join(magic_consts.FUEL_CACHE,
                               'deployment_{0}.orig'
                               .format(env.id))
    for filename in os.listdir(backup_path):
        filepath = os.path.join(backup_path, filename)
        with open(filepath) as info_file:
            info = yaml.safe_load(info_file)
            deployment_info.append(info)
    for node in controllers:
        for info in deployment_info:
            if info['role'] in ('primary-controller', 'controller'):
                network.delete_overlay_networks(node, info)
                network.create_patch_ports(node, info)