Skip to content

Commit

Permalink
CLOUDSTACK-9289:removing redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
nitt10prashant committed Mar 18, 2016
1 parent 9d89229 commit feb2030
Showing 1 changed file with 55 additions and 84 deletions.
139 changes: 55 additions & 84 deletions test/integration/component/test_deploy_vm_from_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,52 +221,23 @@ def test_02_create_vm_from_vmsnapshots_and_verify_data(self):

ssh.execute('rm -rf f%s' % i)

vm_from_snp_0 = VirtualMachine.create(
self.apiclient,
self.services["small"],
vmsnapshotid=vm_snp[0].id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering1.id,
mode=self.zone.networktype
)
ssh = vm_from_snp_0.get_ssh_client()

vm0_result = ssh.execute('cat f0')
self.assertEqual(result[0],
vm0_result,
"check vm0 data ")

vm_from_snp_1 = VirtualMachine.create(
self.apiclient,
self.services["small"],
vmsnapshotid=vm_snp[1].id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering1.id,
mode=self.zone.networktype
)
ssh = vm_from_snp_1.get_ssh_client()
for i in xrange(3):

vm1_result = ssh.execute('cat f1')
self.assertEqual(result[1],
vm1_result,
"check vm1 data ")
vm_from_snp_2 = VirtualMachine.create(
self.apiclient,
self.services["small"],
vmsnapshotid=vm_snp[2].id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering1.id,
mode=self.zone.networktype
)
ssh = vm_from_snp_2.get_ssh_client()
vm_from_snp = VirtualMachine.create(
self.apiclient,
self.services["small"],
vmsnapshotid=vm_snp[i].id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering1.id,
mode=self.zone.networktype
)
ssh = vm_from_snp.get_ssh_client()

vm2_result = ssh.execute('cat f2')
self.assertEqual(result[2],
vm2_result,
"check vm data ")
vm_result = ssh.execute('cat f%s' % i)
self.assertEqual(result[i],
vm_result,
"check vm%s data " % i)

@attr(tags=["basic", "advanced", "advancedns", "smoke"],
required_hardware="true")
Expand Down Expand Up @@ -295,11 +266,11 @@ def test_03_seed_template_from_vmsnapshot(self):
)
k = int(time.time() - tx1)
list_root_volume = Volume.list(
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid
)
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid
)
self.assertEqual(validateList(list_root_volume)[0],
PASS,
"check list volume responce")
Expand Down Expand Up @@ -329,9 +300,9 @@ def test_03_seed_template_from_vmsnapshot(self):

avg_time = reduce(lambda x, y: x + y, record_time) / len(record_time)
self.assertGreater(
k,
avg_time,
"check time taken to deploy vm after template seeding")
k,
avg_time,
"check time taken to deploy vm after template seeding")


class ExtractVolumeFromVmSnapshot(cloudstackTestCase):
Expand Down Expand Up @@ -442,22 +413,22 @@ def test_01_create_volume_from_vmsnapshot(self):
"""

list_attached_volume = Volume.list(
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')

self.assertEqual(validateList(list_attached_volume)[0],
PASS,
"check list volume responce")

createVolume = Volume.create_from_vmsnapshot(
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name)
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name)
list_attached_volume2 = Volume.list(self.apiclient,
id=createVolume.id,
account=self.account.name,
Expand Down Expand Up @@ -522,23 +493,23 @@ def test_02_create_volume_from_vmsnapshot(self):
"""

list_attached_volume = Volume.list(
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')

self.assertEqual(validateList(list_attached_volume)[0],
PASS,
"check list volume responce")

createVolume = Volume.create_from_vmsnapshot(
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name
)
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name
)
list_attached_volume2 = Volume.list(self.apiclient,
id=createVolume.id,
account=self.account.name,
Expand Down Expand Up @@ -582,23 +553,23 @@ def test_03_create_volume_from_vmsnapshot(self):
4-attach-detach volume
"""
list_attached_volume = Volume.list(
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')
self.apiclient,
virtualmachineid=self.virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid,
type='DATA')

self.assertEqual(validateList(list_attached_volume)[0],
PASS,
"check list volume responce")

createVolume = Volume.create_from_vmsnapshot(
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name
)
self.apiclient,
self.services,
vmsnapshotid=self.vm_snp.id,
volumeid=list_attached_volume[0].id,
account=self.account.name
)
list_attached_volume2 = Volume.list(self.apiclient,
id=createVolume.id,
account=self.account.name,
Expand Down

0 comments on commit feb2030

Please sign in to comment.