~ubuntu-branches/ubuntu/utopic/cinder/utopic

« back to all changes in this revision

Viewing changes to cinder/volume/drivers/huawei/huawei_hvs.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Adam Gandelman, Chuck Short
  • Date: 2013-09-08 21:09:46 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20130908210946-3dbzq1jy5uji4wad
Tags: 1:2013.2~b3-0ubuntu1
[ James Page ]
* d/control: Switch ceph-common -> python-ceph inline with upstream
  refactoring of Ceph RBD driver, move to Suggests of python-cinder.
  (LP: #1190791). 

[ Adam Gandelman ]
* debian/patches/avoid_paramiko_vers_depends.patch: Dropped, no longer
  required.
* Add minimum requirement python-greenlet (>= 0.3.2).
* Add minimum requirement python-eventlet (>= 0.12.0).
* Add minimum requirement python-paramiko (>= 1.8).

[ Chuck Short ]
* New upstream release.
* debian/patches/skip-sqlachemy-failures.patch: Skip testfailures
  with sqlalchemy 0.8 until they are fixed upstream.
* debian/control: Add python-babel to build-depends.
* debian/control: Add python-novaclient to build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright (c) 2013 Huawei Technologies Co., Ltd.
 
4
# Copyright (c) 2013 OpenStack LLC.
 
5
# All Rights Reserved.
 
6
#
 
7
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
8
#    not use this file except in compliance with the License. You may obtain
 
9
#    a copy of the License at
 
10
#
 
11
#         http://www.apache.org/licenses/LICENSE-2.0
 
12
#
 
13
#    Unless required by applicable law or agreed to in writing, software
 
14
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
15
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
16
#    License for the specific language governing permissions and limitations
 
17
#    under the License.
 
18
"""
 
19
Volume Drivers for Huawei OceanStor HVS storage arrays.
 
20
"""
 
21
 
 
22
from cinder.volume import driver
 
23
from cinder.volume.drivers.huawei.rest_common import HVSCommon
 
24
 
 
25
 
 
26
class HuaweiHVSISCSIDriver(driver.ISCSIDriver):
 
27
    """ISCSI driver for Huawei OceanStor HVS storage arrays."""
 
28
 
 
29
    VERSION = '1.0.0'
 
30
 
 
31
    def __init__(self, *args, **kwargs):
 
32
        super(HuaweiHVSISCSIDriver, self).__init__(*args, **kwargs)
 
33
 
 
34
    def do_setup(self, context):
 
35
        """Instantiate common class and log in storage system."""
 
36
        self.common = HVSCommon(configuration=self.configuration)
 
37
        self.common.login()
 
38
 
 
39
    def check_for_setup_error(self):
 
40
        """Check configuration  file."""
 
41
        self.common._check_conf_file()
 
42
 
 
43
    def create_volume(self, volume):
 
44
        """Create a volume."""
 
45
        self.common.create_volume(volume)
 
46
 
 
47
    def create_volume_from_snapshot(self, volume, snapshot):
 
48
        """Create a volume from a snapshot."""
 
49
        self.common.create_volume_from_snapshot(volume, snapshot)
 
50
 
 
51
    def create_cloned_volume(self, volume, src_vref):
 
52
        """Create a clone of the specified volume."""
 
53
        self.common.create_cloned_volume(volume, src_vref)
 
54
 
 
55
    def delete_volume(self, volume):
 
56
        """Delete a volume."""
 
57
        self.common.delete_volume(volume)
 
58
 
 
59
    def create_snapshot(self, snapshot):
 
60
        """Create a snapshot."""
 
61
        self.common.create_snapshot(snapshot)
 
62
 
 
63
    def delete_snapshot(self, snapshot):
 
64
        """Delete a snapshot."""
 
65
        self.common.delete_snapshot(snapshot)
 
66
 
 
67
    def get_volume_stats(self, refresh=False):
 
68
        """Get volume stats."""
 
69
        data = self.common.update_volume_stats(refresh)
 
70
        backend_name = self.configuration.safe_get('volume_backend_name')
 
71
        data['volume_backend_name'] = backend_name or self.__class__.__name__
 
72
        data['storage_protocol'] = 'iSCSI'
 
73
        data['driver_version'] = self.VERSION
 
74
        return data
 
75
 
 
76
    def initialize_connection(self, volume, connector):
 
77
        """Map a volume to a host."""
 
78
        return self.common.initialize_connection_iscsi(volume, connector)
 
79
 
 
80
    def terminate_connection(self, volume, connector, **kwargs):
 
81
        """Terminate the map."""
 
82
        self.common.terminate_connection(volume, connector, **kwargs)
 
83
 
 
84
    def create_export(self, context, volume):
 
85
        """Export the volume."""
 
86
        pass
 
87
 
 
88
    def ensure_export(self, context, volume):
 
89
        """Synchronously recreate an export for a volume."""
 
90
        pass
 
91
 
 
92
    def remove_export(self, context, volume):
 
93
        """Remove an export for a volume."""
 
94
        pass
 
95
 
 
96
 
 
97
class HuaweiHVSFCDriver(driver.FibreChannelDriver):
 
98
    """FC driver for Huawei OceanStor HVS storage arrays."""
 
99
 
 
100
    VERSION = '1.0.0'
 
101
 
 
102
    def __init__(self, *args, **kwargs):
 
103
        super(HuaweiHVSFCDriver, self).__init__(*args, **kwargs)
 
104
 
 
105
    def do_setup(self, context):
 
106
        """Instantiate common class and log in storage system."""
 
107
        self.common = HVSCommon(configuration=self.configuration)
 
108
        self.common.login()
 
109
 
 
110
    def check_for_setup_error(self):
 
111
        """Check configuration  file."""
 
112
        self.common._check_conf_file()
 
113
 
 
114
    def create_volume(self, volume):
 
115
        """Create a volume."""
 
116
        self.common.create_volume(volume)
 
117
 
 
118
    def create_volume_from_snapshot(self, volume, snapshot):
 
119
        """Create a volume from a snapshot."""
 
120
        self.common.create_volume_from_snapshot(volume, snapshot)
 
121
 
 
122
    def create_cloned_volume(self, volume, src_vref):
 
123
        """Create a clone of the specified volume."""
 
124
        self.common.create_cloned_volume(volume, src_vref)
 
125
 
 
126
    def delete_volume(self, volume):
 
127
        """Delete a volume."""
 
128
        self.common.delete_volume(volume)
 
129
 
 
130
    def create_snapshot(self, snapshot):
 
131
        """Create a snapshot."""
 
132
        self.common.create_snapshot(snapshot)
 
133
 
 
134
    def delete_snapshot(self, snapshot):
 
135
        """Delete a snapshot."""
 
136
        self.common.delete_snapshot(snapshot)
 
137
 
 
138
    def get_volume_stats(self, refresh=False):
 
139
        """Get volume stats."""
 
140
        data = self.common.update_volume_stats(refresh)
 
141
        backend_name = self.configuration.safe_get('volume_backend_name')
 
142
        data['volume_backend_name'] = backend_name or self.__class__.__name__
 
143
        data['storage_protocol'] = 'FC'
 
144
        data['driver_version'] = self.VERSION
 
145
        return data
 
146
 
 
147
    def initialize_connection(self, volume, connector):
 
148
        """Map a volume to a host."""
 
149
        return self.common.initialize_connection_fc(volume, connector)
 
150
 
 
151
    def terminate_connection(self, volume, connector, **kwargs):
 
152
        """Terminate the map."""
 
153
        self.common.terminate_connection(volume, connector, **kwargs)
 
154
 
 
155
    def create_export(self, context, volume):
 
156
        """Export the volume."""
 
157
        pass
 
158
 
 
159
    def ensure_export(self, context, volume):
 
160
        """Synchronously recreate an export for a volume."""
 
161
        pass
 
162
 
 
163
    def remove_export(self, context, volume):
 
164
        """Remove an export for a volume."""
 
165
        pass