openstack-armada-app/upstream/openstack/python-cinderclient/debian/patches/0001-Add-location-parameter-for-volume-backup-creation.patch
Lucas de Ataides f7f7690444 Creating folder structure for STX-O upversion
In preparation for the STX-Openstack upversion to ANTELOPE, there's a
need to decouple the Openstack packages from the Platform ones, so that
the development can occur without impacting the current version. This
decoupling allows the platform and applications to leverage different
versions of OpenStack releases for their respective packages.

On this upversion process, we can't upversion one package at a time,
since that would certainly break the build, testing and usage of
StarlingX. We need to have a way in which the development of STX-O can
occur without impacting the rest of the platform.

To achieve this, a new folder named "openstack" has been created
under the openstack-armada-app repo, containing all packages from the
upstream repository, under the openstack folder [1].
This ensures that the ongoing upversion process does not disrupt the
platform's functionalities and prevents any potential breakages during
the transition.

It should be noted that this change only serves as a placeholder for
future upversions and does not impact the current packages, as they're
not going to be delivered to the ISO, or the STX-O Helm charts, until
the upversion is completed.

This commit lays the groundwork for future work on the STX-O upversion,
promoting flexibility and modularization within the StarlingX packages.

The SRC_DIR and the BASE_SRCREV were updated for each package in order
for the build to work. The BASE_SRCREV was set to the latest merged
change by the time that this review was created [2]

After the work on the upversion and the STX-O clients containerization
is done, the 48138 task (under this same story) can be worked on to
completely remove the STX-O clients from the platform.

[1] https://opendev.org/starlingx/upstream/src/branch/master/openstack
[2] https://review.opendev.org/c/starlingx/openstack-armada-app/+/885301

Test Plan:
PASS: Make sure that the packages are not found if they're commented
      on the debian_pkg_dirs file
PASS: Make sure that the images are not found if they're commented on
      the debian_stable_docker_images.inc
PASS: Make sure packages can be build:
      - openstack-pkg-tools
      - rabbitmq-server
      - python-wsme
      - openstack-ras
      - python-openstacksdk
      - python-oslo-messaging
      - python-osc-lib
      - barbican
      - keystone
      - horizon
      - python-aodhclient
      - python-barbicanclient
      - python-cinderclient
      - python-glanceclient
      - python-gnocchiclient
      - python-heatclient
      - python-ironicclient
      - python-keystoneclient
      - python-neutronclient
      - python-novaclient
      - python-openstackclient
      - python-pankoclient
PASS: Make sure images can be build:
      - stx-aodh
      - stx-ironic
      - stx-barbican
      - stx-ceilometer
      - stx-cinder
      - stx-glance
      - stx-gnocchi
      - stx-heat
      - stx-horizon
      - stx-keystone
      - stx-neutron
      - stx-nova
      - stx-openstackclients
      - stx-placement
      - stx-platformclients

Story: 2010774
Task: 48115

Change-Id: I077a814382fb21bd4b36fac7c20ee041718433f3
Signed-off-by: Lucas de Ataides <lucas.deataidesbarreto@windriver.com>
2023-06-15 12:35:11 -03:00

271 lines
12 KiB
Diff

From b9ea3db2bde72c11b5da6222c57d7ccb80143724 Mon Sep 17 00:00:00 2001
From: Luan Nunes Utimura <LuanNunes.Utimura@windriver.com>
Date: Mon, 6 Mar 2023 09:25:12 -0300
Subject: [PATCH] Add location parameter for volume backup creation
This change adds the `location` parameter in python-cinderclient's
`volume backup create` command to allow the optional specification of
volume backup locations.
This change also updates the unit tests accordingly.
Signed-off-by: Luan Nunes Utimura <LuanNunes.Utimura@windriver.com>
---
cinderclient/tests/unit/v2/test_shell.py | 5 ++++
.../tests/unit/v2/test_volume_backups.py | 6 ++++
cinderclient/tests/unit/v3/test_shell.py | 20 ++++++++++++-
cinderclient/v2/shell.py | 7 ++++-
cinderclient/v2/volume_backups.py | 5 ++--
cinderclient/v3/shell.py | 5 ++++
cinderclient/v3/volume_backups.py | 30 +++++++++++--------
7 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/cinderclient/tests/unit/v2/test_shell.py b/cinderclient/tests/unit/v2/test_shell.py
index f6f6355..95a3af9 100644
--- a/cinderclient/tests/unit/v2/test_shell.py
+++ b/cinderclient/tests/unit/v2/test_shell.py
@@ -379,6 +379,11 @@ class ShellTest(utils.TestCase):
self.run_command('backup-create 1234 --snapshot-id 4321')
self.assert_called('POST', '/backups')
+ def test_backup_location(self):
+ self.run_command('backup-create 1234 '
+ '--location nfs://10.10.10.10:/exports/backups')
+ self.assert_called('POST', '/backups')
+
def test_multiple_backup_delete(self):
self.run_command('backup-delete 1234 5678')
self.assert_called_anytime('DELETE', '/backups/1234')
diff --git a/cinderclient/tests/unit/v2/test_volume_backups.py b/cinderclient/tests/unit/v2/test_volume_backups.py
index 700c440..09f1c0e 100644
--- a/cinderclient/tests/unit/v2/test_volume_backups.py
+++ b/cinderclient/tests/unit/v2/test_volume_backups.py
@@ -52,6 +52,12 @@ class VolumeBackupsTest(utils.TestCase):
'3c706gbg-c074-51d9-9575-385119gcdfg5')
cs.assert_called('POST', '/backups')
+ def test_create_location(self):
+ cs.backups.create('2b695faf-b963-40c8-8464-274008fbcef4',
+ None, None, None, False, False, None,
+ 'nfs://10.10.10.10:/exports/backups')
+ cs.assert_called('POST', '/backups')
+
def test_get(self):
backup_id = '76a17945-3c6f-435c-975b-b5685db10b62'
back = cs.backups.get(backup_id)
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index 0332ae3..6464a73 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -1254,7 +1254,23 @@ class ShellTest(utils.TestCase):
'incremental': False,
'force': False,
'snapshot_id': None,
- }}
+ 'location': None, }}
+ self.assert_called('POST', '/backups', body=expected)
+
+ def test_backup_with_location(self):
+ self.run_command('--os-volume-api-version 3.42 backup-create '
+ '--name 1234 '
+ '--location nfs://10.10.10.10:/exports/backups 1234')
+ expected = {
+ 'backup': {
+ 'volume_id': 1234,
+ 'container': None,
+ 'name': '1234',
+ 'description': None,
+ 'incremental': False,
+ 'force': False,
+ 'snapshot_id': None,
+ 'location': 'nfs://10.10.10.10:/exports/backups', }}
self.assert_called('POST', '/backups', body=expected)
def test_backup_with_metadata(self):
@@ -1267,6 +1283,7 @@ class ShellTest(utils.TestCase):
'incremental': False,
'force': False,
'snapshot_id': None,
+ 'location': None,
'metadata': {'foo': 'bar'}, }}
self.assert_called('POST', '/backups', body=expected)
@@ -1280,6 +1297,7 @@ class ShellTest(utils.TestCase):
'incremental': False,
'force': False,
'snapshot_id': None,
+ 'location': None,
'availability_zone': 'AZ2'}}
self.assert_called('POST', '/backups', body=expected)
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index d41e014..a975f02 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -1162,6 +1162,10 @@ def do_retype(cs, args):
metavar='<snapshot-id>',
default=None,
help='ID of snapshot to backup. Default=None.')
+@utils.arg('--location',
+ metavar='<location>',
+ default=None,
+ help='Backup location. Default=None')
def do_backup_create(cs, args):
"""Creates a volume backup."""
if args.display_name is not None:
@@ -1177,7 +1181,8 @@ def do_backup_create(cs, args):
args.description,
args.incremental,
args.force,
- args.snapshot_id)
+ args.snapshot_id,
+ args.location)
info = {"volume_id": volume.id}
info.update(backup._info)
diff --git a/cinderclient/v2/volume_backups.py b/cinderclient/v2/volume_backups.py
index bcf3e01..0a4f1c1 100644
--- a/cinderclient/v2/volume_backups.py
+++ b/cinderclient/v2/volume_backups.py
@@ -46,7 +46,7 @@ class VolumeBackupManager(base.ManagerWithFind):
def create(self, volume_id, container=None,
name=None, description=None,
incremental=False, force=False,
- snapshot_id=None):
+ snapshot_id=None, location=None):
"""Creates a volume backup.
:param volume_id: The ID of the volume to backup.
@@ -66,7 +66,8 @@ class VolumeBackupManager(base.ManagerWithFind):
'description': description,
'incremental': incremental,
'force': force,
- 'snapshot_id': snapshot_id, }}
+ 'snapshot_id': snapshot_id,
+ 'location': location, }}
return self._create('/backups', body, 'backup')
def get(self, backup_id):
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index eaded7e..cfafe87 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -2466,6 +2466,10 @@ def do_service_get_log(cs, args):
metavar='<snapshot-id>',
default=None,
help='ID of snapshot to backup. Default=None.')
+@utils.arg('--location',
+ metavar='<location>',
+ default=None,
+ help='Backup location. Default=None')
@utils.arg('--metadata',
nargs='*',
metavar='<key=value>',
@@ -2500,6 +2504,7 @@ def do_backup_create(cs, args):
args.incremental,
args.force,
args.snapshot_id,
+ location=args.location,
**kwargs)
info = {"volume_id": volume.id}
info.update(backup._info)
diff --git a/cinderclient/v3/volume_backups.py b/cinderclient/v3/volume_backups.py
index 7dd8560..66525af 100644
--- a/cinderclient/v3/volume_backups.py
+++ b/cinderclient/v3/volume_backups.py
@@ -43,7 +43,7 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
def create(self, volume_id, container=None,
name=None, description=None,
incremental=False, force=False,
- snapshot_id=None):
+ snapshot_id=None, location=None):
"""Creates a volume backup.
:param volume_id: The ID of the volume to backup.
@@ -55,17 +55,19 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
:param snapshot_id: The ID of the snapshot to backup. This should
be a snapshot of the src volume, when specified,
the new backup will be based on the snapshot.
+ :param location: The backup location.
:rtype: :class:`VolumeBackup`
"""
return self._create_backup(volume_id, container, name, description,
- incremental, force, snapshot_id)
+ incremental, force, snapshot_id,
+ location=location)
@api_versions.wraps("3.43") # noqa: F811
def create(self, volume_id, container=None, # noqa
name=None, description=None,
incremental=False, force=False,
- snapshot_id=None,
- metadata=None):
+ snapshot_id=None, metadata=None,
+ location=None):
"""Creates a volume backup.
:param volume_id: The ID of the volume to backup.
@@ -74,28 +76,30 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
:param description: The description of the backup.
:param incremental: Incremental backup.
:param force: If True, allows an in-use volume to be backed up.
- :param metadata: Key Value pairs
:param snapshot_id: The ID of the snapshot to backup. This should
be a snapshot of the src volume, when specified,
the new backup will be based on the snapshot.
+ :param metadata: Key Value pairs
+ :param location: The backup location.
:rtype: :class:`VolumeBackup`
"""
# pylint: disable=function-redefined
return self._create_backup(volume_id, container, name, description,
- incremental, force, snapshot_id, metadata)
+ incremental, force, snapshot_id, metadata,
+ location=location)
@api_versions.wraps("3.51") # noqa: F811
def create(self, volume_id, container=None, name=None, description=None, # noqa
incremental=False, force=False, snapshot_id=None, metadata=None,
- availability_zone=None):
+ availability_zone=None, location=None):
return self._create_backup(volume_id, container, name, description,
incremental, force, snapshot_id, metadata,
- availability_zone)
+ availability_zone, location=location)
def _create_backup(self, volume_id, container=None, name=None,
description=None, incremental=False, force=False,
- snapshot_id=None, metadata=None,
- availability_zone=None):
+ snapshot_id=None, metadata=None, availability_zone=None,
+ location=None):
"""Creates a volume backup.
:param volume_id: The ID of the volume to backup.
@@ -104,10 +108,11 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
:param description: The description of the backup.
:param incremental: Incremental backup.
:param force: If True, allows an in-use volume to be backed up.
- :param metadata: Key Value pairs
:param snapshot_id: The ID of the snapshot to backup. This should
be a snapshot of the src volume, when specified,
the new backup will be based on the snapshot.
+ :param location: The backup location.
+ :param metadata: Key Value pairs
:param availability_zone: The AZ where we want the backup stored.
:rtype: :class:`VolumeBackup`
"""
@@ -118,7 +123,8 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
'description': description,
'incremental': incremental,
'force': force,
- 'snapshot_id': snapshot_id, }}
+ 'snapshot_id': snapshot_id,
+ 'location': location, }}
if metadata:
body['backup']['metadata'] = metadata
if availability_zone:
--
2.25.1