Fix delete_keypair arg 85/59585/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Fri, 6 Jul 2018 17:44:35 +0000 (19:44 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Fri, 6 Jul 2018 17:44:35 +0000 (19:44 +0200)
It uses keypair name instead of id as expected by Shade.
It also increases timers as it boots an ubuntu VM.

Change-Id: I8cd131e7c7a94c8f6b0fcc54a4d75ef8af31b807
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/core/singlevm.py
functest/opnfv_tests/openstack/shaker/shaker.py

index 88e5155..61c74fd 100644 (file)
@@ -240,6 +240,7 @@ class SingleVm1(VmReady1):
     __logger = logging.getLogger(__name__)
     username = 'cirros'
     ssh_connect_timeout = 60
+    ssh_connect_loops = 6
 
     def __init__(self, **kwargs):
         if "case_name" not in kwargs:
@@ -294,7 +295,7 @@ class SingleVm1(VmReady1):
         self.__logger.debug("vm console: \n%s", p_console)
         ssh = paramiko.SSHClient()
         ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
-        for loop in range(6):
+        for loop in range(self.ssh_connect_loops):
             try:
                 ssh.connect(
                     fip.floating_ip_address,
@@ -367,7 +368,7 @@ class SingleVm1(VmReady1):
             self.cloud.delete_floating_ip(self.fip.id)
             self.cloud.delete_server(self.sshvm, wait=True)
             self.cloud.delete_security_group(self.sec.id)
-            self.cloud.delete_keypair(self.keypair.id)
+            self.cloud.delete_keypair(self.keypair.name)
             super(SingleVm1, self).clean()
         except Exception:  # pylint: disable=broad-except
             self.__logger.exception("Cannot clean all ressources")
index 70eb8a7..9899bb3 100644 (file)
@@ -36,6 +36,7 @@ class Shaker(singlevm.SingleVm2):
     flavor_disk = 3
     username = 'ubuntu'
     port = 9000
+    ssh_connect_loops = 12
 
     def prepare(self):
         super(Shaker, self).prepare()