Do not pass device when calling compute.base.attach_volume
As of the 12.0.0 Liberty release, the Nova libvirt driver no longer honors a user-supplied device name, so better not pass device when calling compute.base.attach_volume. https://developer.openstack.org/api-ref/compute/#attach-a-volume-to-an-instance NOTE: We still keep passing device in test_attach_detach_volume, because it will ssh to vm to check the device name, in that case, CONF.compute.volume_device_name must be set the equal value as the libvirt auto-assigned one. Whether to remove that check is out of the range of this patch. Change-Id: I4483836abedab2550731fef5b2625282d7a2298d
This commit is contained in:
parent
fe84ecb516
commit
2c9d9625d9
|
@ -107,11 +107,10 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
|
|||
@utils.services('volume')
|
||||
def test_delete_server_while_in_attached_volume(self):
|
||||
# Delete a server while a volume is attached to it
|
||||
device = '/dev/%s' % CONF.compute.volume_device_name
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
|
||||
volume = self.create_volume()
|
||||
self.attach_volume(server, volume, device=device)
|
||||
self.attach_volume(server, volume)
|
||||
|
||||
self.client.delete_server(server['id'])
|
||||
waiters.wait_for_server_termination(self.client, server['id'])
|
||||
|
|
|
@ -43,7 +43,6 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ServerRescueNegativeTestJSON, cls).resource_setup()
|
||||
cls.device = CONF.compute.volume_device_name
|
||||
cls.password = data_utils.rand_password()
|
||||
rescue_password = data_utils.rand_password()
|
||||
# Server for negative tests
|
||||
|
@ -125,8 +124,7 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
self.assertRaises(lib_exc.Conflict,
|
||||
self.servers_client.attach_volume,
|
||||
self.server_id,
|
||||
volumeId=volume['id'],
|
||||
device='/dev/%s' % self.device)
|
||||
volumeId=volume['id'])
|
||||
|
||||
@decorators.idempotent_id('f56e465b-fe10-48bf-b75d-646cda3a8bc9')
|
||||
@utils.services('volume')
|
||||
|
@ -136,7 +134,7 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
|
||||
# Attach the volume to the server
|
||||
server = self.servers_client.show_server(self.server_id)['server']
|
||||
self.attach_volume(server, volume, device='/dev/%s' % self.device)
|
||||
self.attach_volume(server, volume)
|
||||
|
||||
# Rescue the server
|
||||
self.servers_client.rescue_server(self.server_id,
|
||||
|
|
|
@ -84,6 +84,11 @@ class AttachVolumeTestJSON(BaseAttachVolumeTest):
|
|||
linux_client.validate_authentication()
|
||||
|
||||
volume = self.create_volume()
|
||||
|
||||
# NOTE: As of the 12.0.0 Liberty release, the Nova libvirt driver
|
||||
# no longer honors a user-supplied device name, in that case
|
||||
# CONF.compute.volume_device_name must be set the equal value as
|
||||
# the libvirt auto-assigned one
|
||||
attachment = self.attach_volume(server, volume,
|
||||
device=('/dev/%s' % self.device))
|
||||
|
||||
|
@ -121,8 +126,7 @@ class AttachVolumeTestJSON(BaseAttachVolumeTest):
|
|||
# List volume attachment of the server
|
||||
server, _ = self._create_server()
|
||||
volume_1st = self.create_volume()
|
||||
attachment_1st = self.attach_volume(server, volume_1st,
|
||||
device=('/dev/%s' % self.device))
|
||||
attachment_1st = self.attach_volume(server, volume_1st)
|
||||
body = self.servers_client.list_volume_attachments(
|
||||
server['id'])['volumeAttachments']
|
||||
self.assertEqual(1, len(body))
|
||||
|
@ -228,8 +232,7 @@ class AttachVolumeShelveTestJSON(BaseAttachVolumeTest):
|
|||
volume = self.create_volume()
|
||||
num_vol = self._count_volumes(server, validation_resources)
|
||||
self._shelve_server(server, validation_resources)
|
||||
attachment = self.attach_volume(server, volume,
|
||||
device=('/dev/%s' % self.device))
|
||||
attachment = self.attach_volume(server, volume)
|
||||
|
||||
# Unshelve the instance and check that attached volume exists
|
||||
self._unshelve_server_and_check_volumes(
|
||||
|
@ -255,7 +258,7 @@ class AttachVolumeShelveTestJSON(BaseAttachVolumeTest):
|
|||
self._shelve_server(server, validation_resources)
|
||||
|
||||
# Attach and then detach the volume
|
||||
self.attach_volume(server, volume, device=('/dev/%s' % self.device))
|
||||
self.attach_volume(server, volume)
|
||||
self.servers_client.detach_volume(server['id'], volume['id'])
|
||||
waiters.wait_for_volume_resource_status(self.volumes_client,
|
||||
volume['id'], 'available')
|
||||
|
|
|
@ -35,9 +35,7 @@ class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
|
|||
def test_delete_attached_volume(self):
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
volume = self.create_volume()
|
||||
|
||||
path = "/dev/%s" % CONF.compute.volume_device_name
|
||||
self.attach_volume(server, volume, device=path)
|
||||
self.attach_volume(server, volume)
|
||||
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.delete_volume, volume['id'])
|
||||
|
|
Loading…
Reference in New Issue