blob: 74b04f2eda3340dffa5355688a51721e36e56dfd [file] [log] [blame]
Peter Pentchev5a9f8a62023-12-06 10:40:18 +02001From 682dc2d25fc7f04de77c8ea60e76189d5b714566 Mon Sep 17 00:00:00 2001
Peter Pentchev6ef0f072022-09-26 16:20:30 +03002From: Peter Penchev <openstack-dev@storpool.com>
3Date: Mon, 26 Sep 2022 16:04:36 +0300
Peter Pentchev5a9f8a62023-12-06 10:40:18 +02004Subject: [PATCH 04/10] StorPool: drop copy_image_to_volume() and
Peter Pentchev6ef0f072022-09-26 16:20:30 +03005 copy_volume_to_image()
6
7These methods seem to be leftovers from a bygone era when the parent
8driver could not or would not attach volumes safely.
9
10Change-Id: I6e1a9026e677aee6c7ccad908fe6f92dc253762a
Peter Pentchevacaaa382023-02-28 11:26:13 +020011Closes-Bug: #2002996
Peter Pentchev6ef0f072022-09-26 16:20:30 +030012---
13 cinder/volume/drivers/storpool.py | 43 -------------------------------
14 1 file changed, 43 deletions(-)
15
16diff --git a/cinder/volume/drivers/storpool.py b/cinder/volume/drivers/storpool.py
Peter Pentchev5a9f8a62023-12-06 10:40:18 +020017index d1c6f0ca5..37e36fd61 100644
Peter Pentchev6ef0f072022-09-26 16:20:30 +030018--- a/cinder/volume/drivers/storpool.py
19+++ b/cinder/volume/drivers/storpool.py
Peter Pentchev5a9f8a62023-12-06 10:40:18 +020020@@ -315,49 +315,6 @@ class StorPoolDriver(driver.VolumeDriver):
Peter Pentchev6ef0f072022-09-26 16:20:30 +030021 'pools': pools
22 }
23
24- def copy_volume_to_image(self, context, volume, image_service, image_meta):
25- req_id = context.request_id
26- volname = self._attach.volumeName(volume['id'])
27- name = self._attach.volsnapName(volume['id'], req_id)
28- try:
29- self._attach.api().snapshotCreate(volname, {'name': name})
30- except spapi.ApiError as e:
31- raise self._backendException(e)
32- self._attach.add(req_id, {
33- 'volume': name,
34- 'type': 'copy-from',
35- 'id': req_id,
36- 'rights': 1,
37- 'volsnap': True
38- })
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.api().snapshotDelete(name)
46- except spapi.ApiError as e:
47- LOG.error(
48- 'Could not remove the temp snapshot %(name)s for '
49- '%(vol)s: %(err)s',
50- {'name': name, 'vol': volname, 'err': e})
51-
52- def copy_image_to_volume(self, context, volume, image_service, image_id):
53- req_id = context.request_id
54- name = self._attach.volumeName(volume['id'])
55- self._attach.add(req_id, {
56- 'volume': name,
57- 'type': 'copy-to',
58- 'id': req_id,
59- 'rights': 2
60- })
61- try:
62- return super(StorPoolDriver, self).copy_image_to_volume(
63- context, volume, image_service, image_id)
64- finally:
65- self._attach.remove(req_id)
66-
67 def extend_volume(self, volume, new_size):
68 size = int(new_size) * units.Gi
69 name = self._attach.volumeName(volume['id'])
70--
Peter Pentchev5a9f8a62023-12-06 10:40:18 +0200712.42.0
Peter Pentchev6ef0f072022-09-26 16:20:30 +030072