FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

CLOUDSTACK-8556: Unable to delete attached volume in cleanup by pritisarap12 · Pull Request #481 · apache/cloudstack · GitHub

Repository navigation

57 changes: 37 additions & 20 deletions test/integration/testpaths/testpath_snapshot_limits.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,51 @@ def tearDownClass(cls):
raise Exception("Warning: Exception during cleanup : %s" % e)

def setUp(self):

self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

cleanup has to be declared before skipping the test case

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Updated testpath as per the review comment.


if not self.snapshotSupported:
self.skipTest("Snapshots are not supported on %s" % self.hypervisor)
self.skipTest(
"Snapshots are not supported on %s" %
self.hypervisor)


def tearDown(self):
try:
data_volumes_list = Volume.list(
self.userapiclient,
id=self.data_volume_created.id,
virtualmachineid=self.vm.id
)
status = validateList(data_volumes_list)
self.assertEqual(
status[0],
PASS,
"DATA Volume List Validation Failed")

self.vm.detach_volume(
self.userapiclient,
data_volumes_list[0]
)

cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return

@attr(tags=["basic", "advanced"], required_hardware="true")
def test_05_storage_snapshots_limits(self):
def test_01_storage_snapshots_limits(self):
""" Storage and Snapshot Limit
1. Create Snapshot of ROOT disk.
2. Verify the Secondary Storage value\
2. Verify the Secondary Storage value
is increased by the size of snapshot.
3. Delete Snaphshot.
4. Verify the Secondary\
4. Verify the Secondary
Storage value is decreased by the size of snapshot.
5. Set the Snapshot limit of Account.
6. Create Snasphots till limit is reached.
7. Create Snapshot of ROOT Volume.\
7. Create Snapshot of ROOT Volume.
Creation should fail.
8. Delete few Snapshots.
9. Create Snapshot again.
Expand All @@ -159,7 +178,7 @@ def test_05_storage_snapshots_limits(self):

root_volume = root_volumes_list[0]

data_volume_created = Volume.create(
self.data_volume_created = Volume.create(
self.userapiclient,
self.testdata["volume"],
zoneid=self.zone.id,
Expand All @@ -168,20 +187,23 @@ def test_05_storage_snapshots_limits(self):
diskofferingid=self.disk_offering.id
)

self.cleanup.append(data_volume_created)
self.cleanup.append(self.data_volume_created)

self.vm.attach_volume(
data_volumes_list = Volume.list(
self.userapiclient,
data_volume_created
id=self.data_volume_created.id
)

data_volumes_list = Volume.list(
status = validateList(data_volumes_list)
self.assertEqual(status[0], PASS, "DATA Volume List Validation Failed")

self.data_volume = data_volumes_list[0]

self.vm.attach_volume(
self.userapiclient,
id=data_volume_created.id
self.data_volume
)

data_volume = data_volumes_list[0]

# Get Secondary Storage Value from Database
qryresult_before_snapshot = self.dbclient.execute(
" select id, account_name, secondaryStorageTotal\
Expand Down Expand Up @@ -304,7 +326,7 @@ def test_05_storage_snapshots_limits(self):
with self.assertRaises(Exception):
Snapshot.create(
self.userapiclient,
data_volume.id)
self.data_volume.id)

# Step 8
snapshot.delete(self.userapiclient)
Expand Down Expand Up @@ -336,9 +358,4 @@ def test_05_storage_snapshots_limits(self):
snapshots_list[0].state
)

self.vm.detach_volume(
self.userapiclient,
data_volumes_list[0]
)

return

Back | FazBrowse Home | New Git URL