'Create a LUN between the specified LDEV and port-gid.'

def _run_add_lun(self, ldev, port, gid, lun=None):

    args = ['add', 'lun', '-port', '-'.join([port, gid]), '-ldev_id', ldev]
    ignore_error = [_LU_PATH_DEFINED]
    if lun:
        args.extend(['-lun_id', lun])
        ignore_error = [_ANOTHER_LDEV_MAPPED]
    result = self.run_raidcom(ignore_error=ignore_error, interval=_LUN_RETRY_INTERVAL, timeout=_LUN_MAX_WAITTIME, *args)
    if (not lun):
        if (result[0] == EX_CMDRJE):
            lun = self._find_lun(ldev, port, gid)
            LOG.debug('A    logical    unit    path    has    already    been    defined    in    the    specified    logical    device.    (LDEV:    %(ldev)s,    port:    %(port)s,    gid:    %(gid)s,    lun:    %(lun)s)', {'ldev': ldev, 'port': port, 'gid': gid, 'lun': lun})
        else:
            lun = find_value(result[1], 'lun')
    elif (_ANOTHER_LDEV_MAPPED in result[2]):
        utils.output_log(MSG.MAP_LDEV_FAILED, ldev=ldev, port=port, id=gid, lun=lun)
        return None
    LOG.debug('Created    logical    unit    path    to    the    specified    logical    device.    (LDEV:    %(ldev)s,    port:    %(port)s,    gid:    %(gid)s,    lun:    %(lun)s)', {'ldev': ldev, 'port': port, 'gid': gid, 'lun': lun})
    return lun
