'Issues API request for creating LUN on volume.'

def create_lun(self, volume_name, lun_name, size, metadata, qos_policy_group_name=None):

    path = ('/vol/%s/%s' % (volume_name, lun_name))
    lun_create = netapp_api.NaElement.create_node_with_children('lun-create-by-size', **{'path': path, 'size': six.text_type(size), 'ostype': metadata['OsType'], 'space-reservation-enabled': metadata['SpaceReserved']})
    if qos_policy_group_name:
        lun_create.add_new_child('qos-policy-group', qos_policy_group_name)
    try:
        self.connection.invoke_successfully(lun_create, True)
    except netapp_api.NaApiError as ex:
        with excutils.save_and_reraise_exception():
            LOG.error('Error    provisioning    volume    %(lun_name)s    on    %(volume_name)s.    Details:    %(ex)s', {'lun_name': lun_name, 'volume_name': volume_name, 'ex': ex})
