Skip to content
Snippets Groups Projects
Commit 082f206b authored by Navneet's avatar Navneet
Browse files

Merge branch 'vol_test_fix-#153313660' into 'release-1.13.0'

[Delivers #153313660] Set the attached device's name to its correct value by querying the VM.



See merge request !3
parents 9f7f789b 7d6ff477
Branches
Tags v1.13.0
1 merge request!14Fixing perfkit requirements for python 2.7
......@@ -196,14 +196,23 @@ class OpenStackDisk(disk.BaseDisk):
def _WaitForVolumeAttachment(self, vm):
if self.id is None:
return
def get_attached_device_name(vm):
# List all the attached devices in chronological order
command = 'ls -tr $(find /dev/ -type b)'
stdout, stderr = vm.RemoteCommand(command)
device = stdout.splitlines()[-1] # Select last device
return device
cmd = os_utils.OpenStackCLICommand(self, 'volume', 'show', self.id)
stdout, stderr, _ = cmd.Issue()
if stderr:
raise errors.Error(stderr)
resp = json.loads(stdout)
attachments = resp['attachments']
self.device_path = self._GetDeviceFromAttachment(attachments)
msg = 'Remote volume %s has been attached to %s.' % (self.name, vm.name)
self.device_path = get_attached_device_name(vm)
msg = 'Remote volume %s has been attached to the server %s at %s.' % \
(self.name, vm.name, self.device_path)
logging.info(msg)
def _GetDeviceFromAttachment(self, attachments):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment