Merge pull request #871 from sanju1010/vmsnap

CLOUDSTACK-8893: Fixing script as per the latest functionalityPlease check https://issues.apache.org/jira/browse/CLOUDSTACK-8893 for more details.

* pr/871:
  Modified test description
  CLOUDSTACK-8893: Fixing script as per the latest functionality

Signed-off-by: sanjeev <sanjeev@apache.org>
This commit is contained in:
sanjeev 2015-09-23 15:01:17 +05:30
commit 2f7852bc59

View File

@ -19,7 +19,7 @@
from marvin.codes import FAILED, KVM, PASS
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import random_gen, cleanup_resources, validateList
from marvin.lib.utils import random_gen, cleanup_resources, validateList, is_snapshot_on_nfs
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@ -28,7 +28,8 @@ from marvin.lib.base import (Account,
Snapshot)
from marvin.lib.common import (get_zone,
get_domain,
get_template)
get_template,
list_snapshots)
import time
@ -337,6 +338,7 @@ class TestSnapshots(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
if self.unsupportedHypervisor:
@ -360,12 +362,12 @@ class TestSnapshots(cloudstackTestCase):
@attr(tags=["advanced", "basic", "smoke"], required_hardware="true")
def test_01_test_vm_volume_snapshot(self):
"""
@Desc: Test that Volume snapshot for root volume not allowed
@Desc: Test that Volume snapshot for root volume is allowed
when VM snapshot is present for the VM
@Steps:
1: Deploy a VM and create a VM snapshot for VM
2: Try to create snapshot for the root volume of the VM,
It should fail
It should not fail
"""
# Creating Virtual Machine
@ -390,9 +392,25 @@ class TestSnapshots(cloudstackTestCase):
self.assertEqual(validateList(volumes)[0], PASS,
"Failed to get root volume of the VM")
volume = volumes[0]
with self.assertRaises(Exception):
Snapshot.create(self.apiclient,
volume_id=volume.id)
snapshot = Snapshot.create(
self.apiclient,
volumes[0].id,
account=self.account.name,
domainid=self.account.domainid
)
self.debug("Snapshot created: ID - %s" % snapshot.id)
snapshots = list_snapshots(
self.apiclient,
id=snapshot.id
)
self.assertEqual(
validateList(snapshots)[0],
PASS,
"Invalid snapshot list"
)
self.assertEqual(
snapshots[0].id,
snapshot.id,
"Check resource id in list resources call"
)
return