MCPcopy Create free account
hub / github.com/apache/cloudstack / test_02_attach_volume

Method test_02_attach_volume

test/integration/smoke/test_volumes.py:391–434  ·  view source on GitHub ↗

Attach a created Volume to a Running VM # Validate the following # 1. shows list of volumes # 2. "Attach Disk" pop-up box will display with list of instances # 3. disk should be attached to instance successfully

(self)

Source from the content-addressed store, hash-verified

389
390 @attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
391 def test_02_attach_volume(self):
392 """Attach a created Volume to a Running VM
393 # Validate the following
394 # 1. shows list of volumes
395 # 2. "Attach Disk" pop-up box will display with list of instances
396 # 3. disk should be attached to instance successfully
397 """
398
399 self.debug(
400 "Attaching volume (ID: %s) to VM (ID: %s)" % (
401 self.volume.id,
402 self.virtual_machine.id
403 ))
404 self.virtual_machine.attach_volume(self.apiClient, self.volume)
405 self.attached = True
406 list_volume_response = Volume.list(
407 self.apiClient,
408 id=self.volume.id
409 )
410 self.assertEqual(
411 isinstance(list_volume_response, list),
412 True,
413 "Check list response returns a valid list"
414 )
415 self.assertNotEqual(
416 list_volume_response,
417 None,
418 "Check if volume exists in ListVolumes"
419 )
420 volume = list_volume_response[0]
421 self.assertNotEqual(
422 volume.virtualmachineid,
423 None,
424 "Check if volume state (attached) is reflected"
425 )
426 try:
427 # Format the attached volume to a known fs
428 format_volume_to_ext3(self.virtual_machine.get_ssh_client())
429
430 except Exception as e:
431
432 self.fail("SSH failed for VM: %s - %s" %
433 (self.virtual_machine.ipaddress, e))
434 return
435
436 @attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
437 def test_03_download_attached_volume(self):

Callers

nothing calls this directly

Calls 6

format_volume_to_ext3Function · 0.90
debugMethod · 0.80
assertEqualMethod · 0.80
listMethod · 0.65
attach_volumeMethod · 0.45
get_ssh_clientMethod · 0.45

Tested by

no test coverage detected