Skip to content

Commit 41b7eee

Browse files
authored
Merge pull request #2043 from anshul1886/CLOUDSTACK-9876
CLOUDSTACK-9876: Removed test test_01_test_vm_volume_snapshot
2 parents 96700a0 + e82a635 commit 41b7eee

File tree

1 file changed

+1
-123
lines changed

1 file changed

+1
-123
lines changed

test/integration/smoke/test_vm_snapshots.py

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
from marvin.lib.base import (Account,
2424
ServiceOffering,
2525
VirtualMachine,
26-
VmSnapshot,
27-
Volume,
28-
Snapshot)
26+
VmSnapshot)
2927
from marvin.lib.common import (get_zone,
3028
get_domain,
3129
get_template,
@@ -279,123 +277,3 @@ def test_03_delete_vm_snapshots(self):
279277
None,
280278
"Check list vm snapshot has be deleted"
281279
)
282-
283-
class TestSnapshots(cloudstackTestCase):
284-
285-
@classmethod
286-
def setUpClass(cls):
287-
try:
288-
cls._cleanup = []
289-
cls.testClient = super(TestSnapshots, cls).getClsTestClient()
290-
cls.api_client = cls.testClient.getApiClient()
291-
cls.services = cls.testClient.getParsedTestDataConfig()
292-
cls.unsupportedHypervisor = False
293-
cls.hypervisor = cls.testClient.getHypervisorInfo()
294-
if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc", XEN_SERVER.lower()):
295-
cls.unsupportedHypervisor = True
296-
return
297-
# Get Domain, Zone, Template
298-
cls.domain = get_domain(cls.api_client)
299-
cls.zone = get_zone(
300-
cls.api_client,
301-
cls.testClient.getZoneForTests())
302-
cls.template = get_template(
303-
cls.api_client,
304-
cls.zone.id,
305-
cls.services["ostype"]
306-
)
307-
if cls.zone.localstorageenabled:
308-
cls.storagetype = 'local'
309-
cls.services["service_offerings"][
310-
"tiny"]["storagetype"] = 'local'
311-
else:
312-
cls.storagetype = 'shared'
313-
cls.services["service_offerings"][
314-
"tiny"]["storagetype"] = 'shared'
315-
316-
cls.services['mode'] = cls.zone.networktype
317-
cls.services["virtual_machine"]["hypervisor"] = cls.hypervisor
318-
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
319-
cls.services["virtual_machine"]["template"] = cls.template.id
320-
cls.services["custom_volume"]["zoneid"] = cls.zone.id
321-
# Creating Disk offering, Service Offering and Account
322-
cls.service_offering = ServiceOffering.create(
323-
cls.api_client,
324-
cls.services["service_offerings"]["tiny"]
325-
)
326-
cls._cleanup.append(cls.service_offering)
327-
cls.account = Account.create(
328-
cls.api_client,
329-
cls.services["account"],
330-
domainid=cls.domain.id
331-
)
332-
cls._cleanup.append(cls.account)
333-
except Exception as e:
334-
cls.tearDownClass()
335-
raise Exception("Warning: Exception in setup : %s" % e)
336-
return
337-
338-
def setUp(self):
339-
340-
self.apiclient = self.testClient.getApiClient()
341-
self.dbclient = self.testClient.getDbConnection()
342-
self.cleanup = []
343-
344-
if self.unsupportedHypervisor:
345-
self.skipTest("Skipping test because unsupported\
346-
hypervisor %s" % self.hypervisor)
347-
348-
def tearDown(self):
349-
# Clean up, terminate the created resources
350-
cleanup_resources(self.apiclient, self.cleanup)
351-
return
352-
353-
@classmethod
354-
def tearDownClass(cls):
355-
try:
356-
cleanup_resources(cls.api_client, cls._cleanup)
357-
except Exception as e:
358-
raise Exception("Warning: Exception during cleanup : %s" % e)
359-
360-
return
361-
362-
@attr(tags=["advanced", "basic", "smoke"], required_hardware="true")
363-
def test_01_test_vm_volume_snapshot(self):
364-
"""
365-
@Desc: Test that Volume snapshot for root volume is not allowed
366-
when VM snapshot is present for the VM
367-
@Steps:
368-
1: Deploy a VM and create a VM snapshot for VM
369-
2: Try to create snapshot for the root volume of the VM,
370-
It should expect Exception
371-
"""
372-
373-
# Creating Virtual Machine
374-
virtual_machine = VirtualMachine.create(
375-
self.apiclient,
376-
self.services["virtual_machine"],
377-
accountid=self.account.name,
378-
domainid=self.account.domainid,
379-
serviceofferingid=self.service_offering.id,
380-
)
381-
382-
VmSnapshot.create(
383-
self.apiclient,
384-
virtual_machine.id,
385-
)
386-
387-
volumes = Volume.list(self.apiclient,
388-
virtualmachineid=virtual_machine.id,
389-
type="ROOT",
390-
listall=True)
391-
392-
self.assertEqual(validateList(volumes)[0], PASS,
393-
"Failed to get root volume of the VM")
394-
395-
volume = volumes[0]
396-
397-
with self.assertRaises(Exception):
398-
Snapshot.create(self.apiclient,
399-
volume_id=volume.id)
400-
401-
return

0 commit comments

Comments
 (0)