Fix names of new devices in functional tests

Some tests fail in gating, since that Nova assigns true device names to
bdm records. These tests try to add a volume to an instance on 'd' or
'h' letter, when the only 'a' volume exists in the instance. But libvirt
reassigns the device name to avoid a hole in device name sequence. So
the name of the new device becomes 'b'.

This patch uses 'b' for new devices to workaround the feature.

Depends-On: I770d394f65e5be6a5f8f36c673806f91509e0abe
Change-Id: Iea8bb3fb03aead5c347d129f14b2abd1d2bb4626
This commit is contained in:
Feodor Tersin 2015-07-29 12:19:47 +03:00
parent f992f2ed4e
commit 34a4eb2f78
2 changed files with 8 additions and 2 deletions

View File

@ -238,7 +238,13 @@ class InstanceTest(base.EC2TestCase):
def test_launch_instance_with_creating_blank_volume(self):
"""Launch instance with creating blank volume."""
device_name = '/dev/xvdh'
data = self.client.describe_images(ImageIds=[CONF.aws.image_id])
# NOTE(ft): ec2 api doesn't report root device name if it isn't
# explicity contained in an image. So we assume it is /dev/vda,
# which is true for only qemu hypervisor though.
device_name_prefix = base.get_device_name_prefix(
data['Images'][0].get('RootDeviceName', '/dev/vda'))
device_name = device_name_prefix + 'b'
instance_type = CONF.aws.instance_type
data = self.client.run_instances(
ImageId=CONF.aws.image_id, InstanceType=instance_type,

View File

@ -114,7 +114,7 @@ class EC2_EBSInstanceTuneBDM(base.EC2TestCase):
def test_launch_ebs_instance_with_creating_blank_volume(self):
"""Launch instance with creating blank volume."""
device_name_prefix = base.get_device_name_prefix(self.root_device_name)
device_name = device_name_prefix + 'd'
device_name = device_name_prefix + 'b'
instance_id = self.run_instance(ImageId=self.image_id,
BlockDeviceMappings=[{'DeviceName': device_name,