¡@

Home 

OpenStack Study: xiv_ds8k.py

OpenStack Index

**** CubicPower OpenStack Study ****

# Copyright 2013 IBM Corp.

# Copyright (c) 2013 OpenStack Foundation

# 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

# a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

# License for the specific language governing permissions and limitations

# under the License.

#

# Authors:

# Erik Zaadi

# Avishay Traeger

"""

Unified Volume driver for IBM XIV and DS8K Storage Systems.

"""

from oslo.config import cfg

from cinder import exception

from cinder.openstack.common import importutils

from cinder.openstack.common import log as logging

from cinder.volume.drivers.san import san

xiv_ds8k_opts = [

cfg.StrOpt(

'xiv_ds8k_proxy',

default='xiv_ds8k_openstack.nova_proxy.XIVDS8KNovaProxy',

help='Proxy driver that connects to the IBM Storage Array'),

cfg.StrOpt(

'xiv_ds8k_connection_type',

default='iscsi',

help='Connection type to the IBM Storage Array'

' (fibre_channel|iscsi)'),

cfg.StrOpt(

'xiv_chap',

default='disabled',

help='CHAP authentication mode, effective only for iscsi'

' (disabled|enabled)'),

]

CONF = cfg.CONF

CONF.register_opts(xiv_ds8k_opts)

LOG = logging.getLogger(__name__)

**** CubicPower OpenStack Study ****

class XIVDS8KDriver(san.SanDriver):

"""Unified IBM XIV and DS8K volume driver."""

**** CubicPower OpenStack Study ****

    def __init__(self, *args, **kwargs):

        """Initialize the driver."""

        super(XIVDS8KDriver, self).__init__(*args, **kwargs)

        self.configuration.append_config_values(xiv_ds8k_opts)

        proxy = importutils.import_class(self.configuration.xiv_ds8k_proxy)

        #NOTE: All Array specific configurations are prefixed with:

        #"xiv_ds8k_array_"

        #These additional flags should be specified in the cinder.conf

        #preferably in each backend configuration.

        self.xiv_ds8k_proxy = proxy(

            {

                "xiv_ds8k_user": self.configuration.san_login,

                "xiv_ds8k_pass": self.configuration.san_password,

                "xiv_ds8k_address": self.configuration.san_ip,

                "xiv_ds8k_vol_pool": self.configuration.san_clustername,

                "xiv_ds8k_connection_type":

                self.configuration.xiv_ds8k_connection_type,

                "xiv_chap": self.configuration.xiv_chap

            },

            LOG,

            exception,

            driver=self)

**** CubicPower OpenStack Study ****

    def do_setup(self, context):

        """Setup and verify IBM XIV and DS8K Storage connection."""

        self.xiv_ds8k_proxy.setup(context)

**** CubicPower OpenStack Study ****

    def ensure_export(self, context, volume):

        """Ensure an export."""

        return self.xiv_ds8k_proxy.ensure_export(context, volume)

**** CubicPower OpenStack Study ****

    def create_export(self, context, volume):

        """Create an export."""

        return self.xiv_ds8k_proxy.create_export(context, volume)

**** CubicPower OpenStack Study ****

    def create_volume(self, volume):

        """Create a volume on the IBM XIV and DS8K Storage system."""

        return self.xiv_ds8k_proxy.create_volume(volume)

**** CubicPower OpenStack Study ****

    def delete_volume(self, volume):

        """Delete a volume on the IBM XIV and DS8K Storage system."""

        self.xiv_ds8k_proxy.delete_volume(volume)

**** CubicPower OpenStack Study ****

    def remove_export(self, context, volume):

        """Disconnect a volume from an attached instance."""

        return self.xiv_ds8k_proxy.remove_export(context, volume)

**** CubicPower OpenStack Study ****

    def initialize_connection(self, volume, connector):

        """Map the created volume."""

        return self.xiv_ds8k_proxy.initialize_connection(volume, connector)

**** CubicPower OpenStack Study ****

    def terminate_connection(self, volume, connector, **kwargs):

        """Terminate a connection to a volume."""

        return self.xiv_ds8k_proxy.terminate_connection(volume, connector)

**** CubicPower OpenStack Study ****

    def create_volume_from_snapshot(self, volume, snapshot):

        """Create a volume from a snapshot."""

        return self.xiv_ds8k_proxy.create_volume_from_snapshot(

            volume,

            snapshot)

**** CubicPower OpenStack Study ****

    def create_snapshot(self, snapshot):

        """Create a snapshot."""

        return self.xiv_ds8k_proxy.create_snapshot(snapshot)

**** CubicPower OpenStack Study ****

    def delete_snapshot(self, snapshot):

        """Delete a snapshot."""

        return self.xiv_ds8k_proxy.delete_snapshot(snapshot)

**** CubicPower OpenStack Study ****

    def get_volume_stats(self, refresh=False):

        """Get volume stats."""

        return self.xiv_ds8k_proxy.get_volume_stats(refresh)

**** CubicPower OpenStack Study ****

    def create_cloned_volume(self, tgt_volume, src_volume):

        """Create Cloned Volume."""

        return self.xiv_ds8k_proxy.create_cloned_volume(tgt_volume, src_volume)

**** CubicPower OpenStack Study ****

    def extend_volume(self, volume, new_size):

        """Extend Created Volume."""

        self.xiv_ds8k_proxy.extend_volume(volume, new_size)

**** CubicPower OpenStack Study ****

    def migrate_volume(self, context, volume, host):

        """Migrate the volume to the specified host."""

        return self.xiv_ds8k_proxy.migrate_volume(context, volume, host)