def map_lun(self, path, igroup_name, lun_id=None):
    'Maps LUN to the initiator and returns LUN id assigned.'
    lun_map = netapp_api.NaElement.create_node_with_children('lun-map', **{'path': path, 'initiator-group': igroup_name})
    if lun_id:
        lun_map.add_new_child('lun-id', lun_id)
    try:
        result = self.connection.invoke_successfully(lun_map, True)
        return result.get_child_content('lun-id-assigned')
    except netapp_api.NaApiError as e:
        code = e.code
        message = e.message
        LOG.warning('Error mapping LUN. Code :%(code)s, Message: %(message)s', {'code': code, 'message': message})
        raise
Maps LUN to the initiator and returns LUN id assigned.
def map_lun(self, path, igroup_name, lun_id=None):
    
    lun_map = netapp_api.NaElement.create_node_with_children('lun-map', **{'path': path, 'initiator-group': igroup_name})
    if lun_id:
        lun_map.add_new_child('lun-id', lun_id)
    try:
        result = self.connection.invoke_successfully(lun_map, True)
        return result.get_child_content('lun-id-assigned')
    except netapp_api.NaApiError as e:
        code = e.code
        message = e.message
        LOG.warning('Error mapping LUN. Code :%(code)s, Message: %(message)s', {'code': code, 'message': message})
        raise