~ubuntu-branches/ubuntu/raring/cinder/raring-updates

« back to all changes in this revision

Viewing changes to cinder/volume/drivers/nexenta/volume.py

Tags: upstream-2013.1~g2
ImportĀ upstreamĀ versionĀ 2013.1~g2

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
nexenta_opts = [
37
37
    cfg.StrOpt('nexenta_host',
38
 
              default='',
39
 
              help='IP address of Nexenta SA'),
 
38
               default='',
 
39
               help='IP address of Nexenta SA'),
40
40
    cfg.IntOpt('nexenta_rest_port',
41
41
               default=2000,
42
42
               help='HTTP port to connect to Nexenta REST API server'),
94
94
        """
95
95
        if not self.nms.volume.object_exists(FLAGS.nexenta_volume):
96
96
            raise LookupError(_("Volume %s does not exist in Nexenta SA"),
97
 
                                    FLAGS.nexenta_volume)
 
97
                              FLAGS.nexenta_volume)
98
98
 
99
99
    @staticmethod
100
100
    def _get_zvol_name(volume_name):
130
130
            self.nms.zvol.destroy(self._get_zvol_name(volume['name']), '')
131
131
        except nexenta.NexentaException as exc:
132
132
            if "zvol has children" in exc.args[1]:
133
 
                raise exception.VolumeIsBusy
 
133
                raise exception.VolumeIsBusy(volume_name=volume['name'])
134
134
            else:
135
135
                raise
136
136
 
166
166
                '')
167
167
        except nexenta.NexentaException as exc:
168
168
            if "snapshot has dependent clones" in exc.args[1]:
169
 
                raise exception.SnapshotIsBusy
 
169
                raise exception.SnapshotIsBusy(snapshot_name=snapshot['name'])
170
170
            else:
171
171
                raise
172
172
 
198
198
                raise
199
199
            else:
200
200
                LOG.info(_('Ignored target creation error "%s"'
201
 
                                             ' while ensuring export'), exc)
 
201
                           ' while ensuring export'), exc)
202
202
        try:
203
203
            self.nms.stmf.create_targetgroup(target_group_name)
204
204
        except nexenta.NexentaException as exc:
206
206
                raise
207
207
            else:
208
208
                LOG.info(_('Ignored target group creation error "%s"'
209
 
                                             ' while ensuring export'), exc)
 
209
                           ' while ensuring export'), exc)
210
210
        try:
211
211
            self.nms.stmf.add_targetgroup_member(target_group_name,
212
212
                                                 target_name)
215
215
                raise
216
216
            else:
217
217
                LOG.info(_('Ignored target group member addition error "%s"'
218
 
                                             ' while ensuring export'), exc)
 
218
                           ' while ensuring export'), exc)
219
219
        try:
220
220
            self.nms.scsidisk.create_lu(zvol_name, {})
221
221
        except nexenta.NexentaException as exc:
223
223
                raise
224
224
            else:
225
225
                LOG.info(_('Ignored LU creation error "%s"'
226
 
                                             ' while ensuring export'), exc)
 
226
                           ' while ensuring export'), exc)
227
227
        try:
228
228
            self.nms.scsidisk.add_lun_mapping_entry(zvol_name, {
229
229
                'target_group': target_group_name,
233
233
                raise
234
234
            else:
235
235
                LOG.info(_('Ignored LUN mapping entry addition error "%s"'
236
 
                                             ' while ensuring export'), exc)
 
236
                           ' while ensuring export'), exc)
237
237
        return '%s:%s,1 %s' % (FLAGS.nexenta_host,
238
238
                               FLAGS.nexenta_iscsi_target_portal_port,
239
239
                               target_name)
269
269
        except nexenta.NexentaException as exc:
270
270
            # We assume that target group is already gone
271
271
            LOG.warn(_('Got error trying to destroy target group'
272
 
                ' %(target_group)s, assuming it is already gone: %(exc)s'),
273
 
                {'target_group': target_group_name, 'exc': exc})
 
272
                       ' %(target_group)s, assuming it is '
 
273
                       'already gone: %(exc)s'),
 
274
                     {'target_group': target_group_name, 'exc': exc})
274
275
        try:
275
276
            self.nms.iscsitarget.delete_target(target_name)
276
277
        except nexenta.NexentaException as exc:
277
278
            # We assume that target is gone as well
278
279
            LOG.warn(_('Got error trying to delete target %(target)s,'
279
 
                ' assuming it is already gone: %(exc)s'),
280
 
                {'target': target_name, 'exc': exc})
 
280
                       ' assuming it is already gone: %(exc)s'),
 
281
                     {'target': target_name, 'exc': exc})
 
282
 
 
283
    def copy_image_to_volume(self, context, volume, image_service, image_id):
 
284
        """Fetch the image from image_service and write it to the volume."""
 
285
        raise NotImplementedError()
 
286
 
 
287
    def copy_volume_to_image(self, context, volume, image_service, image_id):
 
288
        """Copy the volume to the specified image."""
 
289
        raise NotImplementedError()
 
290
 
 
291
    def create_cloned_volume(self, volume, src_vref):
 
292
        """Creates a clone of the specified volume."""
 
293
        raise NotImplementedError()