cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject [1/3] git commit: updated refs/heads/master to b45fe24
Date Thu, 11 Dec 2014 12:24:46 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master fdb782ffc -> b45fe24e5


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/487bf5f5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/487bf5f5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/487bf5f5

Branch: refs/heads/master
Commit: 487bf5f57db72c3c462f2681610767daf95ac37e
Parents: fdb782f
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:54:00 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/487bf5f5/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