Merge "test_service_providers: require service-type ext"
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index c9ba730..2dd2e89 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -31,7 +31,6 @@
super(MigrationsAdminTest, cls).setup_clients()
cls.client = cls.os_adm.migrations_client
cls.flavors_admin_client = cls.os_adm.flavors_client
- cls.admin_hosts_client = cls.os_adm.hosts_client
cls.admin_servers_client = cls.os_adm.servers_client
@test.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index efa55d5..a8a8b83 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -29,7 +29,6 @@
super(ServersAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.servers_client
cls.non_admin_client = cls.servers_client
- cls.flavors_client = cls.os_adm.flavors_client
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 82ebcd0..d2e31ad 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -300,7 +300,7 @@
self.validation_resources['keypair']['private_key'],
server=server_no_eph_disk,
servers_client=self.client)
- partition_num = len(linux_client.get_partitions().split('\n'))
+ disks_num = len(linux_client.get_disks().split('\n'))
# Explicit server deletion necessary for Juno compatibility
self.client.delete_server(server_no_eph_disk['id'])
@@ -320,8 +320,8 @@
self.validation_resources['keypair']['private_key'],
server=server_with_eph_disk,
servers_client=self.client)
- partition_num_emph = len(linux_client.get_partitions().split('\n'))
- self.assertEqual(partition_num + 1, partition_num_emph)
+ disks_num_eph = len(linux_client.get_disks().split('\n'))
+ self.assertEqual(disks_num + 1, disks_num_eph)
class ServersTestManualDisk(ServersTestJSON):
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 7252e1b..b2d5ae7 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -52,9 +52,7 @@
super(DeviceTaggingTest, cls).setup_clients()
cls.networks_client = cls.os.networks_client
cls.ports_client = cls.os.ports_client
- cls.volumes_client = cls.os.volumes_client
cls.subnets_client = cls.os.subnets_client
- cls.routers_client = cls.os.routers_client
cls.interfaces_client = cls.os.interfaces_client
@classmethod
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 5a35b4e..3e408d2 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -40,14 +40,9 @@
srv = cls.create_test_server(wait_until='ACTIVE')
cls.existing_fixtures.append(srv)
- srv = cls.create_test_server()
+ srv = cls.create_test_server(wait_until='ACTIVE')
cls.client.delete_server(srv['id'])
- # We ignore errors on termination because the server may
- # be put into ERROR status on a quick spawn, then delete,
- # as the compute node expects the instance local status
- # to be spawning, not deleted. See LP Bug#1061167
- waiters.wait_for_server_termination(cls.client, srv['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(cls.client, srv['id'])
cls.deleted_fixtures.append(srv)
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 56ec8c6..1edadef 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -111,9 +111,9 @@
server=server,
servers_client=self.servers_client)
- partitions = linux_client.get_partitions()
- device_name_to_match = ' ' + self.device + '\n'
- self.assertIn(device_name_to_match, partitions)
+ disks = linux_client.get_disks()
+ device_name_to_match = '\n' + self.device + ' '
+ self.assertIn(device_name_to_match, disks)
self._detach_volume(server['id'], attachment['volumeId'])
self.servers_client.stop_server(server['id'])
@@ -133,8 +133,8 @@
server=server,
servers_client=self.servers_client)
- partitions = linux_client.get_partitions()
- self.assertNotIn(device_name_to_match, partitions)
+ disks = linux_client.get_disks()
+ self.assertNotIn(device_name_to_match, disks)
@test.idempotent_id('7fa563fe-f0f7-43eb-9e22-a1ece036b513')
def test_list_get_volume_attachments(self):
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 261e652..4bd7637 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -22,19 +22,6 @@
class VolumesActionsV2Test(base.BaseVolumeAdminTest):
- @classmethod
- def resource_setup(cls):
- super(VolumesActionsV2Test, cls).resource_setup()
-
- # Create a test shared volume for tests
- cls.volume = cls.create_volume()
-
- def tearDown(self):
- # Set volume's status to available after test
- self.admin_volume_client.reset_volume_status(
- self.volume['id'], status='available')
- super(VolumesActionsV2Test, self).tearDown()
-
def _create_reset_and_force_delete_temp_volume(self, status=None):
# Create volume, reset volume status, and force delete temp volume
temp_volume = self.create_volume()
@@ -47,11 +34,13 @@
@test.idempotent_id('d063f96e-a2e0-4f34-8b8a-395c42de1845')
def test_volume_reset_status(self):
# test volume reset status : available->error->available
- self.admin_volume_client.reset_volume_status(
- self.volume['id'], status='error')
- volume_get = self.admin_volume_client.show_volume(
- self.volume['id'])['volume']
- self.assertEqual('error', volume_get['status'])
+ volume = self.create_volume()
+ for status in ['error', 'available']:
+ self.admin_volume_client.reset_volume_status(
+ volume['id'], status=status)
+ volume_get = self.admin_volume_client.show_volume(
+ volume['id'])['volume']
+ self.assertEqual(status, volume_get['status'])
@test.idempotent_id('21737d5a-92f2-46d7-b009-a0cc0ee7a570')
def test_volume_force_delete_when_volume_is_creating(self):
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 9ec217f..d8993bb 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -112,11 +112,22 @@
output = self.exec_command('grep -c ^processor /proc/cpuinfo')
return int(output)
- def get_partitions(self):
- # Return the contents of /proc/partitions
- command = 'cat /proc/partitions'
+ def get_disks(self):
+ # Select root disk devices as shown by lsblk
+ command = 'lsblk -lb --nodeps'
output = self.exec_command(command)
- return output
+ selected = []
+ pos = None
+ for l in output.splitlines():
+ if pos is None and l.find("TYPE") > 0:
+ pos = l.find("TYPE")
+ # Show header line too
+ selected.append(l)
+ # lsblk lists disk type in a column right-aligned with TYPE
+ elif pos > 0 and l[pos:pos + 4] == "disk":
+ selected.append(l)
+
+ return "\n".join(selected)
def get_boot_time(self):
cmd = 'cut -f1 -d. /proc/uptime'
diff --git a/tempest/config.py b/tempest/config.py
index 47eb427..a3d4d78 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -422,10 +422,16 @@
default=['all'],
help="A list of enabled filters that nova will accept as hints"
" to the scheduler when creating a server. A special "
- "entry 'all' indicates all filters are enabled. Empty "
- "list indicates all filters are disabled. The full "
- "available list of filters is in nova.conf: "
- "DEFAULT.scheduler_available_filters"),
+ "entry 'all' indicates all filters that are included "
+ "with nova are enabled. Empty list indicates all filters "
+ "are disabled. The full list of available filters is in "
+ "nova.conf: DEFAULT.scheduler_available_filters. If the "
+ "default value is overridden in nova.conf by the test "
+ "environment (which means that a different set of "
+ "filters is enabled than what is included in Nova by "
+ "default) then, this option must be configured to "
+ "contain the same filters that Nova uses in the test "
+ "environment."),
cfg.BoolOpt('swap_volume',
default=False,
help='Does the test environment support in-place swapping of '
diff --git a/tempest/lib/services/compute/flavors_client.py b/tempest/lib/services/compute/flavors_client.py
index 4d1044b..a83c68b 100644
--- a/tempest/lib/services/compute/flavors_client.py
+++ b/tempest/lib/services/compute/flavors_client.py
@@ -67,9 +67,9 @@
API reference:
http://developer.openstack.org/api-ref-compute-v2.1.html#createFlavor
"""
- if kwargs.get('ephemeral'):
+ if 'ephemeral' in kwargs:
kwargs['OS-FLV-EXT-DATA:ephemeral'] = kwargs.pop('ephemeral')
- if kwargs.get('is_public'):
+ if 'is_public' in kwargs:
kwargs['os-flavor-access:is_public'] = kwargs.pop('is_public')
post_body = json.dumps({'flavor': kwargs})
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index f2f17d2..c454ae2 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -66,10 +66,10 @@
waiters.wait_for_server_status(self.servers_client,
server['id'], 'ACTIVE')
- def check_partitions(self):
+ def check_disks(self):
# NOTE(andreaf) The device name may be different on different guest OS
- partitions = self.linux_client.get_partitions()
- self.assertEqual(1, partitions.count(CONF.compute.volume_device_name))
+ disks = self.linux_client.get_disks()
+ self.assertEqual(1, disks.count(CONF.compute.volume_device_name))
def create_and_add_security_group_to_server(self, server):
secgroup = self._create_security_group()
@@ -145,7 +145,7 @@
self.linux_client = self.get_remote_client(
floating_ip['ip'], private_key=keypair['private_key'])
- self.check_partitions()
+ self.check_disks()
# delete the floating IP, this should refresh the server addresses
self.compute_floating_ips_client.delete_floating_ip(floating_ip['id'])
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 0f2c78c..dff00e7 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -85,9 +85,9 @@
ssh = self.get_remote_client(ip_address, private_key=private_key)
def _func():
- part = ssh.get_partitions()
- LOG.debug("Partitions:%s" % part)
- return CONF.compute.volume_device_name in part
+ disks = ssh.get_disks()
+ LOG.debug("Disks: %s" % disks)
+ return CONF.compute.volume_device_name in disks
if not test_utils.call_until_true(_func,
CONF.compute.build_timeout,
diff --git a/tempest/test.py b/tempest/test.py
index 51f0a6a..af97932 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -164,7 +164,15 @@
def is_scheduler_filter_enabled(filter_name):
- """Check the list of enabled compute scheduler filters from config. """
+ """Check the list of enabled compute scheduler filters from config.
+
+ This function checks whether the given compute scheduler filter is
+ available and configured in the config file. If the
+ scheduler_available_filters option is set to 'all' (Default value. which
+ means default filters are configured in nova) in tempest.conf then, this
+ function returns True with assumption that requested filter 'filter_name'
+ is one of available filter in nova ("nova.scheduler.filters.all_filters").
+ """
filters = CONF.compute_feature_enabled.scheduler_available_filters
if len(filters) == 0:
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index e59e08f..e4f4c04 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -107,13 +107,20 @@
self.assertEqual(self.conn.get_number_of_vcpus(), 16)
self._assert_exec_called_with('grep -c ^processor /proc/cpuinfo')
- def test_get_partitions(self):
- proc_partitions = """major minor #blocks name
+ def test_get_disks(self):
+ output_lsblk = """\
+NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
+sda 8:0 0 128035676160 0 disk
+sdb 8:16 0 1000204886016 0 disk
+sr0 11:0 1 1073741312 0 rom"""
+ result = """\
+NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
+sda 8:0 0 128035676160 0 disk
+sdb 8:16 0 1000204886016 0 disk"""
-8 0 1048576 vda"""
- self.ssh_mock.mock.exec_command.return_value = proc_partitions
- self.assertEqual(self.conn.get_partitions(), proc_partitions)
- self._assert_exec_called_with('cat /proc/partitions')
+ self.ssh_mock.mock.exec_command.return_value = output_lsblk
+ self.assertEqual(self.conn.get_disks(), result)
+ self._assert_exec_called_with('lsblk -lb --nodeps')
def test_get_boot_time(self):
booted_at = 10000