'Wait until the LDEV status changes to the specified status.'

def _check_ldev_status(self, ldev, delete=False):

    if (not delete):
        args = _LDEV_CREATED
        msg_id = MSG.LDEV_CREATION_WAIT_TIMEOUT
    else:
        args = _LDEV_DELETED
        msg_id = MSG.LDEV_DELETION_WAIT_TIMEOUT
    def _wait_for_ldev_status(start_time, ldev, *args):
        'Raise    True    if    the    LDEV    is    in    the    specified    status.'
        result = self.run_raidcom('get', 'ldev', '-ldev_id', ldev, do_raise=False, *args)
        if (not result[0]):
            raise loopingcall.LoopingCallDone()
        if utils.check_timeout(start_time, _LDEV_STATUS_WAITTIME):
            raise loopingcall.LoopingCallDone(False)
    loop = loopingcall.FixedIntervalLoopingCall(_wait_for_ldev_status, timeutils.utcnow(), ldev, *args)
    if (not loop.start(interval=_LDEV_CHECK_INTERVAL).wait()):
        msg = utils.output_log(msg_id, ldev=ldev)
        raise exception.VSPError(msg)
