mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Cloudstack:4407 - Pending changes - Use extractTemplate API to get hypervisor specific template information.
This commit is contained in:
		
							parent
							
								
									2ecf272dac
								
							
						
					
					
						commit
						4747b2abfe
					
				| @ -77,13 +77,14 @@ class Services: | |||||||
|                          "template": { |                          "template": { | ||||||
|                                 "displaytext": "Public Template", |                                 "displaytext": "Public Template", | ||||||
|                                 "name": "Public template", |                                 "name": "Public template", | ||||||
|                                 "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", |                                 "ostype": 'CentOS 5.3 (64-bit)', | ||||||
|                                 "hypervisor": 'XenServer', |                                 "url": "", | ||||||
|                                 "format": 'VHD', |                                 "hypervisor": '', | ||||||
|  |                                 "format": '', | ||||||
|                                 "isfeatured": True, |                                 "isfeatured": True, | ||||||
|                                 "ispublic": True, |                                 "ispublic": True, | ||||||
|                                 "isextractable": True, |                                 "isextractable": True, | ||||||
|                                 "ostype": 'CentOS 5.3 (64-bit)', |                                 "templatefilter": "self" | ||||||
|                         }, |                         }, | ||||||
|                         "natrule": { |                         "natrule": { | ||||||
|                                     "publicport": 22, |                                     "publicport": 22, | ||||||
| @ -732,7 +733,6 @@ class TestTemplateHierarchy(cloudstackTestCase): | |||||||
|         # Get Zone settings |         # Get Zone settings | ||||||
|         cls.zone = get_zone(cls.api_client, cls.services) |         cls.zone = get_zone(cls.api_client, cls.services) | ||||||
|         cls.services['mode'] = cls.zone.networktype  |         cls.services['mode'] = cls.zone.networktype  | ||||||
|         cls.services["template"]["zoneid"] = cls.zone.id |  | ||||||
| 
 | 
 | ||||||
|         # Create domains, accounts and template |         # Create domains, accounts and template | ||||||
|         cls.domain_1 = Domain.create( |         cls.domain_1 = Domain.create( | ||||||
| @ -761,11 +761,18 @@ class TestTemplateHierarchy(cloudstackTestCase): | |||||||
|                             domainid=cls.domain_2.id |                             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.template = Template.register( | ||||||
|                                             cls.api_client, |                                         cls.api_client, | ||||||
|                                             cls.services["template"], |                                         cls.services["template"], | ||||||
|                                             account=cls.account_1.name, |                                         zoneid=cls.zone.id, | ||||||
|                                             domainid=cls.domain_1.id |                                         account=cls.account_1.name, | ||||||
|  |                                         domainid=cls.domain_1.id | ||||||
|                                         ) |                                         ) | ||||||
| 
 | 
 | ||||||
|         # Wait for template to download |         # Wait for template to download | ||||||
|  | |||||||
| @ -67,14 +67,14 @@ class Services: | |||||||
|                                     "publicport": 22, |                                     "publicport": 22, | ||||||
|                                     "protocol": 'TCP', |                                     "protocol": 'TCP', | ||||||
|                         }, |                         }, | ||||||
|                         "templates": { |                         "template": { | ||||||
|                                     "displaytext": 'Template from snapshot', |                                     "displaytext": 'Template from snapshot', | ||||||
|                                     "name": 'Template from snapshot', |                                     "name": 'Template from snapshot', | ||||||
|                                     "ostype": 'CentOS 5.3 (64-bit)', |                                     "ostype": 'CentOS 5.3 (64-bit)', | ||||||
|                                     "templatefilter": 'self', |                                     "templatefilter": 'self', | ||||||
|                                     "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", |                                     "url": "", | ||||||
|                                     "hypervisor": 'XenServer', |                                     "hypervisor": '', | ||||||
|                                     "format": 'VHD', |                                     "format": '', | ||||||
|                                     "isfeatured": True, |                                     "isfeatured": True, | ||||||
|                                     "ispublic": True, |                                     "ispublic": True, | ||||||
|                                     "isextractable": True, |                                     "isextractable": True, | ||||||
| @ -118,7 +118,7 @@ class TestTemplate(cloudstackTestCase): | |||||||
|         cls.zone = get_zone(cls.api_client, cls.services) |         cls.zone = get_zone(cls.api_client, cls.services) | ||||||
|         cls.services['mode'] = cls.zone.networktype |         cls.services['mode'] = cls.zone.networktype | ||||||
|         cls.services["virtual_machine"]["zoneid"] = cls.zone.id |         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.service_offering = ServiceOffering.create( | ||||||
|                                             cls.api_client, |                                             cls.api_client, | ||||||
| @ -160,16 +160,26 @@ class TestTemplate(cloudstackTestCase): | |||||||
|         #2. Deploy VM using this template |         #2. Deploy VM using this template | ||||||
|         #3. Deploy VM should return password set in 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") |         self.debug("Registering a new template") | ||||||
|  | 
 | ||||||
|         # Register new template |         # Register new template | ||||||
|         template = Template.register( |         template = Template.register( | ||||||
|                                     self.apiclient, |                                         self.apiclient, | ||||||
|                                     self.services["templates"], |                                         self.services["template"], | ||||||
|                                     zoneid=self.zone.id, |                                         zoneid=self.zone.id, | ||||||
|                                     account=self.account.name, |                                         account=self.account.name, | ||||||
|                                     domainid=self.account.domainid |                                         domainid=self.account.domainid | ||||||
|                                     ) |                                         ) | ||||||
|         self.debug("Registering template with ID: %s" % template.id) |         self.debug( | ||||||
|  |                 "Registered a template of format: %s with ID: %s" % ( | ||||||
|  |                                                                 self.services["template"]["format"], | ||||||
|  |                                                                 template.id | ||||||
|  |                                                                 )) | ||||||
|         try: |         try: | ||||||
|             # Wait for template to download |             # Wait for template to download | ||||||
|             template.download(self.apiclient) |             template.download(self.apiclient) | ||||||
| @ -185,7 +195,7 @@ class TestTemplate(cloudstackTestCase): | |||||||
|         list_template_response = Template.list( |         list_template_response = Template.list( | ||||||
|                                             self.apiclient, |                                             self.apiclient, | ||||||
|                                             templatefilter=\ |                                             templatefilter=\ | ||||||
|                                             self.services["templates"]["templatefilter"], |                                             self.services["template"]["templatefilter"], | ||||||
|                                             id=template.id, |                                             id=template.id, | ||||||
|                                             zoneid=self.zone.id |                                             zoneid=self.zone.id | ||||||
|                                             ) |                                             ) | ||||||
| @ -796,7 +806,7 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         #Create template from volume |         #Create template from volume | ||||||
|         template = Template.create( |         template = Template.create( | ||||||
|                                    self.apiclient, |                                    self.apiclient, | ||||||
|                                    self.services["templates"], |                                    self.services["template"], | ||||||
|                                    self.volume.id, |                                    self.volume.id, | ||||||
|                                    account=self.account.name, |                                    account=self.account.name, | ||||||
|                                    domainid=self.account.domainid |                                    domainid=self.account.domainid | ||||||
| @ -856,7 +866,7 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         template = Template.create_from_snapshot( |         template = Template.create_from_snapshot( | ||||||
|                                     self.apiclient, |                                     self.apiclient, | ||||||
|                                     snapshot, |                                     snapshot, | ||||||
|                                     self.services["templates"] |                                     self.services["template"] | ||||||
|                                     ) |                                     ) | ||||||
|         self.cleanup.append(template) |         self.cleanup.append(template) | ||||||
| 
 | 
 | ||||||
| @ -864,7 +874,7 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         templates = Template.list( |         templates = Template.list( | ||||||
|                                 self.apiclient, |                                 self.apiclient, | ||||||
|                                 templatefilter=\ |                                 templatefilter=\ | ||||||
|                                 self.services["templates"]["templatefilter"], |                                 self.services["template"]["templatefilter"], | ||||||
|                                 id=template.id |                                 id=template.id | ||||||
|                                 ) |                                 ) | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
| @ -938,14 +948,14 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         template = Template.create_from_snapshot( |         template = Template.create_from_snapshot( | ||||||
|                                     self.apiclient, |                                     self.apiclient, | ||||||
|                                     snapshot, |                                     snapshot, | ||||||
|                                     self.services["templates"], |                                     self.services["template"], | ||||||
|                                     random_name=False |                                     random_name=False | ||||||
|                                     ) |                                     ) | ||||||
|         self.debug("Created template from snapshot: %s" % template.id) |         self.debug("Created template from snapshot: %s" % template.id) | ||||||
|         templates = Template.list( |         templates = Template.list( | ||||||
|                                 self.apiclient, |                                 self.apiclient, | ||||||
|                                 templatefilter=\ |                                 templatefilter=\ | ||||||
|                                 self.services["templates"]["templatefilter"], |                                 self.services["template"]["templatefilter"], | ||||||
|                                 id=template.id |                                 id=template.id | ||||||
|                                 ) |                                 ) | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
| @ -977,14 +987,14 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         template = Template.create_from_snapshot( |         template = Template.create_from_snapshot( | ||||||
|                                     self.apiclient, |                                     self.apiclient, | ||||||
|                                     snapshot, |                                     snapshot, | ||||||
|                                     self.services["templates"], |                                     self.services["template"], | ||||||
|                                     random_name=False |                                     random_name=False | ||||||
|                                     ) |                                     ) | ||||||
| 
 | 
 | ||||||
|         templates = Template.list( |         templates = Template.list( | ||||||
|                                 self.apiclient, |                                 self.apiclient, | ||||||
|                                 templatefilter=\ |                                 templatefilter=\ | ||||||
|                                 self.services["templates"]["templatefilter"], |                                 self.services["template"]["templatefilter"], | ||||||
|                                 id=template.id |                                 id=template.id | ||||||
|                                 ) |                                 ) | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
| @ -1000,7 +1010,7 @@ class TestTemplates(cloudstackTestCase): | |||||||
| 
 | 
 | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
|                             templates[0].name, |                             templates[0].name, | ||||||
|                             self.services["templates"]["name"], |                             self.services["template"]["name"], | ||||||
|                             "Check the name of the template" |                             "Check the name of the template" | ||||||
|                         ) |                         ) | ||||||
|         return |         return | ||||||
|  | |||||||
| @ -84,9 +84,9 @@ class Services: | |||||||
|                     "mode": 'HTTP_DOWNLOAD',    # Downloading existing ISO |                     "mode": 'HTTP_DOWNLOAD',    # Downloading existing ISO | ||||||
|                 }, |                 }, | ||||||
|                 "template": { |                 "template": { | ||||||
|                     "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", |                     "url": "", | ||||||
|                     "hypervisor": 'XenServer', |                     "hypervisor": '', | ||||||
|                     "format": 'VHD', |                     "format": '', | ||||||
|                     "isfeatured": True, |                     "isfeatured": True, | ||||||
|                     "ispublic": True, |                     "ispublic": True, | ||||||
|                     "isextractable": True, |                     "isextractable": True, | ||||||
| @ -1522,6 +1522,13 @@ class TestDeployVMFromTemplate(cloudstackTestCase): | |||||||
|                             self.services["account"], |                             self.services["account"], | ||||||
|                             domainid=self.domain.id |                             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.template = Template.register( | ||||||
|                                         self.apiclient, |                                         self.apiclient, | ||||||
|                                         self.services["template"], |                                         self.services["template"], | ||||||
| @ -1529,6 +1536,11 @@ class TestDeployVMFromTemplate(cloudstackTestCase): | |||||||
|                                         account=self.account.name, |                                         account=self.account.name, | ||||||
|                                         domainid=self.account.domainid |                                         domainid=self.account.domainid | ||||||
|                                         ) |                                         ) | ||||||
|  |         self.debug( | ||||||
|  |                 "Registered a template of format: %s with ID: %s" % ( | ||||||
|  |                                                                 self.services["template"]["format"], | ||||||
|  |                                                                 self.template.id | ||||||
|  |                                                                 )) | ||||||
|         try: |         try: | ||||||
|             self.template.download(self.apiclient) |             self.template.download(self.apiclient) | ||||||
|         except Exception as e: |         except Exception as e: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user