Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A0CA9AB9 for ; Thu, 18 Dec 2014 11:56:24 +0000 (UTC) Received: (qmail 5381 invoked by uid 500); 18 Dec 2014 11:56:21 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 5268 invoked by uid 500); 18 Dec 2014 11:56:21 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 4870 invoked by uid 99); 18 Dec 2014 11:56:21 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Dec 2014 11:56:21 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6B475956B33; Thu, 18 Dec 2014 11:56:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dahn@apache.org To: commits@cloudstack.apache.org Date: Thu, 18 Dec 2014 11:56:32 -0000 Message-Id: <9c88404898ae426c9bfd1a152f31b6cf@git.apache.org> In-Reply-To: <580378ed4d8345b5aa62abac4953d2a0@git.apache.org> References: <580378ed4d8345b5aa62abac4953d2a0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/40] git commit: updated refs/heads/master to f4133a7 CLOUDSTACK:8058: Fix test_reset_ssh_keypair.py for EIP setup Signed-off-by: SrikanteswaraRao Talluri 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 Authored: Thu Dec 11 10:16:25 2014 +0530 Committer: SrikanteswaraRao Talluri 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(