slavkap commented on a change in pull request #5146:
URL: https://github.com/apache/cloudstack/pull/5146#discussion_r657201861



##########
File path: test/integration/smoke/test_volumes.py
##########
@@ -383,29 +367,22 @@ def setUp(self):
                     available")
 
     def tearDown(self):
-        #Clean up, terminate the created volumes
-        if self.attached:
-            self.virtual_machine.get_ssh_client(reconnect = True)
-
-            self.virtual_machine.detach_volume(self.apiClient, self.volume)
-
         if self.virtual_machine.hypervisor == "KVM":
             self.virtual_machine.stop(self.apiClient)
+            if self.attached:
+                self.virtual_machine.detach_volume(self.apiClient, self.volume)
             self.virtual_machine.start(self.apiClient)
-            self.virtual_machine.get_ssh_client(reconnect = True)
-
+            self.virtual_machine.get_ssh_client(reconnect=True)

Review comment:
       ```suggestion
           if self.virtual_machine.hypervisor == "KVM":
               self.virtual_machine.stop(self.apiClient)
               if self.attached:
                   self.virtual_machine.detach_volume(self.apiClient, 
self.volume)
               self.virtual_machine.start(self.apiClient)
               try:
                   self.virtual_machine.get_ssh_client(reconnect=True)
               except Exception as err:
                   self.fail("SSH failed for Virtual machine: %s due to %s" % 
                   self.virtual_machine.ipaddress, err)
           elif self.attached:
               self.virtual_machine.detach_volume(self.apiClient, self.volume)
                
   ```
   Actually, it should be like this. The detach should be executed no matter 
what type is the hypervisor




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to