def create_lun(self, volume_name, lun_name, size, metadata, qos_policy_group_name=None):
    'Issues API request for creating LUN on volume.'
    path = ('/vol/%s/%s' % (volume_name, lun_name))
    space_reservation = metadata['SpaceReserved']
    initial_size = size
    ontap_version = self.get_ontap_version()
    if (ontap_version < '9.5'):
        initial_size = MAX_SIZE_FOR_A_LUN
        space_reservation = 'false'
    params = {'path': path, 'size': str(initial_size), 'ostype': metadata['OsType'], 'space-reservation-enabled': space_reservation}
    version = self.get_ontapi_version()
    if (version >= (1, 110)):
        params['use-exact-size'] = 'true'
    lun_create = netapp_api.NaElement.create_node_with_children('lun-create-by-size', **params)
    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})
    if (ontap_version < '9.5'):
        self.do_direct_resize(path, six.text_type(size))
        if (metadata['SpaceReserved'] == 'true'):
            self.set_lun_space_reservation(path, True)
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))
    space_reservation = metadata['SpaceReserved']
    initial_size = size
    ontap_version = self.get_ontap_version()
    if (ontap_version < '9.5'):
        initial_size = MAX_SIZE_FOR_A_LUN
        space_reservation = 'false'
    params = {'path': path, 'size': str(initial_size), 'ostype': metadata['OsType'], 'space-reservation-enabled': space_reservation}
    version = self.get_ontapi_version()
    if (version >= (1, 110)):
        params['use-exact-size'] = 'true'
    lun_create = netapp_api.NaElement.create_node_with_children('lun-create-by-size', **params)
    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})
    if (ontap_version < '9.5'):
        self.do_direct_resize(path, six.text_type(size))
        if (metadata['SpaceReserved'] == 'true'):
            self.set_lun_space_reservation(path, True)