from oslo_log import log as logging
from oslo_utils import timeutils
from oslo_utils import units
+import six
from cinder import exception
from cinder.i18n import _, _LW
+from cinder import utils
from cinder.volume import configuration
from cinder.volume.drivers.netapp.dataontap import block_base
from cinder.volume.drivers.netapp.dataontap.client import client_7mode
LOG = logging.getLogger(__name__)
-class NetAppBlockStorage7modeLibrary(block_base.
- NetAppBlockStorageLibrary):
+@six.add_metaclass(utils.TraceWrapperMetaclass)
+class NetAppBlockStorage7modeLibrary(block_base.NetAppBlockStorageLibrary):
"""NetApp block storage library for Data ONTAP (7-mode)."""
def __init__(self, driver_name, driver_protocol, **kwargs):
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
+from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import api as na_api
from cinder.volume.drivers.netapp import options as na_opts
from cinder.volume.drivers.netapp import utils as na_utils
self.handle, self.name, self.size, self.metadata)
+@six.add_metaclass(utils.TraceWrapperMetaclass)
class NetAppBlockStorageLibrary(object):
"""NetApp block storage library for Data ONTAP."""
QOS_CLEANUP_INTERVAL_SECONDS = 60
-class NetAppBlockStorageCmodeLibrary(block_base.
- NetAppBlockStorageLibrary):
+@six.add_metaclass(utils.TraceWrapperMetaclass)
+class NetAppBlockStorageCmodeLibrary(block_base.NetAppBlockStorageLibrary):
"""NetApp block storage library for Data ONTAP (Cluster-mode)."""
REQUIRED_CMODE_FLAGS = ['netapp_vserver']
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Glenn Gobeli. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
+# Copyright (c) 2015 Alex Meade. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
from cinder import exception
from cinder.i18n import _
+from cinder import utils
LOG = logging.getLogger(__name__)
self._refresh_conn = True
def invoke_elem(self, na_element, enable_tunneling=False):
+ """Invoke the API on the server."""
+ return self.send_http_request(na_element, enable_tunneling)
+
+ @utils.trace_api
+ def send_http_request(self, na_element, enable_tunneling=False):
"""Invoke the API on the server."""
if na_element and not isinstance(na_element, NaElement):
ValueError('NaElement must be supplied to invoke API')
- request = self._create_request(na_element, enable_tunneling)
+
+ request, request_element = self._create_request(na_element,
+ enable_tunneling)
+
if not hasattr(self, '_opener') or not self._opener \
or self._refresh_conn:
self._build_opener()
raise NaApiError(e.code, e.msg)
except Exception as e:
raise NaApiError('Unexpected error', e)
- xml = response.read()
- return self._get_result(xml)
+
+ response_xml = response.read()
+ response_element = self._get_result(response_xml)
+
+ return response_element
def invoke_successfully(self, na_element, enable_tunneling=False):
"""Invokes API and checks execution status as success.
request = urllib.request.Request(
self._get_url(), data=request_d,
headers={'Content-Type': 'text/xml', 'charset': 'utf-8'})
- return request
+ return request, netapp_elem
def _enable_tunnel_request(self, netapp_elem):
"""Enables vserver or vfiler tunneling."""
return etree.tostring(self._element, method=method, encoding=encoding,
pretty_print=pretty)
+ def __str__(self):
+ return self.to_string(pretty=True)
+
+ def __repr__(self):
+ return str(self)
+
def __getitem__(self, key):
"""Dict getter method for NaElement.
from cinder import exception
from cinder.i18n import _, _LW
+from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.client import client_base
LOG = logging.getLogger(__name__)
+@six.add_metaclass(utils.TraceWrapperMetaclass)
class Client(client_base.Client):
def __init__(self, volume_list=None, **kwargs):
import six
from cinder.i18n import _LE, _LW, _LI
+from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
LOG = logging.getLogger(__name__)
+@six.add_metaclass(utils.TraceWrapperMetaclass)
class Client(object):
def __init__(self, **kwargs):
from cinder import exception
from cinder.i18n import _, _LW
+from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.client import client_base
from cinder.volume.drivers.netapp import utils as na_utils
DELETED_PREFIX = 'deleted_cinder_'
+@six.add_metaclass(utils.TraceWrapperMetaclass)
class Client(client_base.Client):
def __init__(self, **kwargs):
import os
from oslo_log import log as logging
+import six
from cinder import exception
from cinder.i18n import _
+from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import client_7mode
from cinder.volume.drivers.netapp.dataontap import nfs_base
from cinder.volume.drivers.netapp import options as na_opts
LOG = logging.getLogger(__name__)
+@six.add_metaclass(utils.TraceWrapperWithABCMetaclass)
class NetApp7modeNfsDriver(nfs_base.NetAppNfsDriver):
"""NetApp NFS driver for Data ONTAP (7-mode)."""
CONF = cfg.CONF
+@six.add_metaclass(utils.TraceWrapperWithABCMetaclass)
class NetAppNfsDriver(nfs.NfsDriver):
"""Base class for NetApp NFS driver for Data ONTAP."""
QOS_CLEANUP_INTERVAL_SECONDS = 60
+@six.add_metaclass(utils.TraceWrapperWithABCMetaclass)
class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver):
"""NetApp NFS driver for Data ONTAP (Cluster-mode)."""
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. All rights reserved.
+# Copyright (c) 2015 Alex Meade. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
return vol_str
+@utils.trace_method
def get_cluster_vols_with_ssc(na_server, vserver, volume=None):
"""Gets ssc vols for cluster vserver."""
volumes = query_cluster_vols_for_ssc(na_server, vserver, volume)
return volumes
+@utils.trace_method
def query_cluster_vols_for_ssc(na_server, vserver, volume=None):
"""Queries cluster volumes for ssc."""
query = {'volume-attributes': None}
return vols
+@utils.trace_method
def create_vol_list(vol_attrs):
"""Creates vol list with features from attr list."""
vols = set()
return vols
+@utils.trace_method
def query_aggr_options(na_server, aggr_name):
"""Queries cluster aggr for attributes.
return attrs
+@utils.trace_method
def get_sis_vol_dict(na_server, vserver, volume=None):
"""Queries sis for volumes.
return sis_vols
+@utils.trace_method
def get_snapmirror_vol_dict(na_server, vserver, volume=None):
"""Queries snapmirror volumes."""
mirrored_vols = {}
return mirrored_vols
+@utils.trace_method
def query_aggr_storage_disk(na_server, aggr):
"""Queries for storage disks associated to an aggregate."""
query = {'storage-disk-info': {'disk-raid-info':
return 'unknown'
+@utils.trace_method
def get_cluster_ssc(na_server, vserver):
"""Provides cluster volumes with ssc."""
netapp_volumes = get_cluster_vols_with_ssc(na_server, vserver)
return ssc_map
+@utils.trace_method
def refresh_cluster_stale_ssc(*args, **kwargs):
"""Refreshes stale ssc volumes with latest."""
backend = args[0]
na_utils.set_safe_attr(backend, 'refresh_stale_running', False)
+@utils.trace_method
def get_cluster_latest_ssc(*args, **kwargs):
"""Updates volumes including ssc."""
backend = args[0]
na_utils.set_safe_attr(backend, 'ssc_job_running', False)
+@utils.trace_method
def refresh_cluster_ssc(backend, na_server, vserver, synchronous=False):
"""Refresh cluster ssc for backend."""
if not isinstance(na_server, netapp_api.NaServer):
t.start()
+@utils.trace_method
def get_volumes_for_specs(ssc_vols, specs):
"""Shortlists volumes for extra specs provided."""
if specs is None or specs == {} or not isinstance(specs, dict):
return result
+@utils.trace_method
def check_ssc_api_permissions(client_cmode):
"""Checks backend SSC API permissions for the user."""
api_map = {'storage-disk-get-iter': ['netapp:disk_type'],