How to use the rally.plugins.openstack.scenarios.nova.utils.NovaScenario function in rally

To help you get started, we’ve selected a few rally examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__resize_revert(self, status=None):
        nova_scenario = utils.NovaScenario(context=self.context)
        if status is None:
            nova_scenario._resize_revert(self.server)
            status = "ACTIVE"
        else:
            nova_scenario._resize_revert(self.server, status=status)
        self.mock_wait_for_status.mock.assert_called_once_with(
            self.server,
            ready_statuses=[status],
            update_resource=self.mock_get_from_manager.mock.return_value,
            check_interval=CONF.openstack.
            nova_server_resize_revert_poll_interval,
            timeout=CONF.openstack.nova_server_resize_revert_timeout)
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.resize_revert")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__suspend_server(self):
        nova_scenario = utils.NovaScenario(context=self.context)
        nova_scenario._suspend_server(self.server)
        self.server.suspend.assert_called_once_with()
        self.mock_wait_for_status.mock.assert_called_once_with(
            self.server,
            ready_statuses=["SUSPENDED"],
            update_resource=self.mock_get_from_manager.mock.return_value,
            check_interval=CONF.openstack.nova_server_suspend_poll_interval,
            timeout=CONF.openstack.nova_server_suspend_timeout)
        self.mock_get_from_manager.mock.assert_called_once_with()
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.suspend_server")
github openstack / rally-openstack / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__rescue_server(self):
        nova_scenario = utils.NovaScenario()
        nova_scenario._rescue_server(self.server)
        self.server.rescue.assert_called_once_with()
        self._test_assert_called_once_with(
            self.wait_for.mock, self.server,
            CONF.benchmark.nova_server_rescue_poll_interval,
            CONF.benchmark.nova_server_rescue_timeout)
        self.res_is.mock.assert_has_calls([mock.call("RESCUE")])
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.rescue_server")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__rescue_server(self):
        nova_scenario = utils.NovaScenario(context=self.context)
        nova_scenario._rescue_server(self.server)
        self.server.rescue.assert_called_once_with()
        self.mock_wait_for_status.mock.assert_called_once_with(
            self.server,
            ready_statuses=["RESCUE"],
            update_resource=self.mock_get_from_manager.mock.return_value,
            check_interval=CONF.openstack.nova_server_rescue_poll_interval,
            timeout=CONF.openstack.nova_server_rescue_timeout)
        self.mock_get_from_manager.mock.assert_called_once_with()
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.rescue_server")
github openstack / rally-openstack / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__boot_server(self, mock_clients, mock_generate_random_name):
        mock_clients("nova").servers.create.return_value = self.server
        nova_scenario = utils.NovaScenario(context={})
        return_server = nova_scenario._boot_server("image_id",
                                                   "flavor_id")
        self._test_assert_called_once_with(
            self.wait_for.mock, self.server,
            CONF.benchmark.nova_server_boot_poll_interval,
            CONF.benchmark.nova_server_boot_timeout)
        self.res_is.mock.assert_has_calls([mock.call("ACTIVE")])
        self.assertEqual(self.wait_for.mock(), return_server)
        mock_clients("nova").servers.create.assert_called_once_with(
            "foo_server_name", "image_id", "flavor_id")
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.boot_server")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__pause_server(self):
        nova_scenario = utils.NovaScenario(context=self.context)
        nova_scenario._pause_server(self.server)
        self.server.pause.assert_called_once_with()
        self.mock_wait_for_status.mock.assert_called_once_with(
            self.server,
            ready_statuses=["PAUSED"],
            update_resource=self.mock_get_from_manager.mock.return_value,
            check_interval=CONF.openstack.nova_server_pause_poll_interval,
            timeout=CONF.openstack.nova_server_pause_timeout)
        self.mock_get_from_manager.mock.assert_called_once_with()
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.pause_server")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__start_server(self):
        nova_scenario = utils.NovaScenario(context=self.context)
        nova_scenario._start_server(self.server)
        self.server.start.assert_called_once_with()
        self.mock_wait_for_status.mock.assert_called_once_with(
            self.server,
            ready_statuses=["ACTIVE"],
            update_resource=self.mock_get_from_manager.mock.return_value,
            check_interval=CONF.openstack.nova_server_start_poll_interval,
            timeout=CONF.openstack.nova_server_start_timeout)
        self.mock_get_from_manager.mock.assert_called_once_with()
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.start_server")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__list_interfaces(self):
        nova_scenario = utils.NovaScenario()
        result = nova_scenario._list_interfaces("server")
        self.assertEqual(
            self.clients("nova").servers.interface_list.return_value,
            result)
        self.clients("nova").servers.interface_list.assert_called_once_with(
            "server")
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.list_interfaces")
github openstack / rally / tests / unit / plugins / openstack / scenarios / nova / test_utils.py View on Github external
def test__list_flavor_access(self):
        nova_scenario = utils.NovaScenario()
        result = nova_scenario._list_flavor_access("foo_id")
        self.assertEqual(
            self.admin_clients("nova").flavor_access.list.return_value,
            result)
        self.admin_clients("nova").flavor_access.list.assert_called_once_with(
            flavor="foo_id")
        self._test_atomic_action_timer(nova_scenario.atomic_actions(),
                                       "nova.list_flavor_access")
github openstack / rally / rally / plugins / openstack / scenarios / vm / utils.py View on Github external
server.status = cls.ICMP_UP_STATUS
        else:
            server.status = cls.ICMP_DOWN_STATUS
        return server

    def __eq__(self, other):
        if not isinstance(other, Host):
            raise TypeError("%s should be an instance of %s" % (
                other, Host.__class__.__name__))
        return self.ip == other.ip and self.status == other.status

    def __ne__(self, other):
        return not self.__eq__(other)


class VMScenario(nova_utils.NovaScenario):
    """Base class for VM scenarios with basic atomic actions.

    VM scenarios are scenarios executed inside some launched VM instance.
    """

    USER_RWX_OTHERS_RX_ACCESS_MODE = 0o755

    RESOURCE_NAME_PREFIX = "rally_vm_"

    @atomic.action_timer("vm.run_command_over_ssh")
    def _run_command_over_ssh(self, ssh, command):
        """Run command inside an instance.

        This is a separate function so that only script execution is timed.

        :param ssh: A SSHClient instance.