@@ -1577,8 +1577,7 @@ def test_11_register_reset_vm_sshkey(self):
15771577 new_keypair = SSHKeyPair .register (
15781578 self .userapiclient ,
15791579 name = "keypair1" ,
1580- publickey = "ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2"
1581- )
1580+ publickey = "ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2" )
15821581 self .assertIsNotNone (
15831582 new_keypair ,
15841583 "New Key pair generation failed"
@@ -2042,27 +2041,27 @@ def test_13_vm_nics(self):
20422041 )
20432042 status = validateList (list_vms_after )
20442043 self .assertEquals (
2045- PASS ,
2046- status [0 ],
2047- "Listing of VM failed"
2044+ PASS ,
2045+ status [0 ],
2046+ "Listing of VM failed"
20482047 )
20492048 vm = list_vms_after [0 ]
20502049 # Verifying that VM nics size is 1 now
20512050 vm_nics_after = vm .nic
20522051 self .assertIsNotNone (
2053- vm_nics_after ,
2054- "Nic not found for the deployed VM"
2052+ vm_nics_after ,
2053+ "Nic not found for the deployed VM"
20552054 )
20562055 self .assertEquals (
2057- 1 ,
2058- len (vm_nics_after ),
2059- "VM NIC's count is not matching"
2056+ 1 ,
2057+ len (vm_nics_after ),
2058+ "VM NIC's count is not matching"
20602059 )
20612060 # Verifying the nic network is same as the default nic network
20622061 self .assertEquals (
2063- network2 .id ,
2064- vm_nics_after [0 ].networkid ,
2065- "VM NIC is not same as expected"
2062+ network2 .id ,
2063+ vm_nics_after [0 ].networkid ,
2064+ "VM NIC is not same as expected"
20662065 )
20672066 return
20682067
@@ -2125,23 +2124,23 @@ def setUp(self):
21252124 self .apiClient = self .testClient .getApiClient ()
21262125 self .cleanup = []
21272126 self .account = Account .create (
2128- self .apiClient ,
2129- self .services ["account" ],
2130- domainid = self .domain .id
2131- )
2132- # Getting authentication for user in newly created Account
2127+ self .apiClient ,
2128+ self .services ["account" ],
2129+ domainid = self .domain .id
2130+ )
2131+ # Getting authentication for user in newly created Account
21332132 self .user = self .account .user [0 ]
21342133 self .userapiclient = self .testClient .getUserApiClient (
2135- self .user .username ,
2136- self .domain .name )
2134+ self .user .username ,
2135+ self .domain .name )
21372136 # Updating resource Limits
21382137 for i in range (0 , 8 ):
21392138 Resources .updateLimit (
2140- self .api_client ,
2141- account = self .account .name ,
2142- domainid = self .domain .id ,
2143- max = - 1 ,
2144- resourcetype = i
2139+ self .api_client ,
2140+ account = self .account .name ,
2141+ domainid = self .domain .id ,
2142+ max = - 1 ,
2143+ resourcetype = i
21452144 )
21462145 self .cleanup .append (self .account )
21472146
@@ -2239,6 +2238,7 @@ def test_13_attach_detach_iso(self):
22392238 vm_created ,
22402239 "VM creation failed"
22412240 )
2241+ self .cleanup .append (vm_created )
22422242 # Listing all the VMs for a user again for matching zone
22432243 list_vms_after = VirtualMachine .list (
22442244 self .userapiclient ,
@@ -2268,60 +2268,70 @@ def test_13_attach_detach_iso(self):
22682268 isofilter = "executable" ,
22692269 zoneid = self .zone .id
22702270 )
2271- # Verifying if size of the list is >= 1
2272- if isos_list is not None :
2273- iso_toattach = isos_list [0 ]
2274- # Attaching ISO listed to VM deployed
2275- VirtualMachine .attach_iso (
2276- vm_created ,
2277- self .userapiclient ,
2278- iso_toattach
2279- )
2280- list_vm = VirtualMachine .list (
2281- self .userapiclient ,
2282- id = vm_created .id
2283- )
2284- status = validateList (list_vm )
2285- self .assertEquals (
2286- PASS ,
2287- status [0 ],
2288- "VM listing by Id failed"
2289- )
2290- # Verifying that attached ISO details are present in VM
2291- self .assertEquals (
2292- iso_toattach .name ,
2293- list_vm [0 ].isoname ,
2294- "Attached ISO name is not matching"
2295- )
2296- self .assertEquals (
2297- iso_toattach .displaytext ,
2298- list_vm [0 ].isodisplaytext ,
2299- "Attached ISO display is not matching"
2300- )
2301- # Detaching ISO from VM
2302- VirtualMachine .detach_iso (
2303- vm_created ,
2304- self .userapiclient
2305- )
2306- list_vm = VirtualMachine .list (
2307- self .userapiclient ,
2308- id = vm_created .id
2309- )
2310- status = validateList (list_vm )
2311- self .assertEquals (
2312- PASS ,
2313- status [0 ],
2314- "VM listing by Id failed"
2315- )
2316- # Verifying that ISO details are NOT present in VM
2317- self .assertIsNone (
2318- list_vm [0 ].isoname ,
2319- "ISO not detached from VM"
2320- )
2271+
2272+ self .assertEqual (validateList (isos_list )[0 ],
2273+ PASS ,
2274+ "isos list validation failed" )
2275+
2276+ if self .hypervisor .lower () == "xenserver" :
2277+ isoDesc = "xen"
23212278 else :
2322- self .fail (
2323- "Executable ISO in Ready is not found in the given setup" )
2279+ isoDesc = "vmware"
2280+
2281+ validIsosToAttach = [iso for iso in isos_list
2282+ if isoDesc in iso .displaytext .lower ()]
2283+ if not validIsosToAttach :
2284+ self .skipTest (
2285+ "Valid ISO not present in setup suitable to attach to VM" )
23242286
2287+ iso_toattach = validIsosToAttach [0 ]
2288+ # Attaching ISO listed to VM deployed
2289+ VirtualMachine .attach_iso (
2290+ vm_created ,
2291+ self .userapiclient ,
2292+ iso_toattach
2293+ )
2294+ list_vm = VirtualMachine .list (
2295+ self .userapiclient ,
2296+ id = vm_created .id
2297+ )
2298+ status = validateList (list_vm )
2299+ self .assertEquals (
2300+ PASS ,
2301+ status [0 ],
2302+ "VM listing by Id failed"
2303+ )
2304+ # Verifying that attached ISO details are present in VM
2305+ self .assertEquals (
2306+ iso_toattach .name ,
2307+ list_vm [0 ].isoname ,
2308+ "Attached ISO name is not matching"
2309+ )
2310+ self .assertEquals (
2311+ iso_toattach .displaytext ,
2312+ list_vm [0 ].isodisplaytext ,
2313+ "Attached ISO display is not matching"
2314+ )
2315+ # Detaching ISO from VM
2316+ VirtualMachine .detach_iso (
2317+ vm_created ,
2318+ self .userapiclient
2319+ )
2320+ list_vm = VirtualMachine .list (
2321+ self .userapiclient ,
2322+ id = vm_created .id
2323+ )
2324+ status = validateList (list_vm )
2325+ self .assertEquals (
2326+ PASS ,
2327+ status [0 ],
2328+ "VM listing by Id failed"
2329+ )
2330+ # Verifying that ISO details are NOT present in VM
2331+ self .assertIsNone (
2332+ list_vm [0 ].isoname ,
2333+ "ISO not detached from VM"
2334+ )
23252335 return
23262336
23272337 @attr (tags = ["advanced" , "basic" ], required_hardware = "true" )
@@ -2870,9 +2880,9 @@ def test_16_list_vm_volumes_pagination(self):
28702880 )
28712881
28722882 self .assertEqual (
2873- len (volumes ),
2874- len (list_volumes_page1 ) - len (list_data_disks ),
2875- "The volumes number should match with (volumes initially\
2883+ len (volumes ),
2884+ len (list_volumes_page1 ) - len (list_data_disks ),
2885+ "The volumes number should match with (volumes initially\
28762886 present minus volumes detached" )
28772887
28782888 return
@@ -2980,11 +2990,11 @@ def test_17_running_vm_scaleup(self):
29802990 if service_offerings_list is not None :
29812991 for i in range (0 , len (service_offerings_list )):
29822992 if not ((current_so .cpunumber >
2983- service_offerings_list [i ].cpunumber or
2993+ service_offerings_list [i ].cpunumber or
29842994 current_so .cpuspeed >
2985- service_offerings_list [i ].cpuspeed or
2995+ service_offerings_list [i ].cpuspeed or
29862996 current_so .memory >
2987- service_offerings_list [i ].memory ) or
2997+ service_offerings_list [i ].memory ) or
29882998 (current_so .cpunumber ==
29892999 service_offerings_list [i ].cpunumber and
29903000 current_so .cpuspeed ==
@@ -2993,9 +3003,9 @@ def test_17_running_vm_scaleup(self):
29933003 service_offerings_list [i ].memory )):
29943004 if (current_so .storagetype ==
29953005 service_offerings_list [i ].storagetype ):
2996- so_exists = True
2997- new_so = service_offerings_list [i ]
2998- break
3006+ so_exists = True
3007+ new_so = service_offerings_list [i ]
3008+ break
29993009 # If service offering does not exists, then creating one service
30003010 # offering for scale up
30013011 if not so_exists :
0 commit comments