Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1578#discussion_r77756386
  
    --- Diff: test/integration/plugins/nuagevsp/nuageTestCase.py ---
    @@ -461,22 +547,27 @@ def create_NetworkAclRule(self, rule, 
traffic_type="Ingress", network=None, acl_
                                          )
     
         # ssh_into_VM - Gets into the shell of the given VM using its public IP
    -    def ssh_into_VM(self, vm, public_ip, reconnect=True):
    -        self.debug("SSH into VM with ID - %s on public IP address - %s" % 
(vm.id, public_ip.ipaddress.ipaddress))
    -        tries = 0
    -        while tries < 3:
    +    def ssh_into_VM(self, vm, public_ip, reconnect=True, 
negative_test=False):
    +        self.debug("SSH into VM with ID - %s on public IP address - %s" %
    +                   (vm.id, public_ip.ipaddress.ipaddress))
    +        tries = 1 if negative_test else 3
    +        while True:
                 try:
    -                ssh_client = 
vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress, reconnect=reconnect)
    +                ssh_client = vm.get_ssh_client(
    +                    ipaddress=public_ip.ipaddress.ipaddress,
    +                    reconnect=reconnect,
    +                    retries=3 if negative_test else 30
    +                )
    +                self.debug("Successful to SSH into VM with ID - %s on "
    +                           "public IP address - %s" %
    +                           (vm.id, public_ip.ipaddress.ipaddress))
    +                return ssh_client
                 except Exception as e:
                     self.debug("Failed to SSH into VM: %s" % e)
    -                self.debug("Waiting for the VM to be fully resolved for 
SSH connection...")
    -                time.sleep(120)
    +                tries -= 1
    +                if tries == 0:
    +                    raise e
    --- End diff --
    
    Please consider separating the retry logic into a utility function to make 
the code more readable and promote reuse.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to