Пример #1
0
def deploy_sl(revert_snapshot, request, config, hardware, underlay,
              common_services_deployed, sl_actions):
    """Fixture to get or install OpenStack services on environment

    :param revert_snapshot: fixture that reverts snapshot that is specified
                            in test with @pytest.mark.revert_snapshot(<name>)
    :param request: fixture provides pytest data
    :param config: fixture provides oslo.config
    :param hardware: fixture provides enviromnet manager
    :param underlay: fixture provides underlay manager
    :param tcp_actions: fixture provides OpenstackManager instance
    :rtype: SLManager

    If you want to revert 'sl_deployed' snapshot, please use mark:
    @pytest.mark.revert_snapshot("sl_deployed")
    """
    # Create Salt cluster
    if not config.stack_light.sl_installed:
        steps_path = config.sl_deploy.sl_steps_path
        commands = utils.read_template(steps_path)
        sl_actions.install(commands)
        hardware.create_snapshot(ext.SNAPSHOT.sl_deployed)

    else:
        # 1. hardware environment created and powered on
        # 2. config.underlay.ssh contains SSH access to provisioned nodes
        #    (can be passed from external config with TESTS_CONFIGS variable)
        # 3. config.tcp.* options contain access credentials to the already
        #    installed TCP API endpoint
        pass

    return sl_actions
Пример #2
0
def common_services_deployed(revert_snapshot, request, config,
                             hardware, underlay, salt_deployed,
                             common_services_actions):
    """Fixture to get or install common services on the environment

    :param revert_snapshot: fixture that reverts snapshot that is specified
                            in test with @pytest.mark.revert_snapshot(<name>)
    :param request: fixture provides pytest data
    :param config: fixture provides oslo.config
    :param hardware: fixture provides enviromnet manager
    :param underlay: fixture provides underlay manager
    :param common_services_actions: fixture provides CommonServicesManager
                                    instance
    :rtype: CommonServicesManager

    If config.common_services.common_services_installed is not set, this
    fixture assumes that the common services were not installed
    , and do the following:
    - install common services
    - make snapshot with name 'common_services_deployed'
    - return CommonServicesManager

    If config.common_services.common_services_installed was set, this fixture
    assumes that the common services were already installed, and do
    the following:
    - return CommonServicesManager instance

    If you want to revert 'common_services_deployed' snapshot, please use mark:
    @pytest.mark.revert_snapshot("common_services_deployed")
    """
    # Create Salt cluster
    if not config.common_services.common_services_installed:
        steps_path = config.common_services_deploy.common_services_steps_path
        commands = utils.read_template(steps_path)
        common_services_actions.install(commands)
        hardware.create_snapshot(ext.SNAPSHOT.common_services_deployed)

    else:
        # 1. hardware environment created and powered on
        # 2. config.underlay.ssh contains SSH access to provisioned nodes
        #    (can be passed from external config with TESTS_CONFIGS variable)
        # 3. config.tcp.* options contain access credentials to the already
        #    installed TCP API endpoint
        pass

    return common_services_actions
Пример #3
0
def deploy_sl(revert_snapshot, request, config,
              hardware, underlay, common_services_deployed,
              sl_actions):
    """Fixture to get or install OpenStack services on environment

    :param revert_snapshot: fixture that reverts snapshot that is specified
                            in test with @pytest.mark.revert_snapshot(<name>)
    :param request: fixture provides pytest data
    :param config: fixture provides oslo.config
    :param hardware: fixture provides enviromnet manager
    :param underlay: fixture provides underlay manager
    :param tcp_actions: fixture provides OpenstackManager instance
    :rtype: SLManager

    If you want to revert 'sl_deployed' snapshot, please use mark:
    @pytest.mark.revert_snapshot("sl_deployed")
    """
    # Create Salt cluster
    if not config.stack_light.sl_installed:
        steps_path = config.sl_deploy.sl_steps_path
        commands = utils.read_template(steps_path)
        sl_actions.install(commands)
        hardware.create_snapshot(ext.SNAPSHOT.sl_deployed)

    else:
        # 1. hardware environment created and powered on
        # 2. config.underlay.ssh contains SSH access to provisioned nodes
        #    (can be passed from external config with TESTS_CONFIGS variable)
        # 3. config.tcp.* options contain access credentials to the already
        #    installed TCP API endpoint
        pass
    # Workaround for keepalived hang issue after env revert from snapshot
    # see https://mirantis.jira.com/browse/PROD-12038
    LOG.warning('Restarting keepalived service on controllers...')
    sl_actions._salt.local(tgt='ctl*', fun='cmd.run',
                args='systemctl restart keepalived.service')
    sl_actions._salt.local(tgt='mon*', fun='cmd.run',
                           args='systemctl restart keepalived.service')
    return sl_actions