"Fossies" - the Fresh Open Source Software Archive

Member "cinder-17.1.0/cinder/volume/drivers/dell_emc/powerstore/driver.py" (8 Mar 2021, 4049 Bytes) of package /linux/misc/openstack/cinder-17.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "driver.py": 17.0.1_vs_17.1.0.

    1 # Copyright (c) 2020 Dell Inc. or its subsidiaries.
    2 # All Rights Reserved.
    3 #
    4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    5 # not use this file except in compliance with the License. You may obtain
    6 # a copy of the License at
    7 #
    8 #      http://www.apache.org/licenses/LICENSE-2.0
    9 #
   10 # Unless required by applicable law or agreed to in writing, software
   11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   13 # License for the specific language governing permissions and limitations
   14 # under the License.
   15 
   16 """Cinder driver for Dell EMC PowerStore."""
   17 
   18 from oslo_config import cfg
   19 
   20 from cinder import interface
   21 from cinder.volume import configuration
   22 from cinder.volume import driver
   23 from cinder.volume.drivers.dell_emc.powerstore import adapter
   24 from cinder.volume.drivers.dell_emc.powerstore.options import POWERSTORE_OPTS
   25 from cinder.volume.drivers.san import san
   26 
   27 
   28 CONF = cfg.CONF
   29 CONF.register_opts(POWERSTORE_OPTS, group=configuration.SHARED_CONF_GROUP)
   30 
   31 
   32 @interface.volumedriver
   33 class PowerStoreDriver(driver.VolumeDriver):
   34     """Dell EMC PowerStore Driver.
   35 
   36     .. code-block:: none
   37 
   38       Version history:
   39         1.0.0 - Initial version
   40         1.0.1 - Add CHAP support
   41     """
   42 
   43     VERSION = "1.0.1"
   44     VENDOR = "Dell EMC"
   45 
   46     # ThirdPartySystems wiki page
   47     CI_WIKI_NAME = "DellEMC_PowerStore_CI"
   48 
   49     def __init__(self, *args, **kwargs):
   50         super(PowerStoreDriver, self).__init__(*args, **kwargs)
   51 
   52         self.active_backend_id = kwargs.get("active_backend_id")
   53         self.adapter = None
   54         self.configuration.append_config_values(san.san_opts)
   55         self.configuration.append_config_values(POWERSTORE_OPTS)
   56 
   57     @staticmethod
   58     def get_driver_options():
   59         return POWERSTORE_OPTS
   60 
   61     def do_setup(self, context):
   62         storage_protocol = self.configuration.safe_get("storage_protocol")
   63         if (
   64                 storage_protocol and
   65                 storage_protocol.lower() == adapter.PROTOCOL_FC.lower()
   66         ):
   67             self.adapter = adapter.FibreChannelAdapter(self.active_backend_id,
   68                                                        self.configuration)
   69         else:
   70             self.adapter = adapter.iSCSIAdapter(self.active_backend_id,
   71                                                 self.configuration)
   72         self.adapter.do_setup()
   73 
   74     def check_for_setup_error(self):
   75         self.adapter.check_for_setup_error()
   76 
   77     def create_volume(self, volume):
   78         return self.adapter.create_volume(volume)
   79 
   80     def delete_volume(self, volume):
   81         return self.adapter.delete_volume(volume)
   82 
   83     def extend_volume(self, volume, new_size):
   84         return self.adapter.extend_volume(volume, new_size)
   85 
   86     def create_snapshot(self, snapshot):
   87         return self.adapter.create_snapshot(snapshot)
   88 
   89     def delete_snapshot(self, snapshot):
   90         return self.adapter.delete_snapshot(snapshot)
   91 
   92     def create_cloned_volume(self, volume, src_vref):
   93         return self.adapter.create_cloned_volume(volume, src_vref)
   94 
   95     def create_volume_from_snapshot(self, volume, snapshot):
   96         return self.adapter.create_volume_from_snapshot(volume, snapshot)
   97 
   98     def initialize_connection(self, volume, connector, **kwargs):
   99         return self.adapter.initialize_connection(volume, connector, **kwargs)
  100 
  101     def terminate_connection(self, volume, connector, **kwargs):
  102         return self.adapter.terminate_connection(volume, connector, **kwargs)
  103 
  104     def revert_to_snapshot(self, context, volume, snapshot):
  105         return self.adapter.revert_to_snapshot(volume, snapshot)
  106 
  107     def _update_volume_stats(self):
  108         stats = self.adapter.update_volume_stats()
  109         stats["driver_version"] = self.VERSION
  110         stats["vendor_name"] = self.VENDOR
  111         self._stats = stats
  112 
  113     def create_export(self, context, volume, connector):
  114         pass
  115 
  116     def ensure_export(self, context, volume):
  117         pass
  118 
  119     def remove_export(self, context, volume):
  120         pass