|
27 | 27 | DiskOffering, |
28 | 28 | Template, |
29 | 29 | listConfigurations) |
30 | | -from marvin.lib.common import (get_domain, |
| 30 | +from marvin.lib.common import (get_domain,list_isos, |
31 | 31 | get_zone, |
32 | 32 | get_template) |
33 | 33 | from nose.plugins.attrib import attr |
34 | 34 | from ast import literal_eval |
35 | 35 | from marvin.codes import PASS |
| 36 | +from marvin.cloudstackException import CloudstackAPIException |
36 | 37 |
|
37 | 38 | class TestVMware(cloudstackTestCase): |
38 | 39 |
|
@@ -203,3 +204,67 @@ def test1_attach_volume_ide(self): |
203 | 204 | self.fail("Failed to attach data disk to RHEL vm whose root disk type is IDE") |
204 | 205 | return |
205 | 206 |
|
| 207 | + @attr(tags=["advanced", "basic"], required_hardware="true") |
| 208 | + def test2_attach_ISO_in_CentOSVM(self): |
| 209 | + """ |
| 210 | + @desc:Incorrect guest os mapping in vmware for CentOS 5.9 and above |
| 211 | + Step1 :Register an CentOS 6.3 template |
| 212 | + Step2 :Launch a VM |
| 213 | + Step3: Try to attach VMware Tools ISO |
| 214 | + Step4: Verify VMware tools ISO attached correctly |
| 215 | + """ |
| 216 | + self.hypervisor = str(get_hypervisor_type(self.api_client)).lower() |
| 217 | + if self.hypervisor != "vmware": |
| 218 | + self.skipTest("This test can be run only on vmware") |
| 219 | + template = Template.register( |
| 220 | + self.userapiclient, |
| 221 | + self.services["CentOS6.3template"], |
| 222 | + zoneid=self.zone.id, |
| 223 | + account=self.account.name, |
| 224 | + domainid=self.account.domainid, |
| 225 | + hypervisor=self.hypervisor |
| 226 | + ) |
| 227 | + self.debug( |
| 228 | + "Registered a template with format {} and id {}".format( |
| 229 | + self.services["CentOS6.3template"]["format"],template.id) |
| 230 | + ) |
| 231 | + template.download(self.userapiclient) |
| 232 | + self.cleanup.append(template) |
| 233 | + vm = VirtualMachine.create( |
| 234 | + self.userapiclient, |
| 235 | + self.services["virtual_machine"], |
| 236 | + accountid=self.account.name, |
| 237 | + domainid=self.account.domainid, |
| 238 | + serviceofferingid=self.service_offering.id, |
| 239 | + templateid=template.id, |
| 240 | + zoneid=self.zone.id |
| 241 | + ) |
| 242 | + self.cleanup.append(vm) |
| 243 | + response = VirtualMachine.list(self.userapiclient,id=vm.id) |
| 244 | + status = validateList(response) |
| 245 | + self.assertEqual(status[0],PASS,"list vm response returned invalid list") |
| 246 | + list_default_iso_response = list_isos( |
| 247 | + self.api_client, |
| 248 | + name="vmware-tools.iso", |
| 249 | + account="system", |
| 250 | + isready="true" |
| 251 | + ) |
| 252 | + status = validateList(list_default_iso_response) |
| 253 | + self.assertEquals( |
| 254 | + PASS, |
| 255 | + status[0], |
| 256 | + "ISO list is empty") |
| 257 | + self.debug( |
| 258 | + "Registered a ISO with name {}".format(list_default_iso_response[0].name)) |
| 259 | + try: |
| 260 | + vm.attach_iso(self.userapiclient,list_default_iso_response[0]) |
| 261 | + except CloudstackAPIException as e: |
| 262 | + self.fail("Attached ISO failed : %s" % e) |
| 263 | + response = VirtualMachine.list(self.userapiclient, id=vm.id) |
| 264 | + status = validateList(response) |
| 265 | + self.assertEqual(status[0], PASS,"list vm response returned invalid list") |
| 266 | + attachedIsoName=response[0].isoname; |
| 267 | + self.assertEqual(attachedIsoName, "vmware-tools.iso", "vmware-tools.iso not attached") |
| 268 | + return |
| 269 | + |
| 270 | + |
0 commit comments