components/openstack/cinder/files/zfssa/zfssaiscsi.py
author Devjani Ray <devjani.ray@oracle.com>
Fri, 20 May 2016 17:42:29 -0400
branchs11u3-sru
changeset 6035 c9748fcc32de
permissions -rw-r--r--
PSARC 2015/535 OpenStack service updates for Kilo PSARC 2015/458 aioeventlet - asyncio event loop scheduling callbacks in eventlet PSARC 2015/460 msgpack - C/Python bindings for MessagePack (de)serializer data PSARC 2015/466 openstackclient - OpenStack Command-line Client PSARC 2015/467 oslo.versionedobjects - Oslo Versioned Objects library PSARC 2015/468 pint - A physical quantities module PSARC 2015/469 pysaml2 - A pure Python implementation of SAML2 PSARC 2015/471 semantic_version - A library implementing the 'SemVer' scheme PSARC 2015/472 testresources - PyUnit extension for managing expensive test resources PSARC 2015/473 testscenarios - Extensions to Python unittest to support scenarios PSARC 2015/474 trollius - Port of the Tulip project (asyncio module, PEP 3156) on Python 2 PSARC 2015/475 urllib3 - HTTP library with thread-safe connection pooling, file post, and more PSARC 2015/520 oslo.concurrency - Oslo Concurrency library PSARC 2015/521 oslo.log - Oslo Logging Configuration library PSARC 2015/529 oslo.policy - Oslo Policy library PSARC 2015/530 psutil - Python system and process utilities PSARC 2015/538 fixtures - Python module to support reusable state for writing clean tests PSARC 2015/539 sqlparse - An SQL parser module for Python PSARC 2016/017 extras - Useful extra utilities for Python PSARC 2016/018 linecache2 - Port of the standard linecache module PSARC 2016/019 python-mimeparse - Basic functions for parsing mime-types PSARC 2016/020 testtools - Extensions to the Python unit testing framework PSARC 2016/021 traceback2 - Port of the standard traceback module PSARC 2016/014 OpenStack Cinder NFS driver for Solaris PSARC/2016/010 cloudbase-init: Portable cloud image initialization PSARC/2016/130 Solaris OpenStack Puppet Extensions PSARC/2016/172 Making OpenStack Nova's image cache sharable PSARC/2016/001 OpenStack Puppet Modules PSARC/2016/016 Rename/Refactor Puppet and Puppet Module Packages PSARC/2015/368 Common Puppet Modules PSARC 2015/357 OpenStack Nova support for kernel zone suspend/resume 22384068 OpenStack service updates for Kilo (Umbrella) 23205460 Fix for 23192887 breaks Juno to Kilo upgrade with instances and floating IPs 23192887 Upgrade from Juno to Kilo fails (neutron-upgrade) due to typo 22878181 Neutron database tables not upgraded properly from Juno to Kilo schema 22935140 Kilo upgrade adds deprecated settings for rabbit and qpid 22935039 Kilo upgrade conf file migration errors 23027746 Metadata access broken with too many networks 23040216 extra zfssa_ prefix in the zfssa_iscsi.pp backend manifest 22992961 Update saz-memcached to 2.8.1 22992956 Update puppetlabs-stdlib to 4.11.0 22992951 Update puppetlabs-ntp to 4.1.2 22992946 Update puppetlabs-mysql to 3.6.2 22992926 Update puppetlabs-apache to 1.8.1 22992933 Update puppetlabs-inifile to 1.4.3 22999085 apache puppet module doesn't support ssl on Solaris 22985076 neutron_network provider always sets --shared on new networks 22813139 add zfssa cinder puppet modules 22902222 add NFS cinder puppet modules 22918553 update vpnaas and l3 agent puppet modules 22902853 Neutron/VPNaaS needs a workaround for 22902761 22827759 nova-compute still trips over itself when rad:local restarts 20990774 nova image cache bloats clone archives to godzilla size 22750945 Revert resize same host branded zones results in error status 18733958 nova tried to create x86 instance on SPARC 22220227 failure to apply zonecfg in attach_volume can leave debris in zonecfg 22935198 puppetlabs-mysql should define basedir in params.pp 22911268 Update puppetlabs-rabbitmq to 5.3.1 22852949 problem in PYTHON-MOD/DJANGO 22852962 problem in PYTHON-MOD/DJANGO 22819808 target_provision_state should not be set to AVAILABLE 22491714 Request to integrate OpenStack Puppet modules 22713569 nova-conductor doesn't handle RPC timeout during live-migration well 22695176 Miscellaneous package cleanup for Kilo 22694904 Some of the OpenStack patches can be cleaned up 22694680 Dependencies in several OpenStack service packages can be improved 22694592 Several configuration files should be more aligned with the upstream 22575858 problem in SERVICE/SWIFT 22047789 puppet package name and dependencies are confusing 22664785 Puppet module files should be owned by puppet 21460057 Add cloudbase-init to Solaris 21974208 The Python module msgpack should be added to Userland 22010630 The Python trollius module should be added to Userland 22011755 The Python module pint should be added to Userland 22012256 The Python aioeventlet module should be added to Userland 22012282 The Python oslo.versionedobjects module should be added to Userland 22012317 The Python semantic_version module should be added to Userland 22012321 The Python testresources module should be added to Userland 22012329 The Python testscenarios module should be added to Userland 22012336 The Python urllib3 module should be added to Userland 22012343 The Python openstackclient module should be added to Userland 22299389 The Python oslo.concurrency module should be added to Userland 22299409 The Python oslo.log module should be added to Userland 22299418 The Python oslo.policy module should be added to Userland 22299469 The Python psutil module should be added to Userland 22337793 The Python sqlparse module should be added to Userland 22338325 The Python fixtures module should be added to Userland 22535728 The Python testtools module should be added to Userland 22535739 The Python extras module should be added to Userland 22535748 The Python linecache2 module should be added to Userland 22535753 The Python traceback2 module should be added to Userland 22535760 The Python python-mimeparse module should be added to Userland 18961001 Image filtering does not function as expected 21678935 NFS for Cinder in Solaris OpenStack 22548630 derived manifest should not enforce presence of global when installing from UAR 22629795 problem in SERVICE/KEYSTONE 22151922 zones_suspend_path needs update based on post-PSARC discussion 21660603 passlib dependency needs to be added to Nova 22188197 puppetlabs-rabbitmq needs a patch to handle rabbitmqadmin 21756542 problem in SERVICE/SWIFT 21978756 addrconf addresses must be created for stateless and slaac Neutron subnets 21978743 ndpd.conf entries are incorrectly formatted for IPv6 subnets 21919000 neutron-dhcp-agent and neutron-server have timing issues 21918991 database times out when attempting various actions 21682493 Neutron fails due to mysql transaction locks when creating multiple instances 22024767 Remove annoying "Arguments dropped when creating context" logging 21691386 Request to integrate common puppet modules into Userland 21630128 Neutron needs to support updating subnet DNS configuration 21761279 Driver erroneously includes trailing space in zone.install() arguments 21438537 After update, openstack/keystone/keystone-token-flush not running 21630538 Nova driver should support suspend/resume 21542088 VM's display_name is used instead of hostname to set the hostname for VM 19774239 Nova should support setting the Admin Password 21439855 Console SMF instance remains after nova instance is deleted 21348400 Issues encountered via unit testing 21341088 Parsing manifest/profiles fails if multiple criteria present 21303465 edit image window has no ZFS disk format option 21091598 ceilometerclient's Makefile needs to point to its own PROJECT_URL 21164329 saharaclient COMPONENT_BUGDB points to the wrong subcomponent 20431382 keystone should include a periodic token cleanup job 21299660 enable no-gateway check box now that we support it 21135855 Enable gateway-less external networks 20230409 remove _get_zone_auto_install_state from driver.py 21022556 optional dependencies on rabbitmq need work in OpenStack services 22568587 heat denial of service through template-validate 22157556 RabbitMQ Warning: Mochiweb enabled and Erlang version 17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6035
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     1
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     2
#
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     4
#    not use this file except in compliance with the License. You may obtain
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     5
#    a copy of the License at
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     6
#
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     7
#         http://www.apache.org/licenses/LICENSE-2.0
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     8
#
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
     9
#    Unless required by applicable law or agreed to in writing, software
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    12
#    License for the specific language governing permissions and limitations
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    13
#    under the License.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    14
"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    15
ZFS Storage Appliance Cinder Volume Driver
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    16
"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    17
import ast
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    18
import base64
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    19
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    20
from oslo_config import cfg
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    21
from oslo_log import log
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    22
from oslo_utils import units
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    23
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    24
from cinder import exception
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    25
from cinder.i18n import _, _LE, _LW
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    26
from cinder.volume import driver
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    27
from cinder.volume.drivers.san import san
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    28
from cinder.volume.drivers.zfssa import zfssarest
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    29
from cinder.volume import volume_types
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    30
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    31
CONF = cfg.CONF
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    32
LOG = log.getLogger(__name__)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    33
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    34
ZFSSA_OPTS = [
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    35
    cfg.StrOpt('zfssa_pool',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    36
               help='Storage pool name.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    37
    cfg.StrOpt('zfssa_project',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    38
               help='Project name.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    39
    cfg.StrOpt('zfssa_lun_volblocksize', default='8k',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    40
               choices=['512', '1k', '2k', '4k', '8k', '16k', '32k', '64k',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    41
                        '128k'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    42
               help='Block size.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    43
    cfg.BoolOpt('zfssa_lun_sparse', default=False,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    44
                help='Flag to enable sparse (thin-provisioned): True, False.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    45
    cfg.StrOpt('zfssa_lun_compression', default='off',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    46
               choices=['off', 'lzjb', 'gzip-2', 'gzip', 'gzip-9'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    47
               help='Data compression.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    48
    cfg.StrOpt('zfssa_lun_logbias', default='latency',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    49
               choices=['latency', 'throughput'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    50
               help='Synchronous write bias.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    51
    cfg.StrOpt('zfssa_initiator_group', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    52
               help='iSCSI initiator group.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    53
    cfg.StrOpt('zfssa_initiator', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    54
               help='iSCSI initiator IQNs. (comma separated)'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    55
    cfg.StrOpt('zfssa_initiator_user', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    56
               help='iSCSI initiator CHAP user.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    57
    cfg.StrOpt('zfssa_initiator_password', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    58
               help='iSCSI initiator CHAP password.', secret=True),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    59
    cfg.StrOpt('zfssa_initiator_config', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    60
               help='iSCSI initiators configuration.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    61
    cfg.StrOpt('zfssa_target_group', default='tgt-grp',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    62
               help='iSCSI target group name.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    63
    cfg.StrOpt('zfssa_target_user', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    64
               help='iSCSI target CHAP user.'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    65
    cfg.StrOpt('zfssa_target_password', default='',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    66
               help='iSCSI target CHAP password.', secret=True),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    67
    cfg.StrOpt('zfssa_target_portal',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    68
               help='iSCSI target portal (Data-IP:Port, w.x.y.z:3260).'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    69
    cfg.StrOpt('zfssa_target_interfaces',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    70
               help='Network interfaces of iSCSI targets. (comma separated)'),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    71
    cfg.IntOpt('zfssa_rest_timeout',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    72
               help='REST connection timeout. (seconds)')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    73
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    74
]
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    75
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    76
CONF.register_opts(ZFSSA_OPTS)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    77
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    78
ZFSSA_LUN_SPECS = {'zfssa:volblocksize',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    79
                   'zfssa:sparse',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    80
                   'zfssa:compression',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    81
                   'zfssa:logbias'}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    82
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    83
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    84
def factory_zfssa():
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    85
    return zfssarest.ZFSSAApi()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    86
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    87
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    88
class ZFSSAISCSIDriver(driver.ISCSIDriver):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    89
    """ZFSSA Cinder volume driver"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    90
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    91
    VERSION = '1.0.0'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    92
    protocol = 'iSCSI'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    93
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    94
    def __init__(self, *args, **kwargs):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    95
        super(ZFSSAISCSIDriver, self).__init__(*args, **kwargs)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    96
        self.configuration.append_config_values(ZFSSA_OPTS)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    97
        self.configuration.append_config_values(san.san_opts)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    98
        self.zfssa = None
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
    99
        self._stats = None
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   100
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   101
    def _get_target_alias(self):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   102
        """return target alias"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   103
        return self.configuration.zfssa_target_group
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   104
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   105
    def do_setup(self, context):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   106
        """Setup - create multiple elements.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   107
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   108
        Project, initiators, initiatorgroup, target and targetgroup.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   109
        """
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   110
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   111
        msg = (_('Connecting to host: %s.') % lcfg.san_ip)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   112
        LOG.info(msg)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   113
        self.zfssa = factory_zfssa()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   114
        self.zfssa.set_host(lcfg.san_ip, timeout=lcfg.zfssa_rest_timeout)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   115
        auth_str = base64.encodestring('%s:%s' %
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   116
                                       (lcfg.san_login,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   117
                                        lcfg.san_password))[:-1]
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   118
        self.zfssa.login(auth_str)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   119
        self.zfssa.create_project(lcfg.zfssa_pool, lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   120
                                  compression=lcfg.zfssa_lun_compression,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   121
                                  logbias=lcfg.zfssa_lun_logbias)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   122
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   123
        if (lcfg.zfssa_initiator_config != ''):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   124
            initiator_config = ast.literal_eval(lcfg.zfssa_initiator_config)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   125
            for initiator_group in initiator_config:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   126
                zfssa_initiator_group = initiator_group
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   127
                for zfssa_initiator in initiator_config[zfssa_initiator_group]:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   128
                    self.zfssa.create_initiator(zfssa_initiator['iqn'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   129
                                                zfssa_initiator_group + '-' +
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   130
                                                zfssa_initiator['iqn'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   131
                                                chapuser=
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   132
                                                zfssa_initiator['user'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   133
                                                chapsecret=
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   134
                                                zfssa_initiator['password'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   135
                    if (zfssa_initiator_group != 'default'):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   136
                        self.zfssa.add_to_initiatorgroup(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   137
                            zfssa_initiator['iqn'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   138
                            zfssa_initiator_group)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   139
        else:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   140
            LOG.warning(_LW('zfssa_initiator_config not found. '
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   141
                            'Using deprecated configuration options.'))
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   142
            if (lcfg.zfssa_initiator != '' and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   143
                (lcfg.zfssa_initiator_group == '' or
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   144
                 lcfg.zfssa_initiator_group == 'default')):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   145
                LOG.warning(_LW('zfssa_initiator: %(ini)s'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   146
                                ' wont be used on '
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   147
                                'zfssa_initiator_group= %(inigrp)s.')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   148
                            % {'ini': lcfg.zfssa_initiator,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   149
                               'inigrp': lcfg.zfssa_initiator_group})
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   150
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   151
            # Setup initiator and initiator group
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   152
            if (lcfg.zfssa_initiator != '' and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   153
               lcfg.zfssa_initiator_group != '' and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   154
               lcfg.zfssa_initiator_group != 'default'):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   155
                for initiator in lcfg.zfssa_initiator.split(','):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   156
                    self.zfssa.create_initiator(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   157
                        initiator, lcfg.zfssa_initiator_group + '-' +
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   158
                        initiator, chapuser=lcfg.zfssa_initiator_user,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   159
                        chapsecret=lcfg.zfssa_initiator_password)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   160
                    self.zfssa.add_to_initiatorgroup(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   161
                        initiator, lcfg.zfssa_initiator_group)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   162
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   163
        # Parse interfaces
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   164
        interfaces = []
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   165
        for interface in lcfg.zfssa_target_interfaces.split(','):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   166
            if interface == '':
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   167
                continue
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   168
            interfaces.append(interface)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   169
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   170
        # Setup target and target group
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   171
        iqn = self.zfssa.create_target(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   172
            self._get_target_alias(),
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   173
            interfaces,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   174
            tchapuser=lcfg.zfssa_target_user,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   175
            tchapsecret=lcfg.zfssa_target_password)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   176
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   177
        self.zfssa.add_to_targetgroup(iqn, lcfg.zfssa_target_group)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   178
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   179
    def check_for_setup_error(self):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   180
        """Check that driver can login.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   181
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   182
        Check also pool, project, initiators, initiatorgroup, target and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   183
        targetgroup.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   184
        """
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   185
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   186
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   187
        self.zfssa.verify_pool(lcfg.zfssa_pool)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   188
        self.zfssa.verify_project(lcfg.zfssa_pool, lcfg.zfssa_project)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   189
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   190
        if (lcfg.zfssa_initiator_config != ''):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   191
            initiator_config = ast.literal_eval(lcfg.zfssa_initiator_config)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   192
            for initiator_group in initiator_config:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   193
                zfssa_initiator_group = initiator_group
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   194
                for zfssa_initiator in initiator_config[zfssa_initiator_group]:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   195
                    self.zfssa.verify_initiator(zfssa_initiator['iqn'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   196
        else:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   197
            if (lcfg.zfssa_initiator != '' and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   198
               lcfg.zfssa_initiator_group != '' and
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   199
               lcfg.zfssa_initiator_group != 'default'):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   200
                for initiator in lcfg.zfssa_initiator.split(','):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   201
                    self.zfssa.verify_initiator(initiator)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   202
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   203
            self.zfssa.verify_target(self._get_target_alias())
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   204
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   205
    def _get_provider_info(self, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   206
        """return provider information"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   207
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   208
        lun = self.zfssa.get_lun(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   209
                                 lcfg.zfssa_project, volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   210
        iqn = self.zfssa.get_target(self._get_target_alias())
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   211
        loc = "%s %s %s" % (lcfg.zfssa_target_portal, iqn, lun['number'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   212
        LOG.debug('_get_provider_info: provider_location: %s' % loc)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   213
        provider = {'provider_location': loc}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   214
        if lcfg.zfssa_target_user != '' and lcfg.zfssa_target_password != '':
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   215
            provider['provider_auth'] = ('CHAP %s %s' %
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   216
                                         lcfg.zfssa_target_user,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   217
                                         lcfg.zfssa_target_password)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   218
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   219
        return provider
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   220
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   221
    def create_volume(self, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   222
        """Create a volume on ZFSSA"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   223
        LOG.debug('zfssa.create_volume: volume=' + volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   224
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   225
        volsize = str(volume['size']) + 'g'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   226
        specs = self._get_voltype_specs(volume)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   227
        self.zfssa.create_lun(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   228
                              lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   229
                              volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   230
                              volsize,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   231
                              lcfg.zfssa_target_group,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   232
                              specs)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   233
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   234
    def delete_volume(self, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   235
        """Deletes a volume with the given volume['name']."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   236
        LOG.debug('zfssa.delete_volume: name=' + volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   237
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   238
        lun2del = self.zfssa.get_lun(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   239
                                     lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   240
                                     volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   241
        # Delete clone temp snapshot. see create_cloned_volume()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   242
        if 'origin' in lun2del and 'id' in volume:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   243
            if lun2del['nodestroy']:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   244
                self.zfssa.set_lun_props(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   245
                                         lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   246
                                         volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   247
                                         nodestroy=False)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   248
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   249
            tmpsnap = 'tmp-snapshot-%s' % volume['id']
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   250
            if lun2del['origin']['snapshot'] == tmpsnap:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   251
                self.zfssa.delete_snapshot(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   252
                                           lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   253
                                           lun2del['origin']['share'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   254
                                           lun2del['origin']['snapshot'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   255
                return
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   256
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   257
        self.zfssa.delete_lun(pool=lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   258
                              project=lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   259
                              lun=volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   260
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   261
    def create_snapshot(self, snapshot):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   262
        """Creates a snapshot with the given snapshot['name'] of the
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   263
           snapshot['volume_name']
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   264
        """
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   265
        LOG.debug('zfssa.create_snapshot: snapshot=' + snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   266
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   267
        self.zfssa.create_snapshot(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   268
                                   lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   269
                                   snapshot['volume_name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   270
                                   snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   271
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   272
    def delete_snapshot(self, snapshot):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   273
        """Deletes a snapshot."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   274
        LOG.debug('zfssa.delete_snapshot: snapshot=' + snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   275
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   276
        has_clones = self.zfssa.has_clones(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   277
                                           lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   278
                                           snapshot['volume_name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   279
                                           snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   280
        if has_clones:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   281
            LOG.error(_LE('Snapshot %s: has clones') % snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   282
            raise exception.SnapshotIsBusy(snapshot_name=snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   283
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   284
        self.zfssa.delete_snapshot(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   285
                                   lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   286
                                   snapshot['volume_name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   287
                                   snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   288
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   289
    def create_volume_from_snapshot(self, volume, snapshot):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   290
        """Creates a volume from a snapshot - clone a snapshot"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   291
        LOG.debug('zfssa.create_volume_from_snapshot: volume=' +
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   292
                  volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   293
        LOG.debug('zfssa.create_volume_from_snapshot: snapshot=' +
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   294
                  snapshot['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   295
        if not self._verify_clone_size(snapshot, volume['size'] * units.Gi):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   296
            exception_msg = (_('Error verifying clone size on '
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   297
                               'Volume clone: %(clone)s '
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   298
                               'Size: %(size)d on'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   299
                               'Snapshot: %(snapshot)s')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   300
                             % {'clone': volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   301
                                'size': volume['size'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   302
                                'snapshot': snapshot['name']})
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   303
            LOG.error(exception_msg)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   304
            raise exception.InvalidInput(reason=exception_msg)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   305
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   306
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   307
        self.zfssa.clone_snapshot(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   308
                                  lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   309
                                  snapshot['volume_name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   310
                                  snapshot['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   311
                                  volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   312
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   313
    def _update_volume_status(self):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   314
        """Retrieve status info from volume group."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   315
        LOG.debug("Updating volume status")
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   316
        self._stats = None
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   317
        data = {}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   318
        backend_name = self.configuration.safe_get('volume_backend_name')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   319
        data["volume_backend_name"] = backend_name or self.__class__.__name__
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   320
        data["vendor_name"] = 'Oracle'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   321
        data["driver_version"] = self.VERSION
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   322
        data["storage_protocol"] = self.protocol
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   323
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   324
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   325
        (avail, total) = self.zfssa.get_pool_stats(lcfg.zfssa_pool)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   326
        if avail is None or total is None:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   327
            return
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   328
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   329
        data['total_capacity_gb'] = int(total) / units.Gi
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   330
        data['free_capacity_gb'] = int(avail) / units.Gi
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   331
        data['reserved_percentage'] = 0
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   332
        data['QoS_support'] = False
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   333
        self._stats = data
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   334
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   335
    def get_volume_stats(self, refresh=False):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   336
        """Get volume status.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   337
           If 'refresh' is True, run update the stats first.
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   338
        """
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   339
        if refresh:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   340
            self._update_volume_status()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   341
        return self._stats
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   342
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   343
    def create_export(self, context, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   344
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   345
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   346
    def remove_export(self, context, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   347
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   348
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   349
    def ensure_export(self, context, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   350
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   351
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   352
    def copy_image_to_volume(self, context, volume, image_service, image_id):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   353
        self.ensure_export(context, volume)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   354
        super(ZFSSAISCSIDriver, self).copy_image_to_volume(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   355
            context, volume, image_service, image_id)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   356
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   357
    def extend_volume(self, volume, new_size):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   358
        """Driver entry point to extent volume size."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   359
        LOG.debug('extend_volume: volume name: %s' % volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   360
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   361
        self.zfssa.set_lun_props(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   362
                                 lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   363
                                 volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   364
                                 volsize=new_size * units.Gi)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   365
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   366
    def create_cloned_volume(self, volume, src_vref):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   367
        """Create a clone of the specified volume."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   368
        zfssa_snapshot = {'volume_name': src_vref['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   369
                          'name': 'tmp-snapshot-%s' % volume['id']}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   370
        self.create_snapshot(zfssa_snapshot)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   371
        try:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   372
            self.create_volume_from_snapshot(volume, zfssa_snapshot)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   373
        except exception.VolumeBackendAPIException:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   374
            LOG.error(_LE('Clone Volume:'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   375
                          '%(volume)s failed from source volume:'
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   376
                          '%(src_vref)s')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   377
                      % {'volume': volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   378
                         'src_vref': src_vref['name']})
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   379
            # Cleanup snapshot
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   380
            self.delete_snapshot(zfssa_snapshot)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   381
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   382
    def local_path(self, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   383
        """Not implemented"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   384
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   385
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   386
    def backup_volume(self, context, backup, backup_service):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   387
        """Not implemented"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   388
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   389
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   390
    def restore_backup(self, context, backup, volume, backup_service):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   391
        """Not implemented"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   392
        pass
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   393
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   394
    def _verify_clone_size(self, snapshot, size):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   395
        """Check whether the clone size is the same as the parent volume"""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   396
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   397
        lun = self.zfssa.get_lun(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   398
                                 lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   399
                                 snapshot['volume_name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   400
        return lun['size'] == size
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   401
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   402
    def initialize_connection(self, volume, connector):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   403
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   404
        init_groups = self.zfssa.get_initiator_initiatorgroup(
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   405
            connector['initiator'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   406
        for initiator_group in init_groups:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   407
            self.zfssa.set_lun_initiatorgroup(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   408
                                              lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   409
                                              volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   410
                                              initiator_group)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   411
        iscsi_properties = {}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   412
        provider = self._get_provider_info(volume)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   413
        (target_portal, iqn, lun) = provider['provider_location'].split()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   414
        iscsi_properties['target_discovered'] = False
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   415
        iscsi_properties['target_portal'] = target_portal
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   416
        iscsi_properties['target_iqn'] = iqn
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   417
        iscsi_properties['target_lun'] = lun
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   418
        iscsi_properties['volume_id'] = volume['id']
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   419
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   420
        if 'provider_auth' in provider:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   421
            (auth_method, auth_username, auth_password) = provider[
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   422
                'provider_auth'].split()
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   423
            iscsi_properties['auth_method'] = auth_method
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   424
            iscsi_properties['auth_username'] = auth_username
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   425
            iscsi_properties['auth_password'] = auth_password
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   426
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   427
        return {
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   428
            'driver_volume_type': 'iscsi',
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   429
            'data': iscsi_properties
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   430
        }
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   431
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   432
    def terminate_connection(self, volume, connector, **kwargs):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   433
        """Driver entry point to terminate a connection for a volume."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   434
        LOG.debug('terminate_connection: volume name: %s.' % volume['name'])
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   435
        lcfg = self.configuration
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   436
        self.zfssa.set_lun_initiatorgroup(lcfg.zfssa_pool,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   437
                                          lcfg.zfssa_project,
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   438
                                          volume['name'],
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   439
                                          '')
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   440
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   441
    def _get_voltype_specs(self, volume):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   442
        """Get specs suitable for volume creation."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   443
        vtype = volume.get('volume_type_id', None)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   444
        extra_specs = None
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   445
        if vtype:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   446
            extra_specs = volume_types.get_volume_type_extra_specs(vtype)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   447
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   448
        return self._get_specs(extra_specs)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   449
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   450
    def _get_specs(self, xspecs):
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   451
        """Return a dict with extra specs and/or config values."""
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   452
        result = {}
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   453
        for spc in ZFSSA_LUN_SPECS:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   454
            val = None
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   455
            prop = spc.split(':')[1]
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   456
            cfg = 'zfssa_lun_' + prop
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   457
            if xspecs:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   458
                val = xspecs.pop(spc, None)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   459
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   460
            if val is None:
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   461
                val = self.configuration.safe_get(cfg)
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   462
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   463
            if val is not None and val != '':
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   464
                result.update({prop: val})
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   465
c9748fcc32de PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents:
diff changeset
   466
        return result