Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 66 additions & 1 deletion test/integration/component/test_escalations_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
DiskOffering,
Template,
listConfigurations)
from marvin.lib.common import (get_domain,
from marvin.lib.common import (get_domain,list_isos,
get_zone,
get_template)
from nose.plugins.attrib import attr
from ast import literal_eval
from marvin.codes import PASS
from marvin.cloudstackException import CloudstackAPIException

class TestVMware(cloudstackTestCase):

Expand Down Expand Up @@ -203,3 +204,67 @@ def test1_attach_volume_ide(self):
self.fail("Failed to attach data disk to RHEL vm whose root disk type is IDE")
return

@attr(tags=["advanced", "basic"], required_hardware="true")
def test2_attach_ISO_in_CentOSVM(self):
"""
@desc:Incorrect guest os mapping in vmware for CentOS 5.9 and above
Step1 :Register an CentOS 6.3 template
Step2 :Launch a VM
Step3: Try to attach VMware Tools ISO
Step4: Verify VMware tools ISO attached correctly
"""
self.hypervisor = str(get_hypervisor_type(self.api_client)).lower()
if self.hypervisor != "vmware":
self.skipTest("This test can be run only on vmware")
template = Template.register(
self.userapiclient,
self.services["CentOS6.3template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
self.debug(
"Registered a template with format {} and id {}".format(
self.services["CentOS6.3template"]["format"],template.id)
)
template.download(self.userapiclient)
self.cleanup.append(template)
vm = VirtualMachine.create(
self.userapiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
templateid=template.id,
zoneid=self.zone.id
)
self.cleanup.append(vm)
response = VirtualMachine.list(self.userapiclient,id=vm.id)
status = validateList(response)
self.assertEqual(status[0],PASS,"list vm response returned invalid list")
list_default_iso_response = list_isos(
self.api_client,
name="vmware-tools.iso",
account="system",
isready="true"
)
status = validateList(list_default_iso_response)
self.assertEquals(
PASS,
status[0],
"ISO list is empty")
self.debug(
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response)
self.assertEqual(status[0], PASS,"list vm response returned invalid list")
attachedIsoName=response[0].isoname;
self.assertEqual(attachedIsoName, "vmware-tools.iso", "vmware-tools.iso not attached")
return


9 changes: 9 additions & 0 deletions tools/marvin/marvin/config/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,15 @@
"ostype": "CentOS 5.6 (64-bit)"

},
"CentOS6.3template": {
"displaytext": "Centos",
"name": "Centos",
"passwordenabled": False,
"ostype": "CentOS 6.3 (64-bit)",
"url": "http://10.147.28.7/templates/centos63.ova",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share or host this ova publicly? Will this test fail for this URL/file not available in one's env.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, and this should be parameterised IMHO.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bhaisaab this is a simple centos template for vmware so nothing special about it. for this test to pass in one's environment he should have centos template uploaded in their http server and change the url accordingly .
If you have a place where we can share this file publicly i will be more than happy to upload it there. Not only this file, i will upload lot other files whose urls are a private http server mentioned in test_data.py

@remibergsma . I am not very keen to make it parameterised as this case is very specific to vmware hypervisor and centos templates

"format": "OVA",
"ispublic": "true"
},
"template_2": {
"displaytext": "Public Template",
"name": "Public template",
Expand Down