~ubuntu-branches/ubuntu/saucy/cinder/saucy

« back to all changes in this revision

Viewing changes to cinder/tests/test_hds.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:
72
72
    init_index = 0              # initiator index
73
73
    target_index = 0            # target index
74
74
    hlun = 0                    # hlun index
 
75
    out = ''
75
76
 
76
77
    def __init__(self):
77
78
        self.start_lun = 0
103
104
        self.start_lun += 1
104
105
        return out
105
106
 
 
107
    def extend_vol(self, cmd, ver, ip0, ip1, user, pw, id, lu, size):
 
108
        out = ("LUN: %s successfully extended to %s MB" % (lu, size))
 
109
        SimulatedHusBackend.out = out
 
110
        return out
 
111
 
106
112
    def delete_lu(self, cmd, ver, ip0, ip1, user, pw, id, lun):
107
113
        out = ""
108
114
        if lun in self.alloc_lun:
132
138
        return out
133
139
 
134
140
    def del_iscsi_conn(self, cmd, ver, ip0, ip1, user, pw, id, lun, ctl, port,
135
 
                       iqn, initiator, force):
 
141
                       iqn, initiator):
136
142
        conn = ()
137
143
        for connection in SimulatedHusBackend.connections:
138
144
            if (connection[1] == lun):
165
171
        os.close(handle)
166
172
        SimulatedHusBackend.alloc_lun = []
167
173
        SimulatedHusBackend.connections = []
 
174
        SimulatedHusBackend.out = ''
168
175
        self.mox = mox.Mox()
169
176
        self.mox.StubOutWithMock(hds, 'factory_bend')
170
177
        hds.factory_bend().AndReturn(SimulatedHusBackend())
209
216
        num_luns_after = len(SimulatedHusBackend.alloc_lun)
210
217
        self.assertTrue(num_luns_before > num_luns_after)
211
218
 
 
219
    def test_extend_volume(self):
 
220
        vol = self.test_create_volume()
 
221
        new_size = _VOLUME['size'] * 2
 
222
        self.driver.extend_volume(vol, new_size)
 
223
        self.assertTrue(str(new_size * 1024) in
 
224
                        SimulatedHusBackend.out)
 
225
 
212
226
    def test_create_snapshot(self):
213
227
        vol = self.test_create_volume()
214
228
        self.mox.StubOutWithMock(self.driver, '_id_to_vol')
221
235
        svol['provider_location'] = loc['provider_location']
222
236
        return svol
223
237
 
 
238
    def test_create_clone(self):
 
239
        vol = self.test_create_volume()
 
240
        self.mox.StubOutWithMock(self.driver, '_id_to_vol')
 
241
        self.driver._id_to_vol(vol['volume_id']).AndReturn(vol)
 
242
        self.mox.ReplayAll()
 
243
        svol = vol.copy()
 
244
        svol['volume_size'] = svol['size']
 
245
        loc = self.driver.create_snapshot(svol)
 
246
        self.assertNotEqual(loc, None)
 
247
        svol['provider_location'] = loc['provider_location']
 
248
        return svol
 
249
 
224
250
    def test_delete_snapshot(self):
225
251
        """Delete a snapshot (test).
226
252
 
250
276
        vol = self.test_create_volume()
251
277
        self.mox.StubOutWithMock(self.driver, '_update_vol_location')
252
278
        conn = self.driver.initialize_connection(vol, connector)
253
 
        self.assertTrue('hitachi' in conn['data']['target_iqn'])
254
 
        self.assertTrue('3260' in conn['data']['target_portal'])
 
279
        self.assertIn('hitachi', conn['data']['target_iqn'])
 
280
        self.assertIn('3260', conn['data']['target_portal'])
255
281
        vol['provider_location'] = conn['data']['provider_location']
256
282
        return (vol, connector)
257
283