Exemplo n.º 1
0
 def wait_volume_until(
         self, volume_id,
         target_status='in_use', delay=1, max_wait=100, wait_cb=None):
     return wait(
         self.get_volume_details, (volume_id, ),
         lambda i: i['status'] == target_status,
         delay, max_wait, wait_cb)
Exemplo n.º 2
0
 def wait_volume_while(
         self, volume_id,
         current_status='creating', delay=1, max_wait=100, wait_cb=None):
     return wait(
         self.get_volume_details, (volume_id, ),
         lambda i: i['status'] != current_status,
         delay, max_wait, wait_cb)
Exemplo n.º 3
0
 def wait_port_until(
         self, port_id,
         target_status='BUILD', delay=1, max_wait=100, wait_cb=None):
     """Wait for port while in current_status"""
     return wait(
         self.get_port_details, (port_id, ),
         lambda i: i['status'] == target_status,
         delay, max_wait, wait_cb)
Exemplo n.º 4
0
 def wait_volume_until(self,
                       volume_id,
                       target_status='in_use',
                       delay=1,
                       max_wait=100,
                       wait_cb=None):
     return wait(self.get_volume_details, (volume_id, ),
                 lambda i: i['status'] == target_status, delay, max_wait,
                 wait_cb)
Exemplo n.º 5
0
 def wait_volume_while(self,
                       volume_id,
                       current_status='creating',
                       delay=1,
                       max_wait=100,
                       wait_cb=None):
     return wait(self.get_volume_details, (volume_id, ),
                 lambda i: i['status'] != current_status, delay, max_wait,
                 wait_cb)
Exemplo n.º 6
0
 def wait_server_until(
         self, server_id,
         target_status='ACTIVE', delay=1, max_wait=100, wait_cb=None):
     """Wait for server WHILE its status is target_status
     :param server_id: integer (str or int)
     :param target_status: (str) BUILD|ACTIVE|STOPPED|DELETED|REBOOT
     :param delay: time interval between retries
     :max_wait: (int) timeout in secconds
     :param wait_cb: if set a progressbar is used to show progress
     :returns: (str) the new mode if succesfull, (bool) False if timed out
     """
     return wait(
         self.get_server_details, (server_id, ),
         lambda i: i['status'] == target_status,
         delay, max_wait, wait_cb)
Exemplo n.º 7
0
 def wait_server_until(
         self, server_id,
         target_status='ACTIVE', delay=1, max_wait=100, wait_cb=None):
     """Wait for server WHILE its status is target_status
     :param server_id: integer (str or int)
     :param target_status: (str) BUILD|ACTIVE|STOPPED|DELETED|REBOOT
     :param delay: time interval between retries
     :max_wait: (int) timeout in secconds
     :param wait_cb: if set a progressbar is used to show progress
     :returns: (str) the new mode if succesfull, (bool) False if timed out
     """
     return wait(
         self.get_server_details, (server_id, ),
         lambda i: i['status'] == target_status,
         delay, max_wait, wait_cb)
Exemplo n.º 8
0
 def wait_volume(
         self, volume_id, stop=None, delay=1, timeout=100, wait_cb=None):
     """Wait (block) while the stop method returns True, poll for status
         each time
     :param volume_id: (str)
     :param stop: (method) takes the volume details dict as input, returns
         true if the blocking must stop. Default: wait while 'creating'
     :param delay: (int) seconds between polls
     :param timeout: (int) in seconds
     :param wait_cb: (method) optional call back method called after each
         poll, provided by the caller. Typically used to monitor progress
         Takes volume details dict as parameter
     """
     return wait(
         self.get_volume_details, (volume_id, ),
         stop or (lambda i: i['status'] != 'creating'),
         delay, timeout, wait_cb)
Exemplo n.º 9
0
 def wait_volume(self,
                 volume_id,
                 stop=None,
                 delay=1,
                 timeout=100,
                 wait_cb=None):
     """Wait (block) while the stop method returns True, poll for status
         each time
     :param volume_id: (str)
     :param stop: (method) takes the volume details dict as input, returns
         true if the blocking must stop. Default: wait while 'creating'
     :param delay: (int) seconds between polls
     :param timeout: (int) in seconds
     :param wait_cb: (method) optional call back method called after each
         poll, provided by the caller. Typically used to monitor progress
         Takes volume details dict as parameter
     """
     return wait(self.get_volume_details, (volume_id, ), stop
                 or (lambda i: i['status'] != 'creating'), delay, timeout,
                 wait_cb)