Add the patches last used by our CI.
Change-Id: I9bd7bead9c220e81184c2966521cbed85457184d
diff --git a/patches/openstack/cinder/leave-it-to-brick.patch b/patches/openstack/cinder/leave-it-to-brick.patch
new file mode 100644
index 0000000..52fc120
--- /dev/null
+++ b/patches/openstack/cinder/leave-it-to-brick.patch
@@ -0,0 +1,118 @@
+From d38aa0fff72db40f4501bfac661313c5aeda51f3 Mon Sep 17 00:00:00 2001
+From: Peter Penchev <openstack-dev@storpool.com>
+Date: Tue, 20 Apr 2021 17:46:41 +0300
+Subject: [PATCH] StorPool: drop _attach_volume() and _detach_volume().
+
+Our os-brick connector already handles the "keep track of which volume
+is attached for what reason" calls to storpool.spopenstack. However,
+we need to explicitly specify the access mode in initialize_connection()
+now, since our os-brick connector does not know how to divine it yet.
+(this will come later with the "attach snapshot" functionality)
+
+Incidentally, this fixes the "create an encrypted volume" flow, since
+our _attach_volume() implementation never actually returned a connector
+in the attachment info...
+
+Change-Id: I5da7ae04b87b4fd52a682a6545060e852174f6c8
+---
+ .../unit/volume/drivers/test_storpool.py | 6 ++-
+ cinder/volume/drivers/storpool.py | 44 ++-----------------
+ 2 files changed, 8 insertions(+), 42 deletions(-)
+
+diff --git a/cinder/tests/unit/volume/drivers/test_storpool.py b/cinder/tests/unit/volume/drivers/test_storpool.py
+index a5f763b96..843283db4 100644
+--- a/cinder/tests/unit/volume/drivers/test_storpool.py
++++ b/cinder/tests/unit/volume/drivers/test_storpool.py
+@@ -1,4 +1,4 @@
+-# Copyright 2014 - 2017, 2019 StorPool
++# Copyright 2014 - 2017, 2019 - 2021 StorPool
+ # All Rights Reserved.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
+@@ -225,7 +225,9 @@ class StorPoolTestCase(test.TestCase):
+ def test_initialize_connection_good(self, cid, hid, name):
+ c = self.driver.initialize_connection({'id': hid}, {'host': name})
+ self.assertEqual('storpool', c['driver_volume_type'])
+- self.assertDictEqual({'client_id': cid, 'volume': hid}, c['data'])
++ self.assertDictEqual({'client_id': cid, 'volume': hid,
++ 'access_mode': 'rw'},
++ c['data'])
+
+ def test_noop_functions(self):
+ self.driver.terminate_connection(None, None)
+diff --git a/cinder/volume/drivers/storpool.py b/cinder/volume/drivers/storpool.py
+index cf5707cbc..a1388677b 100644
+--- a/cinder/volume/drivers/storpool.py
++++ b/cinder/volume/drivers/storpool.py
+@@ -1,4 +1,4 @@
+-# Copyright (c) 2014 - 2019 StorPool
++# Copyright (c) 2014 - 2021 StorPool
+ # All Rights Reserved.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
+@@ -90,6 +90,8 @@ class StorPoolDriver(driver.VolumeDriver):
+ 1.2.2 - Reintroduce the driver into OpenStack Queens,
+ add ignore_errors to the internal _detach_volume() method
+ 1.2.3 - Advertise some more driver capabilities.
++ 2.0.0 - Drop _attach_volume() and _detach_volume(), our os-brick
++ connector will handle this.
+ """
+
+ VERSION = '1.2.3'
+@@ -167,6 +169,7 @@ class StorPoolDriver(driver.VolumeDriver):
+ 'data': {
+ 'client_id': self._storpool_client_id(connector),
+ 'volume': volume['id'],
++ 'access_mode': 'rw',
+ }}
+
+ def terminate_connection(self, volume, connector, **kwargs):
+@@ -312,45 +315,6 @@ class StorPoolDriver(driver.VolumeDriver):
+ 'pools': pools
+ }
+
+- def _attach_volume(self, context, volume, properties, remote=False):
+- if remote:
+- return super(StorPoolDriver, self)._attach_volume(
+- context, volume, properties, remote=remote)
+- req_id = context.request_id
+- req = self._attach.get().get(req_id, None)
+- if req is None:
+- req = {
+- 'volume': self._attach.volumeName(volume['id']),
+- 'type': 'cinder-attach',
+- 'id': context.request_id,
+- 'rights': 2,
+- 'volsnap': False,
+- 'remove_on_detach': True
+- }
+- self._attach.add(req_id, req)
+- name = req['volume']
+- self._attach.sync(req_id, None)
+- return {'device': {'path': '/dev/storpool/' + name,
+- 'storpool_attach_req': req_id}}, volume
+-
+- def _detach_volume(self, context, attach_info, volume, properties,
+- force=False, remote=False, ignore_errors=False):
+- if remote:
+- return super(StorPoolDriver, self)._detach_volume(
+- context, attach_info, volume, properties,
+- force=force, remote=remote, ignore_errors=ignore_errors)
+- try:
+- req_id = attach_info.get('device', {}).get(
+- 'storpool_attach_req', context.request_id)
+- req = self._attach.get()[req_id]
+- name = req['volume']
+- self._attach.sync(req_id, name)
+- if req.get('remove_on_detach', False):
+- self._attach.remove(req_id)
+- except BaseException:
+- if not ignore_errors:
+- raise
+-
+ def backup_volume(self, context, backup, backup_service):
+ volume = self.db.volume_get(context, backup['volume_id'])
+ req_id = context.request_id
+--
+2.30.2
+
diff --git a/patches/openstack/cinderlib/storpool-test-20190910.patch b/patches/openstack/cinderlib/storpool-test-20190910.patch
new file mode 100644
index 0000000..7267d36
--- /dev/null
+++ b/patches/openstack/cinderlib/storpool-test-20190910.patch
@@ -0,0 +1,26 @@
+From 06e8074699dca405fc71d3cc14304efecc8616d5 Mon Sep 17 00:00:00 2001
+From: Peter Penchev <openstack-dev@storpool.com>
+Date: Tue, 10 Sep 2019 17:05:12 +0300
+Subject: [PATCH 1/2] DNM: Add a StorPool CI test configuration file.
+
+Change-Id: I631701ad19d84336b59d1f861f04baf32f4defc6
+---
+ cinderlib/tests/functional/storpool.yaml | 6 ++++++
+ 1 file changed, 6 insertions(+)
+ create mode 100644 cinderlib/tests/functional/storpool.yaml
+
+diff --git a/cinderlib/tests/functional/storpool.yaml b/cinderlib/tests/functional/storpool.yaml
+new file mode 100644
+index 0000000..5c5ce23
+--- /dev/null
++++ b/cinderlib/tests/functional/storpool.yaml
+@@ -0,0 +1,6 @@
++# We only define one backend
++backends:
++ - volume_backend_name: storpool
++ volume_driver: cinder.volume.drivers.storpool.StorPoolDriver
++ storpool_template: hybrid
++ enable_unsupported_driver: true
+--
+2.23.0
+
diff --git a/patches/openstack/devstack/eatmydata.patch b/patches/openstack/devstack/eatmydata.patch
new file mode 100644
index 0000000..4f6000e
--- /dev/null
+++ b/patches/openstack/devstack/eatmydata.patch
@@ -0,0 +1,57 @@
+From 46d056ce686691524e835178f0ad6eb14d3c58f3 Mon Sep 17 00:00:00 2001
+From: Peter Penchev <openstack-dev@storpool.com>
+Date: Sun, 6 Sep 2020 16:01:31 +0300
+Subject: [PATCH 1/2] DNM: use eatmydata for apt-get and pip.
+
+Change-Id: I4db4129f8b8f654aa763fafaaefdae5386cbb9a7
+---
+ functions-common | 2 +-
+ inc/python | 5 +++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/functions-common b/functions-common
+index 11679e4a..70a85f7b 100644
+--- a/functions-common
++++ b/functions-common
+@@ -1114,7 +1114,7 @@ function apt_get {
+ $sudo DEBIAN_FRONTEND=noninteractive \
+ http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
+ no_proxy=${no_proxy:-} \
+- apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@" < /dev/null
++ eatmydata apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@" < /dev/null
+ result=$?
+
+ # stop the clock
+diff --git a/inc/python b/inc/python
+index 9382d352..f97ebe3a 100644
+--- a/inc/python
++++ b/inc/python
+@@ -195,6 +195,7 @@ function pip_install {
+ no_proxy="${no_proxy:-}" \
+ PIP_FIND_LINKS=$PIP_FIND_LINKS \
+ SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \
++ eatmydata \
+ $cmd_pip $upgrade \
+ $@
+ result=$?
+@@ -216,7 +217,7 @@ function pip_uninstall {
+ local sudo_pip="sudo -H LC_ALL=en_US.UTF-8"
+ fi
+ # don't error if we can't uninstall, it might not be there
+- $sudo_pip $cmd_pip uninstall -y $name || /bin/true
++ $sudo_pip eatmydata $cmd_pip uninstall -y $name || /bin/true
+ }
+
+ # get version of a package from global requirements file
+@@ -481,7 +482,7 @@ function install_devstack_tools {
+ # intentionally old to ensure devstack-gate has control
+ local dstools_version=${DSTOOLS_VERSION:-0.1.2}
+ install_python3
+- sudo pip3 install -U devstack-tools==${dstools_version}
++ sudo eatmydata pip3 install -U devstack-tools==${dstools_version}
+ }
+
+ # Restore xtrace
+--
+2.30.2
+
diff --git a/patches/series b/patches/series
new file mode 100644
index 0000000..da86d49
--- /dev/null
+++ b/patches/series
@@ -0,0 +1,3 @@
+openstack/cinder/leave-it-to-brick.patch
+openstack/cinderlib/storpool-test-20190910.patch
+openstack/devstack/eatmydata.patch