'Find an unused LDEV and return its LDEV number.'

def get_unused_ldev(self):

    if (not self.storage_info['ldev_range']):
        ldev_info = self.get_ldev_info(['ldev'], '-ldev_list', 'undefined', '-cnt', '1')
        ldev = ldev_info.get('ldev')
    else:
        ldev = self._find_unused_ldev_by_range()
    if (ldev is None):
        msg = utils.output_log(MSG.NO_AVAILABLE_RESOURCE, resource='LDEV')
        raise exception.VSPError(msg)
    return ldev
