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)
def test_create_patch_ports_7_0(mocker): node = Mock() mock_ssh = mocker.patch('octane.util.ssh.call') expected_args = [ call(['ovs-vsctl', 'add-port', 'br-ex', 'br-ex--br-ovs-bond1', '--', 'set', 'interface', 'br-ex--br-ovs-bond1', 'type=patch', 'options:peer=br-ovs-bond1--br-ex'], node=node), call(['ovs-vsctl', 'add-port', 'br-ovs-bond1', 'br-ovs-bond1--br-ex', '--', 'set', 'interface', 'br-ovs-bond1--br-ex', 'type=patch', 'options:peer=br-ex--br-ovs-bond1'], node=node), call(['ovs-vsctl', 'add-port', 'br-mgmt', 'br-mgmt--br-ovs-bond2', '--', 'set', 'interface', 'br-mgmt--br-ovs-bond2', 'type=patch', 'options:peer=br-ovs-bond2--br-mgmt'], node=node), call(['ovs-vsctl', 'add-port', 'br-ovs-bond2', 'br-ovs-bond2--br-mgmt', 'tag=102', '--', 'set', 'interface', 'br-ovs-bond2--br-mgmt', 'type=patch', 'options:peer=br-mgmt--br-ovs-bond2'], node=node) ] network.create_patch_ports(node, DEPLOYMENT_INFO_OVS_7_0) assert mock_ssh.call_args_list == expected_args
def test_create_patch_ports_7_0(mocker): node = Mock() mock_ssh = mocker.patch('octane.util.ssh.call') expected_args = [ call([ 'ovs-vsctl', 'add-port', 'br-ex', 'br-ex--br-ovs-bond1', '--', 'set', 'interface', 'br-ex--br-ovs-bond1', 'type=patch', 'options:peer=br-ovs-bond1--br-ex' ], node=node), call([ 'ovs-vsctl', 'add-port', 'br-ovs-bond1', 'br-ovs-bond1--br-ex', '--', 'set', 'interface', 'br-ovs-bond1--br-ex', 'type=patch', 'options:peer=br-ex--br-ovs-bond1' ], node=node), call([ 'ovs-vsctl', 'add-port', 'br-mgmt', 'br-mgmt--br-ovs-bond2', '--', 'set', 'interface', 'br-mgmt--br-ovs-bond2', 'type=patch', 'options:peer=br-ovs-bond2--br-mgmt' ], node=node), call([ 'ovs-vsctl', 'add-port', 'br-ovs-bond2', 'br-ovs-bond2--br-mgmt', 'tag=102', '--', 'set', 'interface', 'br-ovs-bond2--br-mgmt', 'type=patch', 'options:peer=br-mgmt--br-ovs-bond2' ], node=node) ] network.create_patch_ports(node, DEPLOYMENT_INFO_OVS_7_0) assert mock_ssh.call_args_list == expected_args
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)
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)
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)