cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [12/40] git commit: updated refs/heads/master to f4133a7
Date Thu, 18 Dec 2014 11:56:32 GMT
CLOUDSTACK:8058: Fix test_reset_ssh_keypair.py for EIP setup

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9aefd9bf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9aefd9bf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9aefd9bf

Branch: refs/heads/master
Commit: 9aefd9bf4f580dd5954520b6b53909b1f732b7f8
Parents: bbebac7
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Thu Dec 11 10:16:25 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Thu Dec 11 17:48:17 2014 +0530

----------------------------------------------------------------------
 .../component/test_reset_ssh_keypair.py         | 45 ++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aefd9bf/test/integration/component/test_reset_ssh_keypair.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index 370e9a8..a2e743a 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -107,6 +107,15 @@ def wait_vm_start(apiclient, vmid, timeout, sleep):
 
     return timeout
 
+def SetPublicIpForVM(apiclient, vm):
+    """ List VM and set the publicip (if available) of VM
+    to ssh_ip attribute"""
+
+    vms = VirtualMachine.list(apiclient, id=vm.id, listall=True)
+    virtual_machine = vms[0]
+    if hasattr(vm, "publicip"):
+        vm.ssh_ip = virtual_machine.publicip
+    return vm
 
 class TestResetSSHKeypair(cloudstackTestCase):
 
@@ -353,6 +362,12 @@ class TestResetSSHKeypair(cloudstackTestCase):
                    % (virtual_machine.name, self.services["timeout"]))
 
         self.debug("SSH key path: %s" % str(keyPairFilePath))
+
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         try:
             virtual_machine.get_ssh_client(keyPairFileLocation=str(keyPairFilePath))
         except Exception as e:
@@ -462,6 +477,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -572,6 +592,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -683,6 +708,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1172,6 +1202,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (vms[0].name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1311,6 +1346,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1451,6 +1491,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(


Mime
View raw message