Cloudstack:4407 - Pending changes - Use extractTemplate API to get hypervisor specific template information.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4747b2ab Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4747b2ab Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4747b2ab Branch: refs/heads/pluggable_vm_snapshot Commit: 4747b2abfe8e44ab4b07b31e203b821d4236e5b0 Parents: 2ecf272 Author: Girish Shilamkar <gir...@clogeny.com> Authored: Thu Sep 5 02:32:11 2013 -0400 Committer: Sangeetha <sangeetha.hariha...@citrix.com> Committed: Mon Oct 14 17:21:22 2013 -0700 ---------------------------------------------------------------------- test/integration/component/test_accounts.py | 27 ++++++---- test/integration/component/test_blocker_bugs.py | 52 ++++++++++++-------- test/integration/component/test_stopped_vm.py | 18 +++++-- 3 files changed, 63 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4747b2ab/test/integration/component/test_accounts.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 1af408e..4c73c3a 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -77,13 +77,14 @@ class Services: "template": { "displaytext": "Public Template", "name": "Public template", - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "ostype": 'CentOS 5.3 (64-bit)', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, - "ostype": 'CentOS 5.3 (64-bit)', + "templatefilter": "self" }, "natrule": { "publicport": 22, @@ -731,8 +732,7 @@ class TestTemplateHierarchy(cloudstackTestCase): cls.services = Services().services # Get Zone settings cls.zone = get_zone(cls.api_client, cls.services) - cls.services['mode'] = cls.zone.networktype - cls.services["template"]["zoneid"] = cls.zone.id + cls.services['mode'] = cls.zone.networktype # Create domains, accounts and template cls.domain_1 = Domain.create( @@ -761,11 +761,18 @@ class TestTemplateHierarchy(cloudstackTestCase): domainid=cls.domain_2.id ) + builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id) + cls.services["template"]["url"] = builtin_info[0] + cls.services["template"]["hypervisor"] = builtin_info[1] + cls.services["template"]["format"] = builtin_info[2] + + # Register new template cls.template = Template.register( - cls.api_client, - cls.services["template"], - account=cls.account_1.name, - domainid=cls.domain_1.id + cls.api_client, + cls.services["template"], + zoneid=cls.zone.id, + account=cls.account_1.name, + domainid=cls.domain_1.id ) # Wait for template to download http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4747b2ab/test/integration/component/test_blocker_bugs.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index 2cdc270..62800f8 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -67,14 +67,14 @@ class Services: "publicport": 22, "protocol": 'TCP', }, - "templates": { + "template": { "displaytext": 'Template from snapshot', "name": 'Template from snapshot', "ostype": 'CentOS 5.3 (64-bit)', "templatefilter": 'self', - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, @@ -118,7 +118,7 @@ class TestTemplate(cloudstackTestCase): cls.zone = get_zone(cls.api_client, cls.services) cls.services['mode'] = cls.zone.networktype cls.services["virtual_machine"]["zoneid"] = cls.zone.id - cls.services["templates"]["zoneid"] = cls.zone.id + cls.services["template"]["zoneid"] = cls.zone.id cls.service_offering = ServiceOffering.create( cls.api_client, @@ -160,16 +160,26 @@ class TestTemplate(cloudstackTestCase): #2. Deploy VM using this template #3. Deploy VM should return password set in template. + builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) + self.services["template"]["url"] = builtin_info[0] + self.services["template"]["hypervisor"] = builtin_info[1] + self.services["template"]["format"] = builtin_info[2] + self.debug("Registering a new template") + # Register new template template = Template.register( - self.apiclient, - self.services["templates"], - zoneid=self.zone.id, - account=self.account.name, - domainid=self.account.domainid - ) - self.debug("Registering template with ID: %s" % template.id) + self.apiclient, + self.services["template"], + zoneid=self.zone.id, + account=self.account.name, + domainid=self.account.domainid + ) + self.debug( + "Registered a template of format: %s with ID: %s" % ( + self.services["template"]["format"], + template.id + )) try: # Wait for template to download template.download(self.apiclient) @@ -185,7 +195,7 @@ class TestTemplate(cloudstackTestCase): list_template_response = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id, zoneid=self.zone.id ) @@ -796,7 +806,7 @@ class TestTemplates(cloudstackTestCase): #Create template from volume template = Template.create( self.apiclient, - self.services["templates"], + self.services["template"], self.volume.id, account=self.account.name, domainid=self.account.domainid @@ -856,7 +866,7 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"] + self.services["template"] ) self.cleanup.append(template) @@ -864,7 +874,7 @@ class TestTemplates(cloudstackTestCase): templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -938,14 +948,14 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"], + self.services["template"], random_name=False ) self.debug("Created template from snapshot: %s" % template.id) templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -977,14 +987,14 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"], + self.services["template"], random_name=False ) templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -1000,7 +1010,7 @@ class TestTemplates(cloudstackTestCase): self.assertEqual( templates[0].name, - self.services["templates"]["name"], + self.services["template"]["name"], "Check the name of the template" ) return http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4747b2ab/test/integration/component/test_stopped_vm.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index 7fdefc9..3be9151 100644 --- a/test/integration/component/test_stopped_vm.py +++ b/test/integration/component/test_stopped_vm.py @@ -84,9 +84,9 @@ class Services: "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO }, "template": { - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, @@ -1522,6 +1522,13 @@ class TestDeployVMFromTemplate(cloudstackTestCase): self.services["account"], domainid=self.domain.id ) + + builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) + self.services["template"]["url"] = builtin_info[0] + self.services["template"]["hypervisor"] = builtin_info[1] + self.services["template"]["format"] = builtin_info[2] + + # Register new template self.template = Template.register( self.apiclient, self.services["template"], @@ -1529,6 +1536,11 @@ class TestDeployVMFromTemplate(cloudstackTestCase): account=self.account.name, domainid=self.account.domainid ) + self.debug( + "Registered a template of format: %s with ID: %s" % ( + self.services["template"]["format"], + self.template.id + )) try: self.template.download(self.apiclient) except Exception as e: