"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py" between
manila-8.1.2.tar.gz and manila-8.1.3.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Stein" series (maintained release).

lib_base.py  (manila-8.1.2):lib_base.py  (manila-8.1.3)
skipping to change at line 33 skipping to change at line 33
import datetime import datetime
import json import json
import math import math
import socket import socket
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_service import loopingcall from oslo_service import loopingcall
from oslo_utils import timeutils from oslo_utils import timeutils
from oslo_utils import units from oslo_utils import units
from oslo_utils import uuidutils
import six import six
from manila.common import constants from manila.common import constants
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.share.drivers.netapp.dataontap.client import api as netapp_api from manila.share.drivers.netapp.dataontap.client import api as netapp_api
from manila.share.drivers.netapp.dataontap.client import client_cmode from manila.share.drivers.netapp.dataontap.client import client_cmode
from manila.share.drivers.netapp.dataontap.cluster_mode import data_motion from manila.share.drivers.netapp.dataontap.cluster_mode import data_motion
from manila.share.drivers.netapp.dataontap.cluster_mode import performance from manila.share.drivers.netapp.dataontap.cluster_mode import performance
from manila.share.drivers.netapp.dataontap.protocols import cifs_cmode from manila.share.drivers.netapp.dataontap.protocols import cifs_cmode
skipping to change at line 126 skipping to change at line 127
self.configuration.append_config_values( self.configuration.append_config_values(
na_opts.netapp_provisioning_opts) na_opts.netapp_provisioning_opts)
self.configuration.append_config_values( self.configuration.append_config_values(
na_opts.netapp_data_motion_opts) na_opts.netapp_data_motion_opts)
self._licenses = [] self._licenses = []
self._client = None self._client = None
self._clients = {} self._clients = {}
self._ssc_stats = {} self._ssc_stats = {}
self._have_cluster_creds = None self._have_cluster_creds = None
self._revert_to_snapshot_support = False
self._cluster_info = {} self._cluster_info = {}
self._app_version = kwargs.get('app_version', 'unknown') self._app_version = kwargs.get('app_version', 'unknown')
na_utils.setup_tracing(self.configuration.netapp_trace_flags, na_utils.setup_tracing(self.configuration.netapp_trace_flags,
self.configuration.netapp_api_trace_pattern) self.configuration.netapp_api_trace_pattern)
self._backend_name = self.configuration.safe_get( self._backend_name = self.configuration.safe_get(
'share_backend_name') or driver_name 'share_backend_name') or driver_name
@na_utils.trace @na_utils.trace
def do_setup(self, context): def do_setup(self, context):
self._client = self._get_api_client() self._client = self._get_api_client()
self._have_cluster_creds = self._client.check_for_cluster_credentials() self._have_cluster_creds = self._client.check_for_cluster_credentials()
if self._have_cluster_creds is True: if self._have_cluster_creds is True:
self._set_cluster_info() self._set_cluster_info()
self._licenses = self._get_licenses()
self._revert_to_snapshot_support = self._check_snaprestore_license()
# Performance monitoring library # Performance monitoring library
self._perf_library = performance.PerformanceLibrary(self._client) self._perf_library = performance.PerformanceLibrary(self._client)
@na_utils.trace @na_utils.trace
def _set_cluster_info(self): def _set_cluster_info(self):
self._cluster_info['nve_support'] = ( self._cluster_info['nve_support'] = (
self._client.is_nve_supported() self._client.is_nve_supported()
and self._client.features.FLEXVOL_ENCRYPTION) and self._client.features.FLEXVOL_ENCRYPTION)
@na_utils.trace @na_utils.trace
def check_for_setup_error(self): def check_for_setup_error(self):
self._licenses = self._get_licenses()
self._start_periodic_tasks() self._start_periodic_tasks()
def _get_vserver(self, share_server=None): def _get_vserver(self, share_server=None):
raise NotImplementedError() raise NotImplementedError()
@na_utils.trace @na_utils.trace
def _get_api_client(self, vserver=None): def _get_api_client(self, vserver=None):
# Use cached value to prevent calls to system-get-ontapi-version. # Use cached value to prevent calls to system-get-ontapi-version.
client = self._clients.get(vserver) client = self._clients.get(vserver)
skipping to change at line 257 skipping to change at line 261
def _get_aggregate_space(self): def _get_aggregate_space(self):
aggregates = self._find_matching_aggregates() aggregates = self._find_matching_aggregates()
if self._have_cluster_creds: if self._have_cluster_creds:
return self._client.get_cluster_aggregate_capacities(aggregates) return self._client.get_cluster_aggregate_capacities(aggregates)
else: else:
return self._client.get_vserver_aggregate_capacities(aggregates) return self._client.get_vserver_aggregate_capacities(aggregates)
@na_utils.trace @na_utils.trace
def _check_snaprestore_license(self): def _check_snaprestore_license(self):
"""Check if snaprestore license is enabled.""" """Check if snaprestore license is enabled."""
if not self._licenses: if self._have_cluster_creds:
self._licenses = self._client.get_licenses() return 'snaprestore' in self._licenses
else:
return 'snaprestore' in self._licenses # NOTE: (felipe_rodrigues): workaround to find out whether the
# backend has the license: since without cluster credentials it
# cannot retrieve the ontap licenses, it sends a fake ONTAP
# "snapshot-restore-volume" request which is only available when
# the license exists. By the got error, it checks whether license
# is installed or not.
try:
self._client.restore_snapshot(
"fake_%s" % uuidutils.generate_uuid(dashed=False), "")
except netapp_api.NaApiError as e:
no_license = 'is not licensed'
LOG.debug('Fake restore_snapshot request failed: %s', e)
return not (e.code == netapp_api.EAPIERROR and
no_license in e.message)
# since it passed an empty snapshot, it should never get here
msg = _("Caught an unexpected behavior: the fake restore to "
"snapshot request using 'fake' volume and empty string "
"snapshot as argument has not failed.")
LOG.exception(msg)
raise exception.NetAppException(msg)
@na_utils.trace @na_utils.trace
def _get_aggregate_node(self, aggregate_name): def _get_aggregate_node(self, aggregate_name):
"""Get home node for the specified aggregate, or None.""" """Get home node for the specified aggregate, or None."""
if self._have_cluster_creds: if self._have_cluster_creds:
return self._client.get_node_for_aggregate(aggregate_name) return self._client.get_node_for_aggregate(aggregate_name)
else: else:
return None return None
def get_default_filter_function(self): def get_default_filter_function(self):
skipping to change at line 333 skipping to change at line 357
if self._have_cluster_creds: if self._have_cluster_creds:
# Get up-to-date node utilization metrics just once. # Get up-to-date node utilization metrics just once.
self._perf_library.update_performance_cache({}, self._ssc_stats) self._perf_library.update_performance_cache({}, self._ssc_stats)
qos_support = True qos_support = True
else: else:
qos_support = False qos_support = False
netapp_flexvol_encryption = self._cluster_info.get( netapp_flexvol_encryption = self._cluster_info.get(
'nve_support', False) 'nve_support', False)
revert_to_snapshot_support = self._check_snaprestore_license()
for aggr_name in sorted(aggregates): for aggr_name in sorted(aggregates):
reserved_percentage = self.configuration.reserved_share_percentage reserved_percentage = self.configuration.reserved_share_percentage
total_capacity_gb = na_utils.round_down(float( total_capacity_gb = na_utils.round_down(float(
aggr_space[aggr_name].get('total', 0)) / units.Gi) aggr_space[aggr_name].get('total', 0)) / units.Gi)
free_capacity_gb = na_utils.round_down(float( free_capacity_gb = na_utils.round_down(float(
aggr_space[aggr_name].get('available', 0)) / units.Gi) aggr_space[aggr_name].get('available', 0)) / units.Gi)
allocated_capacity_gb = na_utils.round_down(float( allocated_capacity_gb = na_utils.round_down(float(
aggr_space[aggr_name].get('used', 0)) / units.Gi) aggr_space[aggr_name].get('used', 0)) / units.Gi)
skipping to change at line 364 skipping to change at line 386
'free_capacity_gb': free_capacity_gb, 'free_capacity_gb': free_capacity_gb,
'allocated_capacity_gb': allocated_capacity_gb, 'allocated_capacity_gb': allocated_capacity_gb,
'qos': qos_support, 'qos': qos_support,
'reserved_percentage': reserved_percentage, 'reserved_percentage': reserved_percentage,
'dedupe': [True, False], 'dedupe': [True, False],
'compression': [True, False], 'compression': [True, False],
'netapp_flexvol_encryption': netapp_flexvol_encryption, 'netapp_flexvol_encryption': netapp_flexvol_encryption,
'thin_provisioning': [True, False], 'thin_provisioning': [True, False],
'snapshot_support': True, 'snapshot_support': True,
'create_share_from_snapshot_support': True, 'create_share_from_snapshot_support': True,
'revert_to_snapshot_support': revert_to_snapshot_support, 'revert_to_snapshot_support': self._revert_to_snapshot_support,
} }
# Add storage service catalog data. # Add storage service catalog data.
pool_ssc_stats = self._ssc_stats.get(aggr_name) pool_ssc_stats = self._ssc_stats.get(aggr_name)
if pool_ssc_stats: if pool_ssc_stats:
pool.update(pool_ssc_stats) pool.update(pool_ssc_stats)
# Add utilization info, or nominal value if not available. # Add utilization info, or nominal value if not available.
utilization = self._perf_library.get_node_utilization_for_pool( utilization = self._perf_library.get_node_utilization_for_pool(
aggr_name) aggr_name)
 End of changes. 7 change blocks. 
8 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)