Nova

Nova conftest

stepler.nova.conftest.aggregate_steps(nova_client)[source]

Callable function fixture to get nova aggregate steps.

Parameters:nova_client (function) – function to get nova client
Returns:function to instantiated aggregate steps
Return type:function
stepler.nova.conftest.attach_volume_to_server(nova_volume_steps, volume_steps)[source]

Callable function fixture to attach volume to server.

Can be called several times during test.

Parameters:
Returns:

function to attach volume to server

Return type:

function

stepler.nova.conftest.availability_zone_steps(get_availability_zone_steps)[source]

Fixture to get availability zone steps.

Parameters:get_availability_zone_steps (function) – function to get availability zone steps.
Returns:instantiated zone steps.
Return type:ZoneSteps
stepler.nova.conftest.available_flavors_for_hypervisors(flavor_steps, hypervisor_steps)[source]

Function fixture to get available flavors for hypervisors.

Parameters:
  • flavor_steps (object) – instantiated flavor steps
  • hypervisor_steps (object) – instantiated hypervisor steps
Returns:

list of available flavors

Return type:

list

stepler.nova.conftest.baremetal_flavor(flavor_steps)[source]

Function fixture to create baremetal flavor before test.

Args:
flavor_steps (object): instantiated flavor steps
Returns:baremetal flavor
Return type:object
stepler.nova.conftest.cirros_server_to_rebuild(request, keypair, flavor, security_group, cirros_image, net_subnet_router, volume_steps, server_steps)[source]

Fixture to create server for nova rebuild tests.

This fixture creates a server which can be booted from cirros image or cirros-based volume with parametrization. Default is boot from image.

Example

@pytest.mark.parametrized('cirros_server_to_rebuild', [
        {'boot_from_volume': True},
        {'boot_from_volume': False}
    ], indirect=True)
def test_foo(cirros_server_to_rebuild):
    pass
Parameters:
  • request (obj) – pytest SubRequest instance
  • keypair (obj) – keypair
  • flavor (obj) – flavor
  • security_group (obj) – security group
  • cirros_image (obj) – cirros image
  • net_subnet_router (tuple) – neutron network, subnet and router
  • volume_steps (obj) – instantiated volume steps
  • server_steps (obj) – instantiated server steps
Returns:

nova server

Return type:

object

stepler.nova.conftest.create_aggregate(aggregate_steps)[source]

Callable function fixture to create nova aggregate with options.

Can be called several times during a test. After the test it destroys all created nodes.

Parameters:flavor_steps (object) – instantiated flavor steps
Returns:function to create flavors as batch with options
Return type:function
stepler.nova.conftest.create_flavor(flavor_steps)[source]

Callable function fixture to create nova flavor with options.

Can be called several times during a test. After the test it destroys all created nodes.

Parameters:flavor_steps (object) – instantiated flavor steps
Returns:function to create flavors as batch with options
Return type:function
stepler.nova.conftest.create_server_context(create_servers_context)[source]

Function fixture to create server inside context.

It guarantees server deletion after context exit. It should be used when server must be deleted inside a test, and its deletion can’t be delegated to fixture finalization. Can be called several times during a test.

Example

def test_something(create_server_context):
    for i in sequence:  # sequence can't be calculated outside test
        with create_server_context(*args, **kwgs) as server:
            server.do_something()
Parameters:create_servers_context (function) – context manager to create servers
Returns:function to use as context manager to create server
Return type:function
stepler.nova.conftest.create_servers_context(server_steps)[source]

Function fixture to create servers inside context.

It guarantees servers deletion after context exit. It should be used when servers must be deleted inside a test, and their deletion can’t be delegated to fixture finalization. Can be called several times during a test.

Example

def test_something(create_servers_context):
    for i in sequence:  # sequence can't be calculated outside test
        with create_servers_context(*args, **kwgs) as servers:
            [server.do_something() for server in servers]
Parameters:server_steps (stepler.nova.steps.ServerSteps) – instantiated steps object to manipulate with server resource.
Returns:function to use as context manager to create servers
Return type:function
stepler.nova.conftest.detach_volume_from_server(nova_volume_steps, volume_steps)[source]

Callable function fixture to detach volume to server.

Can be called several times during test.

Parameters:
Returns:

function to detach volume to server

Return type:

function

stepler.nova.conftest.flavor(request, flavor_steps)

Function fixture to create single nova flavor with options.

Can be called several times during a test. After the test it destroys all created nodes.

Can be parametrized with dict of create_flavor arguments.

Example

@pytest.mark.parametrize('flavor', [
    dict(ram=2048, vcpus=2),
    dict(ram=512, disk=1, metadata={'hw:mem_page_size':
                                    'large m1.tiny'}),
], indirect=['flavor'])
def test_foo(instance):
    # Instance will created with different flavors
Parameters:
  • request (object) – py.test SubRequest
  • flavor_steps (object) – instantiated flavor steps
Returns:

function to create single flavor with options

Return type:

function

stepler.nova.conftest.flavor_steps(nova_client)[source]

Function fixture to get nova flavor steps.

Parameters:nova_client (function) – function to get nova client
Yields:stepler.nova.steps.FlavorSteps – instantiated flavor steps
stepler.nova.conftest.flavors(request, flavor_steps)[source]

Function fixture to create flavor with default options before test.

Parameters:
  • request (object) – py.test’s SubRequest instance
  • create_flavor (function) – function to create flavor with options
Returns:

nova flavors

Return type:

list

stepler.nova.conftest.generate_os_workload(cirros_image)[source]

Fixture to generate openstack workload.

This fixture launches a script which generates Openstack workload, ex: creates and deletes networks, subnets and servers cyclically. Finally, the signal is sent to the script, and it provides correct deletion of objects created before. For correct execution of generation scripts, it’s supposed that at least one image exists.

Returns:function to generate openstack workload
Return type:function
stepler.nova.conftest.generate_traffic()[source]

Fixture to generate traffic to server.

Can be called several time during test. Simplest listener can be started with nc -k -l <port>.

stepler.nova.conftest.get_availability_zone_steps(get_nova_client)[source]

Callable session fixture to get availability zone steps.

Parameters:get_nova_client (function) – function to get nova client.
Returns:function to get availability zone steps.
Return type:function
stepler.nova.conftest.get_keypair_steps(get_nova_client)[source]

Callable session fixture to get nova keypair steps.

Parameters:get_nova_client (function) – function to get instantiated nova client
Returns:function to get instantiated nova keypair steps
Return type:function
stepler.nova.conftest.get_nova_client(get_session)[source]

Callable session fixture to get nova client.

Parameters:get_session (keystoneauth1.session.Session) – authenticated keystone session
Returns:function to get nova client
Return type:function
stepler.nova.conftest.get_nova_floating_ip_steps(get_nova_client)[source]

Callable session fixture to get nova floating ip steps.

Parameters:get_nova_client (function) – function to get instantiated nova client
Returns:function to get instantiated nova floating_ip steps
Return type:function
stepler.nova.conftest.get_rabbitmq_cluster_data(os_faults_steps)[source]

Callable fixture to get RabbitMQ cluster config data and its status.

Parameters:os_faults_steps

instantiated os_faults steps.

Returns:
function: function to get cluster data.
stepler.nova.conftest.get_security_group_steps(get_nova_client)[source]

Callable session fixture to get security groups steps.

Parameters:get_nova_client (function) – function to get nova client.
Returns:function to get security groups steps.
Return type:function
stepler.nova.conftest.get_server_steps(get_nova_client)[source]

Callable session fixture to get server steps.

Parameters:get_nova_client (function) – function to get nova client
Returns:function to get server steps
Return type:function
stepler.nova.conftest.get_ssh_proxy_cmd(network_steps, agent_steps, os_faults_steps, server_steps)[source]

Callable function fixture to get ssh proxy data of server.

Parameters:
  • network_steps (NetworkSteps) – instantiated network steps
  • agent_steps (AgentSteps) – instantiated agent steps
  • os_faults_steps (OsFaultsSteps) – initialized os-faults steps
  • server_steps (ServerSteps) – instantiated server steps
Returns:

function to get ssh proxy command

Return type:

function

stepler.nova.conftest.host_steps(nova_client)[source]

Function fixture to get host steps.

Parameters:nova_client (object) – instantiated nova client
Returns:instantiated host steps
Return type:stepler.nova.steps.HostSteps
stepler.nova.conftest.hypervisor_steps(nova_client)[source]

Fixture to get hypervisor steps.

Parameters:nova_client (object) – instantiated nova client
Returns:instantiated hypervisor steps
Return type:stepler.nova.steps.HypervisorSteps
stepler.nova.conftest.keypair(keypair_steps)[source]

Function fixture to create keypair with default options.

Parameters:keypair_steps (object) – instantiated keypair steps
Returns:keypair
Return type:object
stepler.nova.conftest.keypair_steps(get_keypair_steps, keypairs_cleanup)[source]

Function fixture to get keypair steps.

Can be called several times during test. After the test it destroys all created security groups

Parameters:
  • get_keypair_steps (function) – function to get instantiated nova client
  • keypairs_cleanup (function) – function to cleanup keypairs
Yields:

KeypairSteps – instantiated keypair steps

stepler.nova.conftest.keypairs_cleanup(uncleanable)[source]

Callable function fixture to cleanup keypairs after test.

Parameters:uncleanable (AttrDict) – data structure with skipped resources
Returns:function to cleanup keypairs
Return type:function
stepler.nova.conftest.live_migration_server(request, keypair, flavor, security_group, floating_ip, ubuntu_image, net_subnet_router, volume_steps, server_steps)[source]

Fixture to create server for live migration tests.

This fixture create server and add floating ip to it. It can boot server from ubuntu image or volume with parametrization. Default is boot from image.

Example

@pytest.mark.parametrized('live_migration_server', [
        {'boot_from_volume': True},
        {'boot_from_volume': False}
    ], indirect=True)
def test_foo(live_migration_server):
    pass
Parameters:
  • request (obj) – pytest SubRequest instance
  • keypair (obj) – keypair
  • flavor (obj) – flavor
  • security_group (obj) – security group
  • floating_ip (obj) – floating ip
  • ubuntu_image (obj) – ubuntu image
  • net_subnet_router (tuple) – neutron network, subnet and router
  • volume_steps (obj) – instantiated volume steps
  • server_steps (obj) – instance of ServerSteps
Returns:

nova server instance

Return type:

object

stepler.nova.conftest.live_migration_servers(request, keypair, flavor, security_group, ubuntu_image, net_subnet_router, sorted_hypervisors, current_project, create_floating_ip, cinder_quota_steps, hypervisor_steps, volume_steps, server_steps)[source]

Fixture to create servers for live migration tests.

This fixture creates max allowed count of servers and adds floating ip to each. It can boot servers from ubuntu image or volume with parametrization. Default is boot from image.

All created resources will be deleted after test.

Example

@pytest.mark.parametrized('live_migration_servers', [
        {'boot_from_volume': True},
        {'boot_from_volume': False}
    ], indirect=True)
def test_foo(live_migration_servers):
    pass
Parameters:
  • request (obj) – pytest SubRequest instance
  • keypair (obj) – keypair
  • flavor (obj) – flavor
  • security_group (obj) – security group
  • ubuntu_image (obj) – ubuntu image
  • net_subnet_router (tuple) – neutron network, subnet and router
  • sorted_hypervisors (list) – nova hypervisors list
  • current_project (obj) – current project
  • create_floating_ip (function) – function to create floating IP
  • cinder_quota_steps (obj) – instantiated cinder quota steps
  • hypervisor_steps (obj) – instantiated hypervisor steps
  • volume_steps (obj) – instantiated volume steps
  • server_steps (obj) – instantiated server steps
Returns:

nova servers

Return type:

list

stepler.nova.conftest.live_migration_servers_with_volumes(live_migration_servers, attach_volume_to_server, detach_volume_from_server, volume_steps)[source]

Function fixture to create servers with volumes for LM tests.

Parameters:
  • live_migration_servers (ilst) – list of nova servers
  • attach_volume_to_server (function) – function to attach volume to server
  • detach_volume_from_server (function) – function to detach volume from server
  • volume_steps (obj) – instantiated volume steps
Yields:

list – nova servers

stepler.nova.conftest.nova_absolute_limits(nova_limit_steps)[source]

Function fixture to get absolute limits.

Parameters:nova_limit_steps (NovaLimitSteps) – instantiated limit steps
Returns:list of AbsoluteLimit objects
Return type:list
stepler.nova.conftest.nova_availability_zone(availability_zone_steps)[source]

Fixture to get one available nova zone object.

Parameters:availability_zone_steps (function) – zone steps
Returns:nova zone object.
Return type:object
stepler.nova.conftest.nova_availability_zone_hosts(nova_availability_zone)[source]

Fixture to get all hosts from nova availability zone.

This fixture gets all hosts from nova availability zone except for ironic nodes.

Parameters:nova_availability_zone (object) – nova zone object.
Returns:str FQDN values
Return type:list
stepler.nova.conftest.nova_ceph_enabled(os_faults_steps)[source]

Function fixture to retrieve is Ceph is used by Nova.

Parameters:os_faults_steps (obj) – instantiated os-faults steps
Returns:is Ceph used by Nova or not
Return type:bool
stepler.nova.conftest.nova_client(get_nova_client)[source]

Function fixture to get nova client.

Parameters:get_nova_client (function) – function to get nova client
Returns:authenticated nova client
Return type:novaclient.client.Client
stepler.nova.conftest.nova_floating_ip(floating_ip)[source]

Fixture to create floating_ip with default options before test.

stepler.nova.conftest.nova_floating_ip_steps(get_nova_floating_ip_steps)[source]

Fixture to get floating_ip steps.

stepler.nova.conftest.nova_limit_steps(nova_client)[source]

Function fixture to get nova limit steps.

Parameters:nova_client (function) – function to get nova client
Returns:function to instantiated limit steps
Return type:function
stepler.nova.conftest.nova_service_steps(nova_client)[source]

Function fixture to get nova service steps.

Parameters:nova_client (object) – instantiated nova client
Returns:instantiated service steps
Return type:stepler.nova.steps.NovaServiceSteps
stepler.nova.conftest.nova_volume_steps(nova_client)[source]

Function fixture to get server volumes steps.

Parameters:nova_client (stepler.nova) – instantiated nova object.
Returns:instantiated steps objects for server volumes
Return type:object
stepler.nova.conftest.pinned_aggregate(create_aggregate, aggregate_steps, host_steps, os_faults_steps)[source]

Function fixture to create an aggregate with pinned=True and hosts

Parameters:
  • create_aggregate (function) – function to create nova aggregate
  • aggregate_steps (object) – instantiated aggregate steps
  • host_steps (object) – instantiated host steps
  • os_faults_steps (object) – instantiated os_faults steps
Returns:

nova aggregate

Return type:

object

stepler.nova.conftest.public_flavor(request, flavor_steps)

Function fixture to create single nova flavor with options.

Can be called several times during a test. After the test it destroys all created nodes.

Can be parametrized with dict of create_flavor arguments.

Example

@pytest.mark.parametrize('flavor', [
    dict(ram=2048, vcpus=2),
    dict(ram=512, disk=1, metadata={'hw:mem_page_size':
                                    'large m1.tiny'}),
], indirect=['flavor'])
def test_foo(instance):
    # Instance will created with different flavors
Parameters:
  • request (object) – py.test SubRequest
  • flavor_steps (object) – instantiated flavor steps
Returns:

function to create single flavor with options

Return type:

function

stepler.nova.conftest.rabbitmq_steps()[source]

Function fixture to get RabbitMQ steps.

Returns:instantiated RabbitMQ steps
Return type:stepler.nova.steps.RabbitMQSteps
stepler.nova.conftest.security_group(neutron_security_group)[source]

Fixture to create security group before test.

This fixture designed for backward compatibility.

Parameters:neutron_security_group (dict) – created security group
Returns:security group
Return type:attrdict.AttrDict
stepler.nova.conftest.security_group_steps(get_security_group_steps)[source]

Fixture to get security group steps.

Parameters:get_security_group_steps (function) – function to get security groups steps
stepler.nova.conftest.server(cirros_image, flavor, security_group, net_subnet_router, server_steps)[source]

Function fixture to create server with default options before test.

Parameters:
  • cirros_image (object) – cirros image from glance
  • flavor (object) – nova flavor
  • security_group (obj) – nova security group
  • net_subnet_router (tuple) – neutron network, subnet, router
  • server_steps (ServerSteps) – instantiated server steps
Returns:

nova server

Return type:

object

stepler.nova.conftest.server_steps(get_server_steps, servers_cleanup)[source]

Function fixture to get server steps.

Parameters:
  • get_server_steps (function) – function to get server steps
  • servers_cleanup (function) – function to cleanup servers after test
Returns:

instantiated server steps

Return type:

ServerSteps

stepler.nova.conftest.servers_cleanup(uncleanable, get_server_steps)[source]

Function fixture to cleanup servers after test.

Parameters:uncleanable (AttrDict) – data structure with skipped resources
stepler.nova.conftest.servers_to_evacuate(request, cirros_image, security_group, flavor, net_subnet_router, keypair, create_floating_ip, hypervisor_steps, volume_steps, server_steps)[source]

Fixture to create servers for nova evacuate tests.

This fixture creates amount of servers defined in config file, schedules them against dedicated compute node and attaches floating IP to every created server. It can boot servers from cirros image or cirros-based volume with parametrization. Default is boot from image. All created resources will be deleted after test.

Example

@pytest.mark.parametrize('servers_to_evacuate', [
        {'boot_from_volume': True},
        {'boot_from_volume': False}
    ], indirect=True)
def test_foo(servers_to_evacuate):
    pass
Parameters:
  • request (obj) – pytest SubRequest instance
  • cirros_image (obj) – cirros image
  • security_group (obj) – security group
  • flavor (obj) – flavor
  • net_subnet_router (tuple) – neutron network, subnet and router
  • keypair (obj) – keypair
  • create_floating_ip (function) – function to create floating IP
  • hypervisor_steps (obj) – instantiated hypervisor steps
  • volume_steps (obj) – instantiated volume steps
  • server_steps (obj) – instantiated server steps
Returns:

nova servers

Return type:

list

stepler.nova.conftest.servers_with_volumes_to_evacuate(servers_to_evacuate, attach_volume_to_server, volume_steps)[source]

Fixture to create servers with volumes for nova evacuate tests.

Parameters:
  • servers_to_evacuate (list) – list of nova servers
  • attach_volume_to_server (function) – function to attach volume to server
  • volume_steps (obj) – instantiated volume steps
Returns:

nova servers with volumes attached

Return type:

list

stepler.nova.conftest.skip_live_migration_tests(request, nova_ceph_enabled)[source]

Skip tests with wrong block_migration parameter.

Block migration requires Nova Ceph RBD to be disabled. This fixture skips parametrized with block_migration tests with wrong block_migration value (not suitable for current cloud).

Parameters:
  • request (obj) – py.test SubRequest instance
  • nova_ceph_enabled (bool) – is Ceph used by Nova or not
stepler.nova.conftest.small_flavor(flavor_steps)[source]

Function fixture to find or create small flavor before test.

Parameters:flavor_steps (object) – instantiated flavor steps
Returns:small flavor
Return type:object
stepler.nova.conftest.sorted_hypervisors(hypervisor_steps, flavor)[source]

Function fixture to get hypervisors sorted by their capacity.

Parameters:
  • hypervisor_steps (obj) – instantiated hypervisor steps
  • flavor (obj) – nova flavor
Returns:

sorted hypervisors (from biggest to smallest)

Return type:

list

stepler.nova.conftest.tiny_flavor(flavor_steps)[source]

Function fixture to find or create tiny flavor before test.

Parameters:flavor_steps (object) – instantiated flavor steps
Returns:tiny flavor
Return type:object
stepler.nova.conftest.ubuntu_server(ubuntu_image, flavor, keypair, security_group, net_subnet_router, server_steps)[source]

Function fixture to create ubuntu server with default options.

Parameters:
  • ubuntu_image (object) – glance ubuntu image
  • flavor (object) – nova flavor
  • keypair (object) – nova keypair
  • security_group (obj) – nova security group
  • net_subnet_router (tuple) – neutron network, subnet, router
  • server_steps (ServerSteps) – instantiated server steps
Returns:

nova server

Return type:

object

stepler.nova.conftest.ubuntu_server_to_rebuild(request, keypair, flavor, security_group, ubuntu_image, net_subnet_router, volume_steps, server_steps)[source]

Fixture to create Ubuntu server for nova rebuild tests.

In some test cases for ‘nova rebuild’ actions we need a proper cloud-init behavior (e.g. file injection operation), which cannot be guaranteed by cirros-based images and servers booted from them. This fixture creates a server which can be booted from ubuntu image or ubuntu-based volume with parametrization. Default is boot from image.

Example

@pytest.mark.parametrized('ubuntu_server_to_rebuild', [
        {'boot_from_volume': True},
        {'boot_from_volume': False}
    ], indirect=True)
def test_foo(ubuntu_server_to_rebuild):
    pass
Parameters:
  • request (obj) – pytest SubRequest instance
  • keypair (obj) – keypair
  • flavor (obj) – flavor
  • security_group (obj) – security group
  • ubuntu_image (obj) – ubuntu image
  • net_subnet_router (tuple) – neutron network, subnet and router
  • volume_steps (obj) – instantiated volume steps
  • server_steps (obj) – instantiated server steps
Returns:

nova server

Return type:

object

stepler.nova.conftest.unexpected_servers_cleanup()[source]

Callable function fixture to clear unexpected servers.

It provides cleanup before and after test. Cleanup before test is callable with injecton of server steps. Should be called before returning of instantiated server steps.

Nova steps

class stepler.nova.steps.AggregateSteps(client)[source]

Aggregate steps.

add_host(aggregate, host_name, check=True)[source]

Step to add host to an aggregate.

Parameters:
  • aggregate (object) – nova aggregate
  • host_name (str) – host name
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

check_aggregate_presence(aggregate, must_present=True, timeout=0)[source]

Verify step to check aggregate is present or not.

Parameters:
  • aggregate (object) – nova aggregate to check presence status
  • must_present (bool) – flag whether aggregate should present or not
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check was triggered to False after timeout

create_aggregate(aggregate_name=None, availability_zone='nova', check=True)[source]

Step to create nova aggregate.

Parameters:
  • aggregate_name (str) – name of nova aggregate
  • availability_zone (str) – availability zone
  • check (bool) – flag whether to check step or not
Retuns:
object: nova aggregate
Raises:TimeoutExpired – if aggregate is not created
delete_aggregate(aggregate, check=True)[source]

Step to delete aggregate.

Parameters:
  • aggregate (object) – nova aggregate
  • check (bool) – flag whether to check step or not
remove_host(aggregate, host_name, check=True)[source]

Step to remove host from an aggregate.

Parameters:
  • aggregate (object) – nova aggregate
  • host_name (dict) – key/value pairs to be set
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

set_metadata(aggregate, metadata, check=True)[source]

Step to set metadata on an aggregate.

Parameters:
  • aggregate (object) – nova aggregate
  • metadata (dict) – key/value pairs to be set
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

class stepler.nova.steps.AvailabilityZoneSteps(client)[source]

Availability zone steps.

check_all_active_hosts_available(zone_name='nova')[source]

Checks that all active nova hosts for zone are available.

Nova checks hosts status with some interval. To prevent checking on outdated hosts data this method wait for updated_at host’s attribute to be changed.

Parameters:

zone_name (str) – zone name

Raises:
  • AssertionError – if not all hosts are active
  • TimeoutExpired – if there is no updates for hosts
get_zone(check=True, **kwargs)[source]

Step to find one zone matching **kwargs.

Parameters:
  • check (bool) – flag whether to check step or not
  • **kwargs – like: {‘zoneName’: ‘nova’}, {‘zoneState’: {u’available’: True}}
Returns:

nova zone

Return type:

object

get_zones(check=True, **kwargs)[source]

Step to find all zones matching **kwargs.

Parameters:
  • check (bool) – flag whether to check step or not
  • **kwargs – like: {‘zoneName’: ‘nova’}, {‘zoneState’: {u’available’: True}}
Returns:

nova zones

Return type:

list

class stepler.nova.steps.FlavorSteps(client)[source]

Flavor steps.

check_flavor_presence(flavor, must_present=True, timeout=0)[source]

Verify step to check flavor is present.

Parameters:
  • flavor (object) – nova flavor to check presence status
  • must_present (bool) – flag whether flavor should present or not
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check was triggered to False after timeout

create_flavor(flavor_name=None, ram=1024, vcpus=1, disk=5, flavorid='auto', ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True, check=True)[source]

Step to create flavor.

Parameters:
  • flavor_name (str) – Descriptive name of the flavor
  • ram (int) – Memory in MB for the flavor
  • vcpus (int) – Number of VCPUs for the flavor
  • disk (int) – Size of local disk in GB
  • flavorid (str) – ID for the flavor (optional). You can use the reserved value "auto" to have Nova generate a UUID for the flavor in cases where you cannot simply pass None.
  • ephemeral (int) – Ephemeral space in MB
  • swap (int) – Swap space in MB
  • rxtx_factor (float) – RX/TX factor
  • is_public (bool) – flag whether flavor should be public or not
  • check (bool) – flag whether to check step or not
Retuns:
object: flavor object
delete_flavor(flavor, check=True)[source]

Step to delete flavor.

Parameters:
  • flavor (object) – nova flavor
  • check (bool) – flag whether to check step or not
get_flavor(check=True, **kwgs)[source]

Step to find a single item with attributes matching **kwgs.

Parameters:
  • check (bool) – flag whether to check step or not
  • **kwgs (dict, optional) –

    could be:

    • name (str): Descriptive name of the flavor
    • ram (int): Memory in MB for the flavor
    • vcpus (int): Number of VCPUs for the flavor
    • disk (int): Size of local disk in GB
    • id (str): ID for the flavor (optional). You can use the reserved value "auto" to have Nova generate a UUID for the flavor in cases where you cannot simply pass None.
    • OS-FLV-EXT-DATA (int): Ephemeral space in MB
    • swap (int): Swap space in MB
    • rxtx_factor (float): RX/TX factor
    • os-flavor-access (bool): flag whether flavor should be public or not
    • check (bool): flag whether to check step or not
Returns:

nova flavor

Return type:

object

get_flavors(check=True, **kwgs)[source]

Step to find all items with attributes matching **kwgs.

Parameters:
  • check (bool) – flag whether to check step or not
  • **kwgs (dict, optional) –

    could be:

    • name (str): Descriptive name of the flavor
    • ram (int): Memory in MB for the flavor
    • vcpus (int): Number of VCPUs for the flavor
    • disk (int): Size of local disk in GB
    • id (str): ID for the flavor (optional). You can use the reserved value "auto" to have Nova generate a UUID for the flavor in cases where you cannot simply pass None.
    • OS-FLV-EXT-DATA (int): Ephemeral space in MB
    • swap (int): Swap space in MB
    • rxtx_factor (float): RX/TX factor
    • os-flavor-access (bool): flag whether flavor should be public or not
    • check (bool): flag whether to check step or not
Returns:

nova flavor object(s)

Return type:

list

get_metadata(flavor, check=True)[source]

Step to get metadata on a flavor.

Parameters:
  • flavor (object) – nova flavor
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

Returns:

key/value pairs

Return type:

dict

set_metadata(flavor, metadata, check=True)[source]

Step to set metadata on a flavor.

Parameters:
  • flavor (object) – nova flavor
  • metadata (dict) – key/value pairs to be set
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

class stepler.nova.steps.FloatingIpSteps(client)[source]

Floating IP steps.

check_floating_ip_presence(floating_ip, present=True, timeout=0)[source]

Verify step to check floating IP is present.

create_floating_ip(check=True)[source]

Step to create floating IP.

delete_floating_ip(floating_ip, check=True)[source]

Step to delete floating IP.

class stepler.nova.steps.HostSteps(client)[source]

Host steps.

check_host_usage_changing(host, usage_data_old, changed=True, project_id=None)[source]

Step to check changes in host usages (cpu/memory/hdd)

This step gets current usage data and compares them with old data. There are two modes of checks: changes are expected or not. Depending on it, values must be different or equal. Also, this step can check project ID in host usage.

The following data are checked: - cp, memory_mb, disk_gb (for ‘used now’ and ‘used max’) - project ID (optional)

Parameters:
  • host (object) – host
  • usage_data_old (object) – usage data got before
  • changed (bool|True) – indicator that some VMs are added/deleted
  • project_id (str|None) – project id of VMs created before (optional)
Raises:

AssertionError

get_host(name=None, fqdn=None, check=True)[source]

Step to get host by name of FQDN.

Host object consists of ‘host_name’, ‘service’ and ‘zone’. If there are several hosts with the same host_name, then any host with proper name is returned. If not arguments are specified that means any host is suitable.

Parameters:
  • name (str) – host name
  • fqdn (str) – FQDN of host
  • check (bool, optional) – flag whether to check step or not
Returns:

host object

Return type:

object

Raises:

AssertionError – if host is not found

get_hosts(check=True)[source]

Step to get hosts.

Parameters:check (bool, optional) – flag whether to check step or not
Returns:list of hosts objects
Return type:list
Raises:AssertionError – if hosts list is empty
get_usage_data(host, check=True)[source]

Step to get cpu/memory/hdd data for host.

# usage_data is the list of the following elements: # elem 0 - ‘total’ data, 1 - ‘used now’ data, 2 - ‘used max’ data # next elements - for VMs (one element per project) # Every element consists of project, cpu, memory_mb, disk_gb etc.

Parameters:
  • host (object) – host
  • check (bool, optional) – flag whether to check step or not
Raises:

AssertionError – if usage data has less than 3 elements

class stepler.nova.steps.HypervisorSteps(client)[source]

Hypervisor steps.

get_another_hypervisor(servers, check=True)[source]

Step to get any hypervisor except occupied by servers.

Parameters:
  • servers (list) – nova servers list
  • check (bool, optional) – flag whether to check step or not
Returns:

nova hypervisor

Return type:

obj

Raises:

ValueError – if there is no one hypervisor except occupied by servers

get_hypervisor_capacity(hypervisor, flavor, check=True)[source]

Step to get hypervisor capacity.

This method calculates max available count of instances, which can be booted on hypervisor with choosen flavor.

Parameters:
  • hypervisor (obj) – nova hypervisor
  • flavor (obj) – nova flavor
  • check (bool) – flag whether to check step or not
Returns:

possible instances count

Return type:

int

Raises:

AssertionError – if capacity equal or less zero.

get_hypervisors(check=True)[source]

Step to get hypervisors.

Parameters:check (bool) – flag whether to check step or not
Returns:list of hyervisors objects
Return type:list
Raises:AssertionError – if hypervisors list are empty
class stepler.nova.steps.KeypairSteps(client)[source]

Keypair steps.

check_keypairs_presence(keypairs, must_present=True, keypair_timeout=0)[source]

Step to check keypairs presence status.

Parameters:
  • keypairs (list) – Keypairs to check.
  • must_present (bool, optional) – Flag whether keypairs must present or not.
  • timeout (int, optional) – Seconds to wait check result.
Raises:

TimeoutExpired – If check failed after timeout.

create_keypairs(names=None, count=1, public_key=None, check=True)[source]

Step to create keypairs.

Parameters:
  • names (list, optional) – Names of creating keypairs.
  • count (int, optional) – Count of creating keypairs, omitted if names is specified.
  • public_key (str, optional) – Existing public key to import.
  • check (bool, optional) – Flag whether to check step or not.
Returns:

Keypairs collection.

Return type:

list

Raises:

TimeoutExpired | AssertionError – If check failed.

delete_keypairs(keypairs, check=True)[source]

Step to delete keypairs.

Parameters:
  • keypairs (list) – Keypairs to delete.
  • check (bool, optional) – Flag whether to check step or not.
Raises:

TimeoutExpired – If check failed.

get_keypairs(name_prefix=None, check=True)[source]

Step to get keypairs.

Parameters:
  • name_prefix (str, optional) – Name prefix to filter keypairs.
  • check (bool, optional) – Flag whether to check step or not.
Returns:

Keypairs collection.

Return type:

list

Raises:

AssertionError – If check failed.

class stepler.nova.steps.SecurityGroupSteps(client)[source]

Security group steps.

add_group_rules(group, rules, check=True)[source]

Step to add rules to security group.

check_group_presence(group, present=True, timeout=0)[source]

Verify step to check security group is present.

check_rule_presence(group, rule, present=True, timeout=0)[source]

Verify step to check security group rule is present.

create_group(group_name, description='description', check=True)[source]

Step to create security group.

Parameters:
  • group_name (str) – security group name
  • description (str, optional) – security group description
  • check (bool, optional) – flag whether to check this step or not
Returns:

security group

Return type:

obj

Raises:

AssertionError – if check failed

delete_group(group, check=True)[source]

Step to delete security group.

remove_group_rules(group, rules, check=True)[source]

Step to remove rule from security group.

class stepler.nova.steps.NovaVolumeSteps(client)[source]

Server volumes steps.

attach_volume_to_server(server, volume, device='/dev/vdb', check=True)[source]

Step to attach volume to server

Parameters:
  • server (object) – nova server
  • volume (object) – cinder volume
  • device (str) – device name
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

check_volume_to_server_attachment_status(server, volume, is_attached=True, timeout=0)[source]

Verify step to check status of server volume.

Parameters:
  • server (object) – nova server
  • volume (object) – cinder volume
  • is_attached – expected state - True (present) or False (missing)
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

detach_volume_from_server(server, volume, check=True)[source]

Step to detach volume from server

Parameters:
  • server (object) – nova server
  • volume (object) – cinder volume
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

class stepler.nova.steps.ServerSteps(client)[source]

Nova server steps.

attach_fixed_ip(server, network_id, check=True)[source]

Step to attach fixed IP from provided network to provided server.

Parameters:
  • server (object) – nova server to attach fixed ip
  • network_id (str) – the ID of the network the IP should be on
  • check (bool) – flag whether to check step or not
Returns:

IF check=True, returns new fixed IP address None: IF check=False

Return type:

str

Raises:

TimeoutExpired – if check failed after timeout

attach_floating_ip(server, floating_ip, check=True)[source]

Step to attach floating IP to server.

Parameters:
  • server (object) – nova server
  • floating_ip (object|dict) – floating IP
  • check (bool, optional) – flag whether to check step or not
Raises:

AssertionError – if floating IP is not attached to a server

check_active_ssh_connection(server_ssh, must_operable=True, timeout=0)[source]

Step to check active ssh connection.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection
  • must_operable (bool, optional) – flag whether server_ssh should be operable or not
  • timeout (int) – seconds to wait a result of check
Raises:
  • RuntimeError – if server_ssh is closed
  • TimeoutExpired – if check failed after timeout
check_arping_loss_context(server_ssh, ip, iface='eth0', max_loss=0)[source]

Step to check that arping losses inside CM is less than max_loss.

Parameters:
  • server_ssh (SshClient) – instance of ssh client
  • ip (str) – ip address to ping
  • iface (str, optional) – name of interface to arping
  • max_loss (int) – maximum allowed pings loss
Raises:

AssertionError – if ping loss is greater than max_loss

check_create_server_negative(image, flavor, networks=(), keypair=None, security_groups=None, availability_zone='nova', exp_exception=None, exp_error_message=None)[source]

Step to check server creation with wrong conditions.

This step checks that some error occurs during server creation: exception or server status = ERROR.

Parameters:
  • image (object) – image
  • flavor (object) – flavor
  • networks (list) – networks objects
  • keypair (object) – keypair
  • security_groups (list|tuple) – security groups
  • availability_zone (str) – name of availability zone
  • exp_exception (Exception, optional) – expected exception
  • exp_error_message (str, optional) – expected message (status=ERROR)
check_dhcp_on_cirros_server(cirros_server)[source]

Step to check DHCP on cirros server.

Parameters:cirros_server (object) – nova server
Raises:TimeoutExpired – if check failed after ssh timeout
check_files_presence_for_path(server_ssh, fs_path, must_present=True)[source]

Verify step to check that fs doesn’t contain any files.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • fs_path (str) – directory path to check files within or file path to check presence
  • must_present (bool) – flag whether fs should have any files or not
Raises:

AssertionError – if check failed

check_fixed_id_ping_loss_context(ip_to_ping, icmp_id, server, max_loss=0)[source]

Step to check that ping losses inside CM is less than max_loss.

Note

This method required ping binary which supports icmp_id parameter.

Parameters:
  • ip_to_ping (str) – ip address to ping
  • icmp_id (int) – desired id of icmp packets
  • server (obj) – nova server
  • max_loss (int) – maximum allowed pings loss
Raises:

AssertionError – if ping loss is greater than max_loss

check_iperf_loss_context(server_ssh, ip, port, time=60, max_loss=0)[source]

Step to check that iperf loss inside CM is less than max_loss.

Note

This step requires to iperf server will be launched with listening for UDP protocol.

Parameters:
  • server_ssh (obj) – instance of stepler.third_party.ssh.SshClient
  • ip (str) – iperf server ip address
  • port (int) – iperf server port
  • time (int, optional) – time to generate traffic
  • max_loss (float) – maximum allowed datagramm loss in percents
Raises:

AssertionError – if iperf loss is greater than max_loss

check_metadata_presence(server, custom_meta, present=True, timeout=0)[source]

Step to check if server’s metadata contains OR NOT contains provided values.

Parameters:
  • server (object) – nova server
  • custom_meta (dict) – data, which presence should be checked in server’s metadata. Like: {‘key’: ‘stepler_test’}
  • present (bool) – flag to check if provided data should OR should NOT present in server’s metadata.
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

check_no_arping_for_ip(server_ssh, ip, iface='eth0', count=1)[source]

Verify step to check arping for ip.

Parameters:
  • server_ssh (SshClient) – instance of ssh client
  • ip (str) – ip address to ping
  • iface (str, optional) – name of interface to arping
  • count (int, optional) – count of packets to send
Raises:

AssertionError – if some of packets are unperlied

check_no_fixed_id_ping_context(ip_to_ping, icmp_id, server)[source]

Step to check that ping is not success inside CM.

Note

This method required ping binary which supports icmp_id parameter.

Parameters:
  • ip_to_ping (str) – ip address to ping
  • icmp_id (int) – desired id of icmp packets
  • server (obj) – nova server
Raises:

AssertionError – if ping received is not equal to 0

check_no_ping_context(ip_to_ping, server_ssh=None)[source]

Step to check that ping is not success inside CM.

Parameters:
  • ip_to_ping (str) – ip address to ping
  • server_ssh (obj, optional) – instance of stepler.third_party.ssh.SshClient. If None - ping will be run from local machine
Raises:

AssertionError – if ping received is not equal to 0

check_ping_between_servers_via_floating(servers, ip_types=('floating', 'fixed'), timeout=0)[source]

Step to check ping from each server to all other servers.

This function uses floating ips of servers to connect to them and then send pings to other servers according to ‘ip_types’ parameter.

Parameters:
  • servers (list) – nova servers to check ping between them
  • ip_types (tuple) – types of ip addresses which should be pinged
  • timeout (int) – seconds to wait for result of check
Raises:

TimeoutExpired – if check failed after timeout

check_ping_by_plan(ping_plan, timeout=0)[source]

Step to check ping using ping plan dict.

Parameters:
  • ping_plan (dict) – servers and lists of ips/tuples(server, ip_type)/servers to ping
  • timeout (int) – seconds to wait for result of check
Raises:

TimeoutExpired – if check failed after timeout

check_ping_for_ip(ip_to_ping, remote_from=None, ping_count=3, must_be_success=True, timeout=0)[source]

Verify step to check ping for ip from remote or local host.

Parameters:
  • ip_to_ping (str) – nova server to ping its floating ip
  • remote_from (object|None) – instance of stepler.third_party.ssh.SshClient. If None - ping executing from local host.
  • ping_count (int) – count of attempts to ping
  • must_be_success (bool) – should ping loss be 0 (if must_be_success is True) or ping received should be 0 (otherwise)
  • timeout (int) – seconds to wait for success ping
Raises:

TimeoutExpired – if check failed after timeout

check_ping_loss_context(ip_to_ping, max_loss=0, server_ssh=None, connect_restore_timeout=None)[source]

Step to check that ping losses inside CM is less than max_loss.

Parameters:
  • ip_to_ping (str) – ip address to ping
  • max_loss (int) – maximum allowed pings loss
  • server_ssh (obj, optional) – instance of stepler.third_party.ssh.SshClient. If None - ping will be run from local machine
  • connect_restore_timeout (int, optional) – time in seconds to wait for connection to be restored before CM exit
No Longer Raises:
AssertionError: if ping loss is greater than max_loss
check_ping_to_server_floating(server, timeout=0)[source]

Verify step to check ping to server floating ip address.

Each instance has a private, fixed IP address and can also have a public, or floating IP address. Private IP addresses are used for communication between instances, and public addresses are used for communication with networks outside the cloud, including the Internet.

Parameters:
  • server (object) – nova server to ping its floating ip
  • timeout (int) – seconds to wait for result of check
Raises:

TimeoutExpired – if check failed after timeout

check_qcow_image_for_server(server_ssh, filename)[source]

Step to check that qcow image exists.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • filename (str) – name of image to check
Raises:

AssertionError – if check failed

check_server_attribute(server, attr, value, equal=True, timeout=0)[source]

Verify step to check that server’s attribute has an expected value.

Parameters:
  • server (object) – nova server to check its attribute defined in arguments
  • attr (str) – name of server’s attribute
  • value (str) –
  • equal (bool) – flag whether servers’s attribute should be equal to value or not
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

check_server_doesnot_detach_unattached_fixed_ip(server, unattached_fixed_ip)[source]
Step to check that server will raise exception if we try to detach
not attached to it fixed IP.
Parameters:
  • server (object) – nova server to delete fixed ip
  • unattached_fixed_ip (str) – Unattached Fixed IP address
Raises:

AssertionError – if error didn’t raise

check_server_host_attr(server, host_name=None, host_names=None, equal=True, timeout=0)[source]

Verify step to check server’s host attribute value.

There are several modes of check: - host name must be equal to a value - host name must be not equal to a value - host name must be equal to a value from list - host name must be not equal to values of list

Parameters:
  • server (object) – nova server
  • host_name (str, optional) – host name to compare with server’s host
  • host_names (list, optional) – host names to compare with server’s host. It’s ignored if host_name is set.
  • equal (bool) – flag whether servers’s host should be equal to host_name or not
  • timeout (int) – seconds to wait result of check
Raises:

TimeoutExpired – if check failed after timeout

check_server_ip(server, ip, must_present=True, timeout=0)[source]

Step to check that server has (or not) IP address.

Parameters:
  • server (object) – nova server
  • ip (str) – ip address
  • must_present (bool, optional) – flag whether server should contain ip or not
  • timeout (int, optional) – seconds to wait result of check
Raises:

TimeoutExpired – if check failed after timeout

check_server_log_contains_record(server, substring, timeout=0)[source]

Verify step to check server log contains substring.

Parameters:
  • server (object) – nova server
  • substring (str) – substring to match
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

check_server_not_rebuilt_in_paused_state(paused_server, image)[source]

Step to check server will not be rebuilt in Paused state.

Parameters:
  • paused_server (obj) – server to be set to Paused state
  • image (object) – image used for instance rebuild
Raises:

AssertionError – if check failed

check_server_not_rebuilt_in_rescue_state(rescue_server, image)[source]

Step to check server will not be rebuilt in Rescue state.

Parameters:
  • rescue_server (obj) – server to be set to Rescue state
  • image (object) – image used for instance rebuild
Raises:

AssertionError – if check failed

check_server_presence(server, present=True, timeout=0)[source]

Check-step to check server presence.

Parameters:
  • server (object) – nova server
  • present (bool) – flag to check is server present or absent
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

check_server_status(server, expected_statuses, transit_statuses=(), timeout=0)[source]

Verify step to check server status.

Parameters:
  • server (object) – nova server to check its status
  • expected_statuses (list) – expected server statuses
  • transit_statuses (iterable) – allowed transit statuses
  • timeout (int) – seconds to wait a result of check
Raises:

TimeoutExpired – if check failed after timeout

check_servers_actions_not_available(timeout=0)[source]

Step to check that servers actions are not available.

This step checks that some exception occurs when getting server list during some time period.

Parameters:timeout (int) – seconds to wait exception
Raises:TimeoutExpired – if no exception occurs during timeout
check_servers_not_evacuated_in_paused_state(paused_servers)[source]

Step to check servers will not be evacuated in Paused state.

Parameters:paused_servers (list) – servers to be set to Paused state
Raises:AssertionError – if check failed
check_servers_not_evacuated_in_rescue_state(rescue_servers)[source]

Step to check servers will not be evacuated in Rescue state.

Parameters:rescue_servers (list) – servers to be set to Rescue state
Raises:AssertionError – if check failed
check_servers_not_evacuated_in_resized_state(resized_servers)[source]

Step to check servers will not be evacuated in Resized state.

Parameters:resized_servers (list) – servers to be set to Resized state
Raises:AssertionError – if check failed
check_servers_not_evacuated_in_shelved_state(shelved_servers)[source]

Step to check servers will not be evacuated in Shelved state.

Parameters:shelved_servers (list) – servers to be set to Shelved state
Raises:AssertionError – if check failed
check_servers_not_evacuated_to_initial_compute(servers_to_evacuate, host)[source]

Step to check servers will not be evacuated to initial compute.

Parameters:
  • servers_to_evacuate (list) – servers to be evacuated
  • host (str) – target host, must be equal to failed compute’s hostname
Raises:

AssertionError – if check failed

check_timestamps_on_root_and_ephemeral_disks(server_ssh, timestamp)[source]

Verify step to check timestamp on root and ephemeral disks

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • timestamp (str) – timestamp to check
Raises:

AssertionError – if timestamp on root and ephemeral are not equal

confirm_resize_servers(servers, check=True)[source]

Step to confirm resize for servers

Parameters:
  • servers (list) – nova servers to confirm resize
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

create_empty_file_on_server(server_ssh, file_dir, check=True)[source]

Step to create empty file on the server.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • file_dir (str) – directory to create file
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

create_qcow_image_for_server(server_ssh, eph_dev, root_dev, image_size, check=True)[source]

Step to create qcow image for server.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • eph_dev (str) – ephemeral device
  • root_dev (str) – root device
  • image_size (str) – image size
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

create_servers(image, flavor, server_names=None, count=1, networks=(), ports=(), keypair=None, security_groups=None, availability_zone='nova', block_device_mapping=None, username=None, password=None, userdata=None, nics=None, check=True)[source]

Step to create servers.

Parameters:
  • image (object|None) – image or None (to use volume)
  • flavor (object) – flavor
  • server_names (list) – names of created servers
  • count (int) – count of created servers, it’s ignored if server_names is specified; one server is created if both args are missing
  • networks (list) – networks objects
  • ports (list) – ports objects
  • keypair (object) – keypair
  • security_groups (list|tuple) – security groups
  • availability_zone (str) – name of availability zone
  • block_device_mapping (dict|None) – block device mapping for servers
  • username (str) – username to store with server metadata
  • password (str) – password to store with server metadata
  • userdata (str) – userdata (script) to execute on instance after boot
  • nics (list, optional) – An ordered list of nics (dicts) to be added to this servers, with information about connected networks, fixed IPs, port etc.
  • check (bool) – flag whether to check step or not
Returns:

nova servers

Return type:

list

create_timestamps_on_root_and_ephemeral_disks(server_ssh, timestamp, check=True)[source]

Step to create timestamp on root and ephemeral disks

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • timestamp (str) – timestamp to store on files
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if timestamp on root and ephemeral are not equal

delete_servers(servers, force=False, check=True)[source]

Step to delete servers.

Parameters:
  • servers (obj) – nova servers’ list
  • force (bool, optional) – flag whetever to run force or soft deleting
  • check (bool, optional) – flag whether to check step or not
detach_fixed_ip(server, fixed_ip=None, check=True)[source]

Step to detach provided fixed IP from provided server.

Parameters:
  • server (object) – nova server to delete fixed ip
  • fixed_ip (str) – Fixed IP address
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

detach_floating_ip(server, floating_ip, check=True)[source]

Step to detach floating IP from server.

Parameters:
  • server (object) – nova server
  • floating_ip (object|dict) – floating IP
  • check (bool, optional) – flag whether to check step or not
Raises:

AssertionError – if floating IP is still attached to a server

evacuate_servers(servers, host=None, check=True)[source]

Step to evacuate servers from failed host

Parameters:
  • servers (obj) – servers to evacuate
  • host (str) – target host
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

execute_commands(server, commands, with_sudo=False, command_timeout=30, check=True)[source]

Step to execute commands on server via SSH.

Parameters:
  • server (object) – nova server
  • commands (list) – sequence of commands to execute on server
  • with_sudo (bool, optional) – flag whether to execute commands with sudo or not
  • command_timeout (int) – seconds to wait executing command will be finished
  • check (bool, optional) – flag whether to check step or not
Raises:

RuntimeError – if check failed

Returns:

stdout of last command from sequence

Return type:

str

generate_server_cpu_workload(remote, check=True)[source]

Step to start server CPU workload.

Parameters:
  • remote (object) – instance of stepler.third_party.ssh.SshClient
  • check (bool) – flag whether to check step or not
Raises:

Exception – if command exit code is not 0

generate_server_disk_workload(remote, check=True)[source]

Step to start server disk workload.

This step makes about 95% load on disk.

Parameters:
  • remote (object) – instance of stepler.third_party.ssh.SshClient
  • check (bool) – flag whether to check step or not
Raises:

Exception – if command exit code is not 0

generate_server_memory_workload(remote, vm_bytes='5M', check=True)[source]

Step to start server memory workload.

Parameters:
  • remote (object) – instance of stepler.third_party.ssh.SshClient
  • vm_bytes (str) – malloc vm_bytes bytes per vm worker
  • check (bool) – flag whether to check step or not
get_block_device_by_mount(server_ssh, fs_path, check=True)[source]

Step to retrieve block device which is mounted to the path.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • fs_path (str) – fs path to find block device
  • check (bool) – flag whether to check step or not
Returns:

device for fs_path

Return type:

str

Raises:

AssertionError – if check failed

get_fixed_ip(server, check=True)[source]

Step to get one server fixed IP for the server.

Parameters:
  • server (object) – nova server
  • check (bool, optional) – flag whether to check step or not
Returns:

retrieved fixed IP

Return type:

str

Raises:

AssertionError – if no retrieved IPs

get_floating_ip(server, check=True)[source]

Step to get one server floating IP for the server.

Parameters:
  • server (object) – nova server
  • check (bool, optional) – flag whether to check step or not
Returns:

retrieved floating IP

Return type:

str

Raises:

AssertionError – if no retrieved IPs

get_ips(server, ip_type=None, check=True)[source]

Step to get server IPs.

Parameters:
  • server (object) – nova server
  • ip_type (str, optional) – type of IP to filter IPs
  • check (bool, optional) – flag whether to check step or not
Returns:

Retrieved IPs.

Return type:

dict

Raises:

AssertionError – If no retrieved IPs.

get_server_credentials(server)[source]

Step to retrieve server credentials.

Parameters:server (object) – nova server object
Returns:dict with username, password and (optionally) private_key
Return type:dict
get_server_ssh(server, ip=None, proxy_cmd=None, credentials=None, ssh_timeout=60, check=True)[source]

Step to get SSH connect to server.

Parameters:
  • server (object) – nova server
  • ip (str) – ip of server
  • proxy_cmd (str) – ssh client proxy command
  • credentials (dict) – dict with username, password and private_key
  • ssh_timeout (int) – timeout to establish ssh connection
  • check (bool) – flag whether to check step or not
Returns:

instantiated ssh client to server ip

Return type:

ssh.SshClient

Raises:

TimeoutExpired – if check failed after timeout

get_servers(name_prefix=None, check=True)[source]

Step to retrieve servers from nova.

Parameters:
  • name_prefix (str) – prefix of server names to get
  • check (bool) – flag whether to check step or not
Returns:

server list

Return type:

list

live_migrate(servers, host=None, block_migration=True, check=True)[source]

Step to live migrate nova servers.

Parameters:
  • servers (list) – nova servers to migrate
  • host (str) – hypervisor’s hostname to migrate to
  • block_migration (bool) – should nova use block or true live migration
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

lock_server(server, check=True)[source]

Step to lock server.

Parameters:
  • server (obj) – nova server to lock
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

migrate_servers(servers, check=True)[source]

Step to migrate servers

Parameters:
  • servers (list) – nova servers to migrate
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

pause_server(server, check=True)[source]

Step to pause nova server.

Parameters:
  • server (object) – nova server to pause
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

reboot_server(server, reboot_type='SOFT', check=True)[source]

Step to reboot nova server.

Parameters:
  • server (obj) – nova server
  • reboot_type (str) – REBOOT_SOFT for a software-level reboot, or REBOOT_HARD for a virtual power cycle hard reboot
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

rebuild_server(server, image, check=True, **kwargs)[source]

Step to rebuild nova server.

Parameters:
  • server (object) – nova server to rebuild
  • image (object) – image used for server rebuild
  • check (bool) – flag whether to check step or not
  • kwargs – Additional filters to pass
Raises:

TimeoutExpired – if check failed after timeout

rescue_server(server, check=True)[source]

Step to rescue nova server.

Parameters:
  • server (object) – nova server to rescue
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

resize(server, flavor, check=True)[source]

Step to resize server.

Parameters:
  • server (object) – nova server
  • flavor (object) – flavor object
  • check (bool) – flag whether check step or not
restore_server(server, check=True)[source]

Step to restore soft-deleted server.

Parameters:
  • server (object) – nova server
  • check (bool) – flag whether to check step or not
server_network_listen(remote, port=5010, check=True)[source]

Step to start server TCP connection listening.

Parameters:
  • remote (object) – instance of stepler.third_party.ssh.SshClient
  • port (int) – port to send traffic
  • check (bool) – flag whether to check step or not
shelve_server(server, check=True)[source]

Step to shelve server.

Parameters:
  • server (obj) – nova server to shelve
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

start_server(server, check=True)[source]

Step to start server.

Parameters:
  • server (obj) – nova server
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

stop_server(server, check=True)[source]

Step to stop server.

Parameters:
  • server (obj) – nova server
  • check (bool) – flag whether to check step or not
Raises:

TimeoutExpired – if check failed after timeout

unmount_fs_for_server(server_ssh, fs_path, check=True)[source]

Step to unmount fs for server.

Parameters:
  • server_ssh (ssh.SshClient) – ssh connection to nova server
  • fs_path (str) – fs path to unmount
  • check (bool) – flag whether to check step or not
Raises:

AssertionError – if check failed

class stepler.nova.steps.NovaServiceSteps(client)[source]

Nova service steps.

check_service_states(services, timeout=0)[source]

Step to check states of nova services.

This step checks that the current states of nova services are equal to expected ones.

Parameters:
  • services (list) – list of nova services
  • timeout (int) – seconds to wait result of check
Raises:

TimeoutExpired – if check failed after timeout

check_services_up(host_names=None, timeout=0)[source]

Step to check that nova services are up.

If host_names is specified service states atr checked only on these hosts.

Parameters:
  • host_names (list, optional) – list of host names
  • timeout (int, optional) – seconds to wait result of check
Raises:

TimeoutExpired – if check failed after timeout

get_services(check=True)[source]

Step to get nova services.

Parameters:check (bool, optional) – flag whether check step or not
Returns:list of nova services
Return type:list
Raises:AssertionError – if service list is empty
class stepler.nova.steps.NovaLimitSteps(client)[source]

Limits steps.

get_absolute_limits(check=True, **kwgs)[source]

Step to get absolute limits.

Parameters:
  • check (bool) – flag whether to check step or not
  • **kwgs (dict, optional) – additional arguments to pass to API
Returns:

AbsoluteLimit objects

Return type:

list

Raises:

AssertionError – if limits list is empty

Nova tests

Nova basic verification tests

stepler.nova.tests.test_basic_verification.test_absolute_limits_list(nova_limit_steps)[source]

Scenario: Request list of absolute limits.

Steps:

  1. Get list of absolute limits
stepler.nova.tests.test_basic_verification.test_attach_detach_fixed_ip_to_server(flavor, security_group, keypair, cirros_image, net_subnet_router, create_floating_ip, server_steps)[source]

Scenario: Check server connectivity after attach/detach fixed IP.

Setup:

  1. Create flavor
  2. Create security_group
  3. Create keypair
  4. Upload cirros image
  5. Create network with subnet and router

Steps:

  1. Boot two servers from cirros image
  2. Create two nova floating ips
  3. Attach floating IP to each server
  4. Check that each server’s IP address can be pinged from other server
  5. Attach new fixed IP to 1’st server
  6. Detach old fixed IP from 1’st server
  7. Check that new 1’st server’s fixed IP can be pinged from 2’nd server.

Teardown:

  1. Delete servers
  2. Delete flavor
  3. Delete security_group
  4. Delete keypair
  5. Delete cirros image
  6. Delete floating IPs
  7. Delete network, subnet, router
stepler.nova.tests.test_basic_verification.test_boot_instance_from_volume_bigger_than_flavor(flavor, security_group, floating_ip, cirros_image, net_subnet_router, volume_steps, server_steps)[source]

Scenario: Boot instance from volume bigger than flavor size.

This test verifies bug #1517671

Setup:

  1. Upload cirros image
  2. Create network
  3. Create subnet
  4. Create router
  5. Create security group with allow ping rule
  6. Create flavor

Steps:

  1. Set router default gateway to public network
  2. Add router interface to created network
  3. Create volume from cirros image with disk size bigger than flavor
  4. Boot server from volume
  5. Assign floating ip to server
  6. Check that ping to server’s floating ip is successful

Teardown:

  1. Delete server
  2. Delete flavor
  3. Delete security group
  4. Delete router
  5. Delete subnet
  6. Delete network
  7. Delete cirros image
stepler.nova.tests.test_basic_verification.test_create_delete_flavor(flavor_steps)[source]

Scenario: Check flavor can be created and deleted.

Steps:

  1. Create flavor
  2. Delete flavor
stepler.nova.tests.test_basic_verification.test_create_delete_keypair(keypair)[source]

Scenario: Check that keypair can be created and deleted.

Steps:

  1. Create keypair
  2. Delete keypair
stepler.nova.tests.test_basic_verification.test_create_many_servers_boot_from_cinder(cirros_image, flavor, network, subnet, security_group, volume_steps, server_steps, volumes_count)[source]

Scenario: Boot many servers from volumes.

Setup:

  1. Upload cirros image
  2. Create flavor
  3. Create network
  4. Create subnet
  5. Create security group with allow ping rule

Steps:

  1. Create 10 cinder volumes from cirros image
  2. Boot 10 servers from volumes

Teardown:

  1. Delete servers
  2. Delete volumes
  3. Delete security group
  4. Delete subnet
  5. Delete network
  6. Delete flavor
  7. Delete cirros image
stepler.nova.tests.test_basic_verification.test_delete_instance_during_resizing(cirros_image, network, subnet, create_flavor, server_steps, os_faults_steps)[source]

Scenario: Verify that nova can delete servers in resize state.

Note:
This test verifies bug #1489775

Setup:

  1. Upload cirros image
  2. Create network
  3. Create subnet

Steps:

  1. Create 2 flavors
  2. Boot server with smaller flavor
  3. Resize server to bigger flavor
  4. Delete server immediately after its state will be ‘RESIZE’
  5. Check that server’s compute doesn’t contains deleted server artifacts
  6. Repeat last 3 steps some times

Teardown:

  1. Delete server
  2. Delete flavors
  3. Delete subnet
  4. Delete network
  5. Delete cirros image
stepler.nova.tests.test_basic_verification.test_delete_server_with_precreated_port(flavor, network, port, cirros_image, create_port, port_steps, server_steps)[source]

Scenario: Delete instance with pre-created port.

This test verifies bug #1486727

Setup:

  1. Create flavor
  2. Create network
  3. Create subnet
  4. Upload cirros image
  5. Create port

Steps:

  1. Boot server with created port
  2. Delete server
  3. Check that port is still present

Teardown:

  1. Delete port
  2. Delete cirros image
  3. Delete network
  4. Delete subnet
  5. Delete flavor
stepler.nova.tests.test_basic_verification.test_disk_io_qos_settings_for_rbd_backend(cirros_image, flavor, network, subnet, security_group, server_steps, flavor_steps, os_faults_steps)[source]

Scenario: Check disk I/O QOS settings for RBD backend.

This test verifies bug #1507504

Setup:

  1. Upload cirros image
  2. Create flavor
  3. Create network
  4. Create subnet
  5. Create security group with allow ping rule

Steps:

  1. Set I/O limits to flavor (disk_read_bytes_sec=10240000 and disk_write_bytes_sec=10240000)
  2. Create server
  3. Execute ‘virsh dumpxml <inst_name>’ on node where instance is hosted
  4. Check that its output contains read_bytes_sec and write_bytes_sec with expected values 10240000
  5. Execute ‘ps axu | grep qemu | grep ‘drive file=rbd’ on node
  6. Check that its output contains ‘bps_rd=10240000’ and ‘bps_wr=10240000’

Teardown:

  1. Delete server
  2. Delete security group
  3. Delete subnet
  4. Delete network
  5. Delete flavor
  6. Delete cirros image
stepler.nova.tests.test_basic_verification.test_flavors_list(flavor_steps)[source]

Scenario: Request list of flavors.

Steps:

  1. Get list of flavors
stepler.nova.tests.test_basic_verification.test_image_access_host_device_when_resizing(ubuntu_image, net_subnet_router, security_group, keypair, floating_ip, create_flavor, server_steps)[source]

Scenario: Resize server after unmounting fs.

Test on host data leak during resize/migrate for raw-backed instances bug validation. This test verifies bugs #1552683 and #1548450 (CVE-2016-2140).

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Set router default gateway to public network
  4. Create security_group
  5. Create keypair
  6. Create nova floating ip

Steps:

  1. Set use_cow_images=0 value in nova config on all computes
  2. Create 2 flavors with ephemeral disk
  3. Boot instance with the first flavor
  4. Create empty file in /mnt directory
  5. Unmount /mnt fs on the instance
  6. Create qcow2 image with backing_file linked to
    target host device in ephemeral block device on instance using the following command: qemu-img create -f qcow2 -o backing_file=/dev/sda3,backing_fmt=raw /dev/vdb 20G
  7. Resize flavor for the server
  8. Check that /mnt fs doesn’t have files

Teardown:

  1. Set use_cow_images param to its initial value on all computes
  2. Delete server
  3. Delete flavors
  4. Delete nova floating ip
  5. Delete keypair
  6. Delete security group
  7. Delete network
  8. Delete cirros image
stepler.nova.tests.test_basic_verification.test_instances_list(server_steps)[source]

Scenario: Request list of instances.

Steps:

  1. Get list of instances
stepler.nova.tests.test_basic_verification.test_nova_services(os_faults_steps)[source]

Scenario: Check that nova services are alive.

Steps:

  1. Get list of nova services
  2. Check all services are running
stepler.nova.tests.test_basic_verification.test_remove_incorrect_fixed_ip_from_server(server, floating_ip, server_steps)[source]

Scenario: [negative] Remove incorrect fixed IP from an instance.

This test verifies bug #1534186 https://bugs.launchpad.net/nova/+bug/1534186

Setup:

  1. Create flavor
  2. Create security_group
  3. Create keypair
  4. Upload cirros image
  5. Create nova floating ip
  6. Boot server from cirros image

Steps:

  1. Attach floating IP to server
  2. Generate fake IP
  3. Try to detach non-present fixed IP from server
  4. Check that error has been raised
  5. Detach present fixed IP from server
  6. Check that it will be detached with no error
  7. Check that server is accessible

Teardown:

  1. Delete server
  2. Delete flavor
  3. Delete security group
  4. Delete keypair
  5. Delete cirros image
  6. Delete nova floating ip
stepler.nova.tests.test_basic_verification.test_server_basic(flavor, security_group, keypair, cirros_image, net_subnet_router, server_steps)[source]

Scenario: Basic test to boot Nova instance.

Setup:

  1. Create flavor
  2. Create security_group
  3. Create keypair
  4. Upload cirros image
  5. Create network with subnet and router

Steps:

  1. Boot one server from cirros image

Teardown:

  1. Delete server
  2. Delete flavor
  3. Delete security_group
  4. Delete keypair
  5. Delete cirros image
  6. Delete network, subnet, router

Nova deferred delete tests

stepler.nova.tests.test_deferred_delete.test_force_delete_server_before_deferred_cleanup(cirros_image, flavor, net_subnet_router, keypair, security_group, volume, create_server_context, attach_volume_to_server, detach_volume_from_server, server_steps, volume_steps)[source]

Scenario: Force delete of instance before deferred cleanup

Setup:

  1. Update /etc/nova/nova.conf with ‘reclaim_instance_interval=86400’ and restart nova-api and nova-compute on all nodes
  2. Create cirros image
  3. Create flavor
  4. Create net, subnet and router
  5. Create keypair
  6. Create security group

Steps:

  1. Create and run two instances (vm1, vm2) inside same net
  2. Create a volume and attach it to an instance vm1
  3. Delete instance vm1 and check that it’s in ‘SOFT_DELETE’ state
  4. Delete instance vm1 with ‘force’ option and check that it’s not present.
  5. Check that volume is released now and has an Available state;
  6. Attach the volume to vm2 and check that it has ‘in-use’ state.
  7. Detach the volume

Teardown:

  1. Delete volume
  2. Delete vms
  3. Delete security group
  4. Delete keypair
  5. Delete net, subnet and router
  6. Delete flavor
  7. Delete cirros image
  8. Restore original config files and restart nova-api and nova-compute on all nodes
stepler.nova.tests.test_deferred_delete.test_restore_soft_deleted_server(cirros_image, flavor, net_subnet_router, keypair, security_group, volume, create_floating_ip, attach_volume_to_server, volume_steps, server_steps)[source]

Scenario: Restore previously deleted instance

Setup:

  1. Update /etc/nova/nova.conf with ‘reclaim_instance_interval=86400’ and restart nova-api and nova-compute on all nodes
  2. Create cirros image
  3. Create flavor
  4. Create net and subnet and router
  5. Create keypair
  6. Create security group

Steps:

  1. Create and run two instances (vm1, vm2) inside same net
  2. Create and attach floating IPs to instances
  3. Check that ping are successful between vms
  4. Create a volume and attach it to an instance vm1
  5. Delete instance vm1 and check that it’s in ‘SOFT_DELETE’ state
  6. Restore vm1 instance and check that it’s in ‘ACTIVE’ state
  7. Check that ping are successful between vms

Teardown:

  1. Delete volume
  2. Delete vms
  3. Delete net, subnet, router
  4. Delete security group
  5. Delete keypair
  6. Delete flavor
  7. Delete cirros image
  8. Restore original config files and restart nova-api and nova-compute on all nodes
stepler.nova.tests.test_deferred_delete.test_server_deleted_after_reclaim_timeout(cirros_image, flavor, net_subnet_router, keypair, security_group, volume, attach_volume_to_server, detach_volume_from_server, server_steps, volume_steps)[source]

Scenario: Check that softly-deleted instance is totally deleted after reclaim interval timeout.

Setup:

  1. Update ‘/etc/nova/nova.conf’ with ‘reclaim_instance_interval=30’ and restart nova-api and nova-compute on all nodes
  2. Create cirros image
  3. Create flavor
  4. Create net and subnet and router
  5. Create keypair
  6. Create security group

Steps:

  1. Create and run two instances (vm1, vm2) inside same net
  2. Create and attach floating IPs to instances
  3. Check that ping are successful between vms
  4. Create a volume and attach it to an instance vm1
  5. Delete instance vm1 and check that it’s in ‘SOFT_DELETE’ state
  6. Wait for the reclaim instance interval to expire and make sure that vm1 is deleted
  7. Check that volume is released now and has an Available state
  8. Attach the volume to vm2 and check that it has ‘in-use’ state.
  9. Detach the volume

Teardown:

  1. Delete volume
  2. Delete vms
  3. Delete security group
  4. Delete keypair
  5. Delete net, subnet and router
  6. Delete flavor
  7. Delete cirros image
  8. Restore original config files and restart nova-api and nova-compute on all nodes

~! BUG !~ https://bugs.launchpad.net/cinder/+bug/1463856 Cinder volume isn’t available after instance soft-deleted timer expired while volume is still attached.

Nova host actions tests

stepler.nova.tests.test_host_actions.test_host_resources_info(cirros_image, flavor, network, subnet, server_steps, host_steps)[source]

Scenario: Get info about resources’ usage on nodes.

Setup:

  1. Create cirros image
  2. Create flavor
  3. Create net and subnet

Steps:

  1. Get resource info for node-1 and node-2
  2. Create two servers on node-1
  3. Get resource info for node-1 and check that resource usage is changed and project_id is present in results
  4. Get resource info for node-2 and check that resource usage is not changed
  5. Create two servers on node-2
  6. Get resource info for node-1 and check that resource usage is not changed
  7. Get resource info for node-2 and check that resource usage is changed and project_id is present in results

Teardown:

  1. Delete servers
  2. Delete net and subnet
  3. Delete flavor
  4. Delete cirros image
stepler.nova.tests.test_host_actions.test_migrate_servers(cirros_image, net_subnet_router, security_group, flavor, keypair, nova_availability_zone_hosts, server_steps, create_floating_ip)[source]

Scenario: Migrate servers from the specified host to other hosts.

Setup:

  1. Upload cirros image
  2. Create network, subnet, router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor

Steps:

  1. Boot 3 servers on the same hypervisor
  2. Start migration for all servers
  3. Check that every server is rescheduled to other hypervisor
  4. Confirm resize for every server
  5. Check that every migrated server has an ACTIVE status
  6. Assign floating ip for all servers
  7. Send pings between all servers to check network connectivity

Teardown:

  1. Delete servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete cirros image

Nova live migration tests

stepler.nova.tests.test_live_migration.test_migration_with_ephemeral_disk(keypair, security_group, floating_ip, cirros_image, net_subnet_router, create_flavor, server_steps, block_migration)[source]

Scenario: LM of VM with data on root and ephemeral disk.

Setup:

  1. Upload cirros image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule

Steps:

  1. Add router interface to created network
  2. Create flavor with ephemeral disk
  3. Boot server from cirros image with created flavor
  4. Assign floating ip to server
  5. Create timestamp on on root and ephemeral disks
  6. Migrate server to another hypervisor
  7. Start ping instance
  8. Check that pings reach the server succesfully
  9. Verify timestamp on root and ephemeral disks

Teardown:

  1. Delete server
  2. Delete flavor
  3. Delete volume
  4. Delete security group
  5. Delete router
  6. Delete subnet
  7. Delete network
  8. Delete cirros image
stepler.nova.tests.test_live_migration.test_network_connectivity_to_vm_after_live_migration(floating_ip, server, server_steps, block_migration)[source]

Scenario: Verify connectivity to the VM after live migration.

Setup:

  1. Upload cirros image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule
  7. Create flavor
  8. Add router interface to created network
  9. Boot server from cirros image
  10. Assign floating ip to server

Steps:

  1. Migrate server to another hypervisor
  2. Start ping
  3. Check that pings reach the server succesfully

Teardown:

  1. Delete server
  2. Delete flavor
  3. Delete security group
  4. Delete router
  5. Delete subnet
  6. Delete network
  7. Delete cirros image
stepler.nova.tests.test_live_migration.test_server_migration_with_cpu_workload(live_migration_server, floating_ip, server_steps, block_migration)[source]

Scenario: LM of instance under CPU workload.

Setup:

  1. Upload ubuntu image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule
  7. Create flavor
  8. Add router interface to created network
  9. Boot server from image or volume
  10. Assign floating ip to server

Steps:

  1. Start CPU workload on server
  2. Migrate server to another hypervisor
  3. Check that ping to server’s floating ip is successful
  4. Delete server

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete router
  4. Delete subnet
  5. Delete network
  6. Delete ubuntu image
stepler.nova.tests.test_live_migration.test_server_migration_with_disk_workload(live_migration_server, floating_ip, server_steps, block_migration)[source]

Scenario: LM of instance under disk workload.

Setup:

  1. Upload ubuntu image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule
  7. Create flavor
  8. Add router interface to created network
  9. Boot server from image or volume
  10. Assign floating ip to server

Steps:

  1. Start disk workload on server
  2. Migrate server to another hypervisor
  3. Check that ping to server’s floating ip is successful
  4. Delete server

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete router
  4. Delete subnet
  5. Delete network
  6. Delete ubuntu image
stepler.nova.tests.test_live_migration.test_server_migration_with_memory_workload(live_migration_server, floating_ip, server_steps, block_migration)[source]

Scenario: LM of instance under memory workload.

Setup:

  1. Upload ubuntu image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule
  7. Create flavor
  8. Add router interface to created network
  9. Boot server from image or volume
  10. Assign floating ip to server

Steps:

  1. Start memory workload on server
  2. Migrate server to another hypervisor
  3. Check that ping to server’s floating ip is successful
  4. Delete server

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete router
  4. Delete subnet
  5. Delete network
  6. Delete ubuntu image
stepler.nova.tests.test_live_migration.test_server_migration_with_network_workload(live_migration_server, security_group, floating_ip, neutron_security_group_rule_steps, server_steps, generate_traffic, block_migration)[source]

Scenario: LM of instance under network workload.

Setup:

  1. Upload ubuntu image
  2. Create network
  3. Create subnet
  4. Create router
  5. Set router default gateway to public network
  6. Create security group with allow ping rule
  7. Create flavor
  8. Add router interface to created network
  9. Boot server from image or volume
  10. Assign floating ip to server

Steps:

  1. Start network workload on server
  2. Migrate server to another hypervisor
  3. Check that ping to server’s floating ip is successful
  4. Delete server

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete router
  4. Delete subnet
  5. Delete network
  6. Delete ubuntu image

Nova live migration of multiple servers tests

stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_attached_volume(live_migration_servers_with_volumes, server_steps, block_migration)[source]

Scenario: LM of servers with attached volumes.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image or volume
  6. Attach volume to each server
  7. Assign floating ips to servers

Steps:

  1. Initiate LM of servers to another compute node
  2. Check that ping to servers’ floating ips is successful

Teardown:

  1. Delete servers
  2. Delete volumes
  3. Delete flavor
  4. Delete security group
  5. Delete network, subnet, router
  6. Delete ubuntu image
stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_cpu_workload(live_migration_servers, server_steps, block_migration)[source]

Scenario: LM of servers under CPU workload.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image or volume
  6. Assign floating ips to servers

Steps:

  1. Start CPU workload on servers
  2. Initiate LM of servers to another compute node
  3. Check that ping to servers’ floating ips is successful
  4. Delete servers

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete network, subnet, router
  4. Delete ubuntu image
stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_disk_workload(live_migration_servers, server_steps, block_migration)[source]

Scenario: Block LM of servers under disk workload.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image
  6. Assign floating ips to servers

Steps:

  1. Start disk workload on servers
  2. Initiate LM of servers to another compute node
  3. Check that ping to servers’ floating ips is successful
  4. Delete servers

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete network, subnet, router
  4. Delete ubuntu image
stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_large_flavors(live_migration_servers, server_steps, block_migration)[source]

Scenario: LM of servers with attached volumes.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image or volume
  6. Attach volume to each server
  7. Assign floating ips to servers

Steps:

  1. Initiate LM of servers to another compute node
  2. Check that ping to servers’ floating ips is successful

Teardown:

  1. Delete servers
  2. Delete volumes
  3. Delete flavor
  4. Delete security group
  5. Delete network, subnet, router
  6. Delete ubuntu image
stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_memory_workload(live_migration_servers, server_steps, block_migration)[source]

Scenario: LM of servers under memory workload.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image or volume
  6. Assign floating ips to servers

Steps:

  1. Start memory workload on servers
  2. Initiate LM of servers to another compute node
  3. Check that ping to servers’ floating ips is successful
  4. Delete servers

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete network, subnet, router
  4. Delete ubuntu image
stepler.nova.tests.test_live_migration_multi_servers.test_migration_with_network_workload(live_migration_servers, security_group, neutron_security_group_rule_steps, server_steps, generate_traffic, block_migration)[source]

Scenario: LM of servers under network workload.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allow ping rule
  4. Create flavor
  5. Boot maximum allowed number of servers from image or volume
  6. Assign floating ips to servers

Steps:

  1. Allow servers to listen TCP port
  2. Start network workload on servers
  3. Initiate LM of servers to another compute node
  4. Check that ping to servers’ floating ips is successful
  5. Delete servers

Teardown:

  1. Delete flavor
  2. Delete security group
  3. Delete network, subnet, router
  4. Delete ubuntu image

Server metadata tests

stepler.nova.tests.test_metadata.test_metadata_reach_all_booted_vm(security_group, floating_ip, ubuntu_image, keypair, flavor, net_subnet_router, create_server_context, server_steps)[source]

Scenario: Verify that image can be connected with SSH.

Setup:

  1. Create security group
  2. Create floating IP
  3. Get Glance ubuntu image OR download and create it if ubuntu image is
    not present.
  4. Create keypair
  5. Create flavor

Steps:

  1. Get flavor m1.small
  2. Get admin internal network
  3. Create nova server
  4. Attach floating IP to nova server
  5. Check that server is available via SSH
  6. Detach floating IP
  7. Delete nova server

Teardown:

  1. Delete flavor
  2. Delete keypair
  3. Release floating IP
  4. Delete security group
stepler.nova.tests.test_metadata.test_put_metadata_on_instances_on_single_compute(security_group, flavor, cirros_image, network, subnet, nova_availability_zone_hosts, flavor_steps, server_steps, os_faults_steps, execute_command_with_rollback)[source]

Scenario: Put metadata on all instances scheduled on a single compute node.

Setup:

  1. Create security group
  2. Create flavor
  3. Upload cirros image
  4. Create network and subnetwork

Steps:

  1. Get FQDNs of nova hosts
  2. Create 2 nova servers on host 1
  3. Create 2 nova servers on host 2
  4. From controller node add new ‘key=value’ to metadata of servers,
    located on host 1.
  5. Check that servers from host 1 have ‘key=value’ in their metadata
  6. Check that servers from host 2 do NOT have ‘key=value’ in their metadata
  7. From controller node delete ‘key=value’ from metadata of servers,
    located on host 1.
  8. Check that servers from host 1 and host 2 do NOT have ‘key=value’ in
    their metadata

Teardown:

  1. Delete servers
  2. Delete security group
  3. Delete network and subnetwork

Nova Rebuild tests

stepler.nova.tests.test_rebuild.test_rebuild_in_paused_state(cirros_image, server, server_steps)[source]

Scenario: Try to rebuild an instance in Paused state.

Setup:

  1. Create server

Steps:

  1. Pause server
  2. Try to rebuild server
  3. Check that rebuild fails and exception is called

Teardown:

  1. Delete server
stepler.nova.tests.test_rebuild.test_rebuild_in_rescue_state(cirros_image, server, server_steps)[source]

Scenario: Try to rebuild an instance in Rescued state.

Setup:

  1. Create server

Steps:

  1. Rescue server
  2. Try to rebuild server
  3. Check that rebuild fails and exception is called

Teardown:

  1. Delete server
stepler.nova.tests.test_rebuild.test_rebuild_locked_server(cirros_server_to_rebuild, cirros_image, floating_ip, server_steps)[source]

Scenario: Rebuild locked server.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot a server from image or volume

Steps:

  1. Create a floating IP and attach it to previously created server
  2. Lock the server and check its status
  3. Rebuild previously locked server
  4. Check that rebuilt server has an ACTIVE status and locked=True
  5. Send pings to server’s floating IP to check network connectivity

Teardown:

  1. Delete a server
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IP
  6. Delete cirros image
stepler.nova.tests.test_rebuild.test_rebuild_server_with_description(cirros_server_to_rebuild, cirros_image, floating_ip, server_steps)[source]

Scenario: Rebuild server with description.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot a server from image or volume

Steps:

  1. Create a floating IP and attach it to previously created server
  2. Rebuild the server with –description parameter
  3. Check that rebuilt server has an ACTIVE status
  4. Check that the description was added
  5. Send pings to server’s floating IP to check network connectivity

Teardown:

  1. Delete a server
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IP
  6. Delete cirros image
stepler.nova.tests.test_rebuild.test_rebuild_with_user_files(ubuntu_server_to_rebuild, ubuntu_image, floating_ip, server_steps)[source]

Scenario: Rebuild server with user files.

Setup:

  1. Upload ubuntu image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot a server from image or volume

Steps:

  1. Create a floating IP and attach it to previously created server
  2. Rebuild the server with –files parameter
  3. Check that rebuilt server has an ACTIVE status
  4. Check that ubuntu booted successfully on a rebuilt server
  5. Check that all files added during server’s rebuild are present in target directory of this server

Teardown:

  1. Delete a server
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IP
  6. Delete ubuntu image

Restart all nova services

stepler.nova.tests.test_restart_all_services.test_restart_all_nova_services(cirros_image, flavor, security_group, net_subnet_router, create_floating_ip, os_faults_steps, server_steps)[source]

Scenario: Restart all Nova services.

Setup:

  1. Create cirros image
  2. Create flavor
  3. Create security group
  4. Create network_1 with subnet_1 and router_1

Steps:

  1. Boot server_1 and associate floating IP
  2. Check that ping from server_1 to 8.8.8.8 is successful
  3. Restart all running nova services on controllers
  4. Boot server_2 and associate floating IP
  5. Check ping between server_1 and server_2 and ping to 8.8.8.8
  6. Restart all running nova services on computes
  7. Boot server_3 and associate floating IP
  8. Check ping between server_1, server_2, server_3 and ping to 8.8.8.8
  9. Restart all running nova services
  10. Check ping between server_1, server_2, server_3 and ping to 8.8.8.8
  11. Delete all servers

Teardown:

  1. Delete network, subnet, router
  2. Delete floating IPs
  3. Delete security group
  4. Delete flavor
  5. Delete cirros image

Nova evacuate tests

stepler.nova.tests.test_evacuate.test_evacuate_locked_servers(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]
Scenario: Evacuate locked servers from the “failed” host
to other hosts.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Lock previously created servers
  2. Set the hypervisor where servers are scheduled to “failed” state
  3. Start evacuation for all servers
  4. Check that every server is rescheduled to other hypervisor
  5. Check that every evacuated server has an ACTIVE status and locked=True
  6. Send pings between all servers to check network connectivity

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_paused_servers(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Try to evacuate servers in Paused state.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Pause previously created servers
  2. Set the hypervisor where servers are scheduled to “failed” state
  3. Start evacuation for all servers
  4. Check that evacuation fails and exception is called

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_rescue_servers(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Try to evacuate servers in Rescue state.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Rescue previously created servers
  2. Set the hypervisor where servers are scheduled to “failed” state
  3. Start evacuation for all servers
  4. Check that evacuation fails and exception is called

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_resized_servers(servers_to_evacuate, small_flavor, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Try to evacuate servers in Resized state.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Resize previously created servers with m1.small flavor
  2. Set the hypervisor where servers are scheduled to “failed” state
  3. Start evacuation for all servers
  4. Check that evacuation fails and exception is called

Teardown:

  1. Delete all servers
  2. Delete flavors
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_servers(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Evacuate servers from the “failed” host to other hosts.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Set the hypervisor where servers are scheduled to “failed” state
  2. Start evacuation for all servers
  3. Check that every server is rescheduled to other hypervisor
  4. Check that every evacuated server has an ACTIVE status
  5. Send pings between all servers to check network connectivity

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_servers_to_initial_compute(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Try to evacuate servers to initial “failed” compute node.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Set the hypervisor where servers are scheduled to “failed” state
  2. Start evacuation for all servers to their “native” compute node
  3. Check that evacuation fails and exception is called

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_servers_with_volumes(servers_with_volumes_to_evacuate, nova_api_node, server_steps, os_faults_steps, volume_steps)[source]
Scenario: Evacuate servers with volumes attached from the “failed”
host to other hosts.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers
  7. Create two volumes and attach them to servers

Steps:

  1. Set the hypervisor where servers are scheduled to “failed” state
  2. Start evacuation for all servers
  3. Check that every server is rescheduled to other hypervisor
  4. Check that every evacuated server has an ACTIVE status
  5. Check that all volumes are in ‘in-use’ state
  6. Send pings between all servers to check network connectivity

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete volumes
  7. Delete cirros image
stepler.nova.tests.test_evacuate.test_evacuate_shelved_servers(servers_to_evacuate, nova_api_node, server_steps, os_faults_steps)[source]

Scenario: Try to evacuate servers in Shelved state.

Setup:

  1. Upload cirros image
  2. Create network with subnet and router
  3. Create security group with allowed ping and ssh rules
  4. Create flavor
  5. Boot two servers from image or volume on the same hypervisor
  6. Create two floating IPs and attach them to servers

Steps:

  1. Shelve previously created servers
  2. Set the hypervisor where servers are scheduled to “failed” state
  3. Start evacuation for all servers
  4. Check that evacuation fails and exception is called

Teardown:

  1. Delete all servers
  2. Delete flavor
  3. Delete security group
  4. Delete network, subnet, router
  5. Delete floating IPs
  6. Delete cirros image