| Peter Pentchev | 4c0dae0 | 2022-12-21 14:48:07 +0200 | [diff] [blame^] | 1 | From 51a9b386555228e1ba09f0ceebbe18f4b1783ef7 Mon Sep 17 00:00:00 2001 | 
|  | 2 | From: Peter Penchev <openstack-dev@storpool.com> | 
|  | 3 | Date: Wed, 14 Dec 2022 17:55:18 +0200 | 
|  | 4 | Subject: [PATCH 1/2] StorPool: drop copy_image_to_volume and | 
|  | 5 | copy_volume_to_image | 
|  | 6 |  | 
|  | 7 | These two methods do not do anything useful any more, and they actually | 
|  | 8 | get in the way of some new Cinder flows. | 
|  | 9 |  | 
|  | 10 | Change-Id: I2a7efc87c1bb87e8af66dc9b0cf8fa6289f55f97 | 
|  | 11 | --- | 
|  | 12 | cinder/volume/drivers/storpool.py | 61 ------------------------------- | 
|  | 13 | 1 file changed, 61 deletions(-) | 
|  | 14 |  | 
|  | 15 | diff --git a/cinder/volume/drivers/storpool.py b/cinder/volume/drivers/storpool.py | 
|  | 16 | index 64e92fe7e..b586c3216 100644 | 
|  | 17 | --- a/cinder/volume/drivers/storpool.py | 
|  | 18 | +++ b/cinder/volume/drivers/storpool.py | 
|  | 19 | @@ -434,67 +434,6 @@ class StorPoolDriver(driver.VolumeDriver): | 
|  | 20 | 'pools': pools | 
|  | 21 | } | 
|  | 22 |  | 
|  | 23 | -    def copy_volume_to_image(self, context, volume, image_service, image_meta): | 
|  | 24 | -        req_id = context.request_id | 
|  | 25 | -        volname = self._attach.volumeName(volume['id']) | 
|  | 26 | -        name = self._attach.volsnapName(volume['id'], req_id) | 
|  | 27 | -        try: | 
|  | 28 | -            self._attach.api().snapshotCreate(volname, {'name': name}) | 
|  | 29 | -            self._attach.add(req_id, { | 
|  | 30 | -                'volume': name, | 
|  | 31 | -                'type': 'copy-from', | 
|  | 32 | -                'id': req_id, | 
|  | 33 | -                'rights': 1, | 
|  | 34 | -                'volsnap': True | 
|  | 35 | -            }) | 
|  | 36 | -            self._attach.sync(req_id, None) | 
|  | 37 | -        except spapi.ApiError as e: | 
|  | 38 | -            raise self._backendException(e) | 
|  | 39 | -        try: | 
|  | 40 | -            return super(StorPoolDriver, self).copy_volume_to_image( | 
|  | 41 | -                context, volume, image_service, image_meta) | 
|  | 42 | -        finally: | 
|  | 43 | -            self._attach.remove(req_id) | 
|  | 44 | -            try: | 
|  | 45 | -                self._attach.sync(req_id, name) | 
|  | 46 | -            except spapi.ApiError as e: | 
|  | 47 | -                LOG.error( | 
|  | 48 | -                    'Could not detach the temp snapshot %(name)s for ' | 
|  | 49 | -                    '%(vol)s: %(err)s', | 
|  | 50 | -                    {'name': name, 'vol': volname, 'err': e}) | 
|  | 51 | -            try: | 
|  | 52 | -                self._attach.api().snapshotDelete(name) | 
|  | 53 | -            except spapi.ApiError as e: | 
|  | 54 | -                LOG.error( | 
|  | 55 | -                    'Could not remove the temp snapshot %(name)s for ' | 
|  | 56 | -                    '%(vol)s: %(err)s', | 
|  | 57 | -                    {'name': name, 'vol': volname, 'err': e}) | 
|  | 58 | - | 
|  | 59 | -    def copy_image_to_volume(self, context, volume, image_service, image_id): | 
|  | 60 | -        req_id = context.request_id | 
|  | 61 | -        name = self._attach.volumeName(volume['id']) | 
|  | 62 | -        self._attach.add(req_id, { | 
|  | 63 | -            'volume': name, | 
|  | 64 | -            'type': 'copy-to', | 
|  | 65 | -            'id': req_id, | 
|  | 66 | -            'rights': 2 | 
|  | 67 | -        }) | 
|  | 68 | -        try: | 
|  | 69 | -            self._attach.sync(req_id, None) | 
|  | 70 | -        except spapi.ApiError as e: | 
|  | 71 | -            raise self._backendException(e) | 
|  | 72 | -        try: | 
|  | 73 | -            return super(StorPoolDriver, self).copy_image_to_volume( | 
|  | 74 | -                context, volume, image_service, image_id) | 
|  | 75 | -        finally: | 
|  | 76 | -            self._attach.remove(req_id) | 
|  | 77 | -            try: | 
|  | 78 | -                self._attach.sync(req_id, name) | 
|  | 79 | -            except spapi.ApiError as e: | 
|  | 80 | -                LOG.error( | 
|  | 81 | -                    'Could not detach the %(name)s volume: %(err)s', | 
|  | 82 | -                    {'name': name, 'err': e}) | 
|  | 83 | - | 
|  | 84 | def extend_volume(self, volume, new_size): | 
|  | 85 | size = int(new_size) * units.Gi | 
|  | 86 | name = self._attach.volumeName(volume['id']) | 
|  | 87 | -- | 
|  | 88 | 2.35.1 | 
|  | 89 |  |