def _wait_for_drive_state_transition(self, drive, state,
                                         timeout=DRIVE_TRANSITION_TIMEOUT):

        start_time = time.time()

        while drive.status != state:
            drive = self.ex_get_drive(drive_id=drive.id)

            if drive.status == state:
                break

            current_time = time.time()
            delta = (current_time - start_time)

            if delta >= timeout:
                msg = ('Timed out while waiting for drive transition '
                       '(timeout=%s seconds)' % (timeout))
                raise Exception(msg)

            time.sleep(self.DRIVE_TRANSITION_SLEEP_INTERVAL)

        return drive
Wait for a drive to transition to the provided state.
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudsigma.py/CloudSigma_2_0_NodeDriver._wait_for_drive_state_transition