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))
    # 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)
    # NOTE(akscram): Remove replaced deployment info with
    # the isolation mode and the alternative gateway.
    # CAUTION: This method removes replaced deployment
    # information for all nodes in an environment.
    seed_env.delete_facts("deployment")
def rollback_control_plane(seed_id, orig_id):
    seed_env = environment_obj.Environment(seed_id)
    orig_env = environment_obj.Environment(orig_id)
    # switch physical networks connectivity to orig_env
    roles = ['primary-controller', 'controller']
    for node, info in env_util.iter_deployment_info(seed_env, roles):
        network.delete_patch_ports(node, info)
    for node, info in env_util.iter_deployment_info(orig_env, roles):
        network.create_patch_ports(node, info)
    # enable cluster's services for orig_env
    maintenance.start_cluster(orig_env)
    maintenance.start_corosync_services(orig_env)
    maintenance.enable_apis(orig_env)
Esempio n. 3
0
def test_delete_lnx_ports(mocker):
    node = mock.Mock()

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

    expected_args = [
        mock.call(['brctl', 'delif', 'br-ex', 'eth0.130'],
                  node=node),
        mock.call(['brctl', 'delif', 'br-mgmt', 'eth1.220'],
                  node=node),
    ]

    network.delete_patch_ports(node, DEPLOYMENT_INFO_7_0)

    assert mock_ssh.call_args_list == expected_args
def upgrade_control_plane_with_graph(orig_id, seed_id):
    """Switch controlplane using deployment graphs"""

    orig_env = environment_obj.Environment(orig_id)
    seed_env = environment_obj.Environment(seed_id)
    add_upgrade_attrs_to_settings(orig_env, seed_env)

    deploy.upload_graphs(orig_id, seed_id)

    try:
        # Start openstack services on the seed controller
        deploy.execute_graph_and_wait('switch-control-1', seed_id)

        # Kill pacemaker on the original controllers
        deploy.execute_graph_and_wait('switch-control-1', orig_id)

        # Cut off the original controller from network
        roles = ['primary-controller', 'controller']
        for node, info in env_util.iter_deployment_info(orig_env, roles):
            network.delete_patch_ports(node, info)

        # Restore transformations for the seed environment
        seed_env.delete_facts("deployment")

        # Connect the seed controller to a physical network
        deploy.execute_graph_and_wait('switch-control-2', seed_id)

        # Decommission the orig controllers by stopping OpenStack services
        deploy.execute_graph_and_wait('switch-control-2', orig_id)
    except Exception:
        LOG.info('Trying to rollback switch-control phase')

        # Cut off the seed controller from networks
        roles = ['primary-controller', 'controller']

        for info in seed_env.get_default_facts('deployment'):
            if set(info['roles']) & set(roles):
                network.delete_patch_ports(node_obj.Node(info['uid']), info)

        # Restore network connectivity for the original controller
        # Recreate cluster
        deploy.execute_graph_and_wait('switch-control-rollback', orig_id)

        # Stop openstack services on the seed controller
        deploy.execute_graph_and_wait('switch-control-rollback', seed_id)

        raise
Esempio n. 5
0
def test_delete_patch_ports(mocker):
    node = mock.Mock()

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

    expected_args = [
        mock.call(
            ['ovs-vsctl', 'del-port', 'br-ovs-bond1', 'br-ovs-bond1--br-ex'],
            node=node),
        mock.call(['ovs-vsctl', 'del-port', 'br-ex', 'br-ex--br-ovs-bond1'],
                  node=node),
        mock.call(['ovs-vsctl', 'del-port', 'br-ovs-bond2',
                   'br-ovs-bond2--br-mgmt'],
                  node=node),
        mock.call(
            ['ovs-vsctl', 'del-port', 'br-mgmt', 'br-mgmt--br-ovs-bond2'],
            node=node),
    ]

    network.delete_patch_ports(node, DEPLOYMENT_INFO_5_1)

    assert mock_ssh.call_args_list == expected_args