示例#1
0
def upgrade_ceph_with_graph(orig_id, seed_id):
    """Upgrade ceph using deployment graphs"""

    deploy.upload_graphs(orig_id, seed_id)

    deploy.execute_graph_and_wait('upgrade-ceph', orig_id)
    deploy.execute_graph_and_wait('upgrade-ceph', seed_id)
def test_upload_graphs(mocker, orig_id, seed_id):
    mock_upload = mocker.patch("octane.util.deployment.upload_graphs_to_env")
    deployment.upload_graphs(orig_id, seed_id)
    assert mock_upload.call_args_list == [
        mock.call(
            "/var/www/nailgun/octane_code/puppet/octane_tasks/graphs/orig",
            orig_id),
        mock.call(
            "/var/www/nailgun/octane_code/puppet/octane_tasks/graphs/seed",
            seed_id),
    ]
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
示例#4
0
def upgrade_db_with_graph(orig_id, seed_id):
    """Upgrade db 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)

    # Upload all graphs
    deploy.upload_graphs(orig_id, seed_id)

    # If any failure try to rollback ONLY original environment.
    try:
        deploy.execute_graph_and_wait("upgrade-db", orig_id)
        deploy.execute_graph_and_wait("upgrade-db", seed_id)
    except Exception:
        cluster_graphs = deploy.get_cluster_graph_names(orig_id)
        if "upgrade-db-rollback" in cluster_graphs:
            LOG.info("Trying to rollback 'upgrade-db' on the "
                     "orig environment '%s'.", orig_id)
            deploy.execute_graph_and_wait("upgrade-db-rollback", orig_id)
        raise