From 1c44468ea8c51888ce134653e7c379bd10cc2255 Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Wed, 1 Mar 2023 13:19:10 +0000 Subject: [PATCH 1/5] Update .gitreview for stable/2023.1 Change-Id: I744a8db08dea32d0dd6293d8a460564e84edde29 --- .gitreview | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitreview b/.gitreview index 047ac5645..5c58c9dfa 100644 --- a/.gitreview +++ b/.gitreview @@ -2,3 +2,4 @@ host=review.opendev.org port=29418 project=openstack/python-glanceclient.git +defaultbranch=stable/2023.1 From d9306ef9a7f64112f84f69736227e622bbaeb0c0 Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Wed, 1 Mar 2023 13:19:12 +0000 Subject: [PATCH 2/5] Update TOX_CONSTRAINTS_FILE for stable/2023.1 Update the URL to the upper-constraints file to point to the redirect rule on releases.openstack.org so that anyone working on this branch will switch to the correct upper-constraints list automatically when the requirements repository branches. Until the requirements repository has as stable/2023.1 branch, tests will continue to use the upper-constraints list on master. Change-Id: I414c80d965d9c1d5819b32432d3620d15965c78c --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index f51607039..e0e5dcbfa 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ setenv = OS_STDOUT_NOCAPTURE=False # first one that is defined. If none of them is defined, we fallback to the # default value. deps = - -c{env:TOX_CONSTRAINTS_FILE:{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2023.1} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs} @@ -68,7 +68,7 @@ basepython = python3 # first one that is defined. If none of them is defined, we fallback to the # default value. deps = - -c{env:TOX_CONSTRAINTS_FILE:{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2023.1} -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html From d94f5633632a9f6be59948474cb97ab5486c9496 Mon Sep 17 00:00:00 2001 From: Pranali Deore Date: Wed, 31 Jan 2024 06:54:20 +0000 Subject: [PATCH 3/5] Remove incorrect validation for glance-download import method Since REMOTE SERVICE INTERFACE has default value to 'public', it doesn't make sense to have validation for the same. Removing this validation and added few missing tests for glance-download import method Conflicts: glanceclient/tests/unit/v2/test_shell_v2.py NOTE: Resolved conflicts caused due to I1d8c69acd5d61fdc426469cd87d1ace81871e60f Closes-Bug: #2051761 Change-Id: I89adf23aac5db4f2c46379546def2f71d7c8e163 (cherry picked from commit 3c5dd2381f4f577411ad1023ad1bd1a280626bb5) (cherry picked from commit d739d313a772bbec9039eef0825e3407b6970808) --- glanceclient/tests/unit/v2/test_shell_v2.py | 68 +++++++++++++++++++++ glanceclient/v2/shell.py | 3 - 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py index 8acceaecb..b2709830e 100644 --- a/glanceclient/tests/unit/v2/test_shell_v2.py +++ b/glanceclient/tests/unit/v2/test_shell_v2.py @@ -2262,6 +2262,74 @@ def test_image_import_glance_download(self): all_stores=None, allow_failure=True, backend=None, stores=None) + @mock.patch('glanceclient.common.utils.exit') + def test_image_import_neg_no_glance_download_with_remote_region( + self, mock_utils_exit): + expected_msg = ("Import method should be 'glance-download' if " + "REMOTE REGION is provided.") + my_args = self.base_args.copy() + my_args['id'] = 'IMG-01' + my_args['remote-region'] = 'REGION2' + my_args['import_method'] = 'web-download' + my_args['uri'] = 'https://example.com/some/stuff' + args = self._make_args(my_args) + mock_utils_exit.side_effect = self._mock_utils_exit + with mock.patch.object(self.gc.images, + 'get_import_info') as mocked_info: + mocked_info.return_value = self.import_info_response + try: + test_shell.do_image_import(self.gc, args) + self.fail("utils.exit should have been called") + except SystemExit: + pass + mock_utils_exit.assert_called_once_with(expected_msg) + + @mock.patch('glanceclient.common.utils.exit') + def test_image_import_neg_no_glance_download_with_remote_id( + self, mock_utils_exit): + expected_msg = ("Import method should be 'glance-download' if " + "REMOTE IMAGE ID is provided.") + my_args = self.base_args.copy() + my_args['id'] = 'IMG-01' + my_args['remote-image-id'] = 'IMG-02' + my_args['import_method'] = 'web-download' + my_args['uri'] = 'https://example.com/some/stuff' + args = self._make_args(my_args) + mock_utils_exit.side_effect = self._mock_utils_exit + with mock.patch.object(self.gc.images, + 'get_import_info') as mocked_info: + mocked_info.return_value = self.import_info_response + try: + test_shell.do_image_import(self.gc, args) + self.fail("utils.exit should have been called") + except SystemExit: + pass + mock_utils_exit.assert_called_once_with(expected_msg) + + def test_image_import_glance_download_without_remote_service_interface( + self): + args = self._make_args( + {'id': 'IMG-01', 'uri': None, 'remote-region': 'REGION2', + 'remote-image-id': 'IMG-02', + 'import_method': 'glance-download'}) + with mock.patch.object(self.gc.images, 'image_import') as mock_import: + with mock.patch.object(self.gc.images, 'get') as mocked_get: + with mock.patch.object(self.gc.images, + 'get_import_info') as mocked_info: + mocked_get.return_value = {'status': 'queued', + 'container_format': 'bare', + 'disk_format': 'raw'} + mocked_info.return_value = self.import_info_response + mock_import.return_value = None + test_shell.do_image_import(self.gc, args) + mock_import.assert_called_once_with( + 'IMG-01', 'glance-download', + uri=None, remote_region='REGION2', + remote_image_id='IMG-02', + remote_service_interface=None, + all_stores=None, allow_failure=True, + backend=None, stores=None) + @mock.patch('glanceclient.common.utils.print_image') def test_image_import_no_print_image(self, mocked_utils_print_image): args = self._make_args( diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py index 93a93776b..ce404ad6d 100644 --- a/glanceclient/v2/shell.py +++ b/glanceclient/v2/shell.py @@ -834,9 +834,6 @@ def do_image_import(gc, args): if remote_image_id and args.import_method != 'glance-download': utils.exit("Import method should be 'glance-download' if " "REMOTE IMAGE ID is provided.") - if remote_service_interface and args.import_method != 'glance-download': - utils.exit("Import method should be 'glance-download' if " - "REMOTE SERVICE INTERFACE is provided.") if args.import_method == 'copy-image' and not (stores or all_stores): utils.exit("Provide either --stores or --all-stores for " From 3a2ef8b105ef46cc46df90d5b6cee71b909855f1 Mon Sep 17 00:00:00 2001 From: Nobuto Murata Date: Fri, 19 May 2023 09:36:49 +0900 Subject: [PATCH 4/5] Bump the CHUNKSIZE to use CPU more efficiently The chunk size used for downloading images was 64KiB for some time. That is okay for relatively small images but the client side of CPU can be a bottleneck especially for large images. Bump the default chunk size from 64KiB to 1MiB so we can use the client side CPU more efficiently. [64KiB chunk size - current] INFO cinder.image.image_utils Image download 1907.35 MB at 68.61 MB/s -> ~ 549 Mbps [1MiB chunk size - patched] INFO cinder.image.image_utils Image download 1907.35 MB at 132.10 MB/s -> 1,057 Mbps Closes-Bug: #2020139 Change-Id: I8b6e19621fc989526b02319d88fcfde88a17eee0 (cherry picked from commit 7d78cc4b9d43f5abdf8c7fa05e37ab8c8122c325) --- glanceclient/common/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index e24ba3574..f8c48dc5c 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -40,7 +40,7 @@ LOG = logging.getLogger(__name__) USER_AGENT = 'python-glanceclient' -CHUNKSIZE = 1024 * 64 # 64kB +CHUNKSIZE = 1024 * 1024 # 1MiB REQ_ID_HEADER = 'X-OpenStack-Request-ID' TOKEN_HEADERS = ['X-Auth-Token', 'X-Service-Token'] From 6b46b85d4b61ebafda498f5da51f83482c2cc12c Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Mon, 25 Nov 2024 10:44:20 +0000 Subject: [PATCH 5/5] Update .gitreview for unmaintained/2023.1 Change-Id: I1dc3134a839504583b58ccaf97f3275d9a2e020e --- .gitreview | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitreview b/.gitreview index 5c58c9dfa..a33122ec5 100644 --- a/.gitreview +++ b/.gitreview @@ -2,4 +2,4 @@ host=review.opendev.org port=29418 project=openstack/python-glanceclient.git -defaultbranch=stable/2023.1 +defaultbranch=unmaintained/2023.1