From b763302576ad89ed2aa8112300e5169d32fe61a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Wed, 4 Nov 2020 10:05:53 +0100 Subject: [PATCH 1/9] Use py3 as the default runtime for tox Moving on py3 as the default runtime for tox to avoid to update this at each new cycle. Wallaby support officially the following runtimes [1]: - Python 3.6 - Python 3.8 During Victoria Python 3.7 was used as the default runtime [2] however this version isn't longer officially supported. [1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby [2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria Change-Id: I138a808e799e4969af8542346289737c544a3c5e --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d2f6236..e61f393 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.2.0 -envlist = py38,pep8 +envlist = py3,pep8 ignore_basepython_conflict = true [testenv] -- GitLab From 46bcafb74ede40b4b2d6f2d9b5b872b5c42c36ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Wed, 4 Nov 2020 10:52:27 +0100 Subject: [PATCH 2/9] Use TOX_CONSTRAINTS_FILE UPPER_CONSTRAINTS_FILE is old name and deprecated This allows to use upper-constraints file as more readable way instead of UPPER_CONSTRAINTS_FILE=. [1] https://review.opendev.org/#/c/722814/ [2] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file Change-Id: I69cb454902b1c153ca09bfb713d5748aa0dd532a --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index d2f6236..e248546 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ basepython = python3 whitelist_externals = find deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = stestr run --slowest {posargs} @@ -62,7 +62,7 @@ paths = ./oslo_vmware/hacking [testenv:releasenotes] whitelist_externals = rm deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:TOX_CONSTRAINTS_FILE:ttps://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build -- GitLab From 8e34d43916ace1aae1cdd179bf3856ffd3d6a202 Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Thu, 18 Mar 2021 11:32:43 +0000 Subject: [PATCH 3/9] Update master for stable/wallaby Add file to the reno documentation build to show release notes for stable/wallaby. Use pbr instruction to increment the minor version number automatically so that master versions are higher than the versions on stable/wallaby. Sem-Ver: feature Change-Id: I4537cf2c4fb53095d8592bdea0f431e2a5393c4a --- releasenotes/source/index.rst | 1 + releasenotes/source/wallaby.rst | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 releasenotes/source/wallaby.rst diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index 8c50554..492b5f3 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + wallaby victoria ussuri train diff --git a/releasenotes/source/wallaby.rst b/releasenotes/source/wallaby.rst new file mode 100644 index 0000000..d77b565 --- /dev/null +++ b/releasenotes/source/wallaby.rst @@ -0,0 +1,6 @@ +============================ +Wallaby Series Release Notes +============================ + +.. release-notes:: + :branch: stable/wallaby -- GitLab From 159f4563c042ff0ecee650c820e18b2d658f2dea Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Thu, 18 Mar 2021 11:33:03 +0000 Subject: [PATCH 4/9] Add Python3 xena unit tests This is an automatically generated patch to ensure unit testing is in place for all the of the tested runtimes for xena. See also the PTI in governance [1]. [1]: https://governance.openstack.org/tc/reference/project-testing-interface.html Change-Id: I01d7c2ed0666f0af0993784943338c0ee6c5af40 --- .zuul.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zuul.yaml b/.zuul.yaml index 4eb1657..81fe9a1 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,6 +2,6 @@ templates: - check-requirements - lib-forward-testing-python3 - - openstack-python3-wallaby-jobs + - openstack-python3-xena-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 -- GitLab From ce8d61bfa2a5f33331fcde1aab81c12a9b417777 Mon Sep 17 00:00:00 2001 From: Daniel Bengtsson Date: Tue, 23 Mar 2021 13:11:06 +0100 Subject: [PATCH 5/9] Move flake8 as a pre-commit local target. The goal here is to avoid conflicts between flake8 and hacking version each 2 days. Inspired from nova's approach[1]. The flake8 version to install will be determined by hacking and requirements[2] will stay aligned instead of relying on different versions. [1] https://opendev.org/openstack/nova/src/branch/master/.pre-commit-config.yaml#L26-L35 [2] https://opendev.org/openstack/hacking/src/branch/master/requirements.txt#L1 Change-Id: I7e22a1530e531185f64eef524b06b49544af407e --- .pre-commit-config.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d94556..08aef91 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0 + rev: 9136088a246768144165fcc3ecc3d31bb686920a # v3.3.0 hooks: - id: trailing-whitespace # Replaces or checks mixed line ending @@ -27,9 +27,13 @@ repos: - id: debug-statements - id: check-yaml files: .*\.(yaml|yml)$ - - repo: https://gitlab.com/pycqa/flake8 - rev: 181bb46098dddf7e2d45319ea654b4b4d58c2840 # 3.8.3 + - repo: local hooks: - id: flake8 + name: flake8 additional_dependencies: - hacking>=3.0.1,<3.1.0 + language: python + entry: flake8 + files: '^.*\.py$' + exclude: '^(doc|releasenotes|tools)/.*$' -- GitLab From 4f1608846265ef76b4aad7922b3f43ed766bdee7 Mon Sep 17 00:00:00 2001 From: Johannes Kulik Date: Fri, 16 Apr 2021 11:01:24 +0200 Subject: [PATCH 6/9] Add serialize_object() helper function This function converts a SUDS object to a dictionary. Originally implemented in Nova as "object_to_dict()", this function moves to oslo.vmware to stop leaking the abstraction around the backing SOAP library into depending projects. This is especially necessary since we want to switch the backing SOAP library in [1]. [1] https://specs.openstack.org/openstack/oslo-specs/specs/victoria/oslo-vmware-soap-library-switch.html Change-Id: Ie1d42609104e604f9386c1b1a46be7dcd286e855 --- oslo_vmware/tests/test_vim_util.py | 30 ++++++++++++++++++++++++++++++ oslo_vmware/vim_util.py | 18 ++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/oslo_vmware/tests/test_vim_util.py b/oslo_vmware/tests/test_vim_util.py index 43c02bc..e35294c 100644 --- a/oslo_vmware/tests/test_vim_util.py +++ b/oslo_vmware/tests/test_vim_util.py @@ -527,3 +527,33 @@ class VimUtilTest(base.TestCase): self.assertEqual({"test_name_0": "test_val_0", "test_name_1": "test_val_1"}, vim_util.propset_dict(mock_propset)) + + def test_serialize_object(self): + self.assertEqual({}, vim_util.serialize_object({})) + + mobj1 = mock.MagicMock() + mobj1.__keylist__ = ['asdf'] + mobj1.keys = lambda: ['asdf'] + mobj1.__getitem__.side_effect = [1] + + mobj2 = mock.Mock() + + mobj3 = mock.MagicMock() + mobj3.__keylist__ = ['subkey1', 'subkey2'] + mobj3.keys = lambda: ['subkey1', 'subkey2'] + mobj3.__getitem__.side_effect = ['subvalue1', True] + + mobj4 = 12 + + obj = { + 'foo': mobj1, + 'bar': [mobj2, mobj3], + 'baz': mobj4 + } + + expected = { + 'foo': {'asdf': 1}, + 'bar': [mobj2, {'subkey1': 'subvalue1', 'subkey2': True}], + 'baz': 12 + } + self.assertEqual(expected, vim_util.serialize_object(obj)) diff --git a/oslo_vmware/vim_util.py b/oslo_vmware/vim_util.py index b2c9d2c..945c98a 100644 --- a/oslo_vmware/vim_util.py +++ b/oslo_vmware/vim_util.py @@ -694,3 +694,21 @@ def storage_placement_spec(client_factory, spec.resourcePool = res_pool_ref spec.host = host_ref return spec + + +def serialize_object(obj): + """Convert Suds object into serializable format - a dict.""" + d = {} + for k, v in dict(obj).items(): + if hasattr(v, '__keylist__'): + d[k] = serialize_object(v) + elif isinstance(v, list): + d[k] = [] + for item in v: + if hasattr(item, '__keylist__'): + d[k].append(serialize_object(item)) + else: + d[k].append(item) + else: + d[k] = v + return d -- GitLab From 5505ee3a7efb681c1d983132ecbdcab5b3e9b5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Fri, 18 Dec 2020 15:14:23 +0100 Subject: [PATCH 7/9] Remove lower-constraints remnants Change-Id: I21c0ca526394796fb60d50cc5e2a703c575b68bd --- lower-constraints.txt | 47 ------------------------------------------- tox.ini | 6 ------ 2 files changed, 53 deletions(-) delete mode 100644 lower-constraints.txt diff --git a/lower-constraints.txt b/lower-constraints.txt deleted file mode 100644 index eeabb35..0000000 --- a/lower-constraints.txt +++ /dev/null @@ -1,47 +0,0 @@ -alabaster==0.7.10 -Babel==2.3.4 -bandit==1.6.0 -coverage==4.0 -ddt==1.0.1 -debtcollector==1.2.0 -docutils==0.11 -dulwich==0.15.0 -eventlet==0.18.2 -extras==1.0.0 -fasteners==0.7.0 -fixtures==3.0.0 -gitdb==0.6.4 -GitPython==1.0.1 -greenlet==0.4.15 -imagesize==0.7.1 -iso8601==0.1.11 -Jinja2==2.10 -linecache2==1.0.0 -lxml==4.5.0 -MarkupSafe==1.0 -netaddr==0.7.18 -netifaces==0.10.4 -oslo.concurrency==3.26.0 -oslo.config==5.2.0 -oslo.context==2.19.2 -oslo.i18n==3.15.3 -oslo.utils==3.33.0 -pbr==2.0.0 -Pygments==2.2.0 -pyparsing==2.1.0 -python-mimeparse==1.6.0 -python-subunit==1.0.0 -pytz==2013.6 -PyYAML==3.13 -requests==2.14.2 -rfc3986==0.3.1 -smmap==0.9.0 -snowballstemmer==1.2.1 -stestr==2.0.0 -stevedore==1.20.0 -suds-jurko==0.6 -testtools==2.2.0 -traceback2==1.4.0 -unittest2==1.1.0 -urllib3==1.21.1 -wrapt==1.7.0 diff --git a/tox.ini b/tox.ini index d2f6236..3c28be7 100644 --- a/tox.ini +++ b/tox.ini @@ -76,9 +76,3 @@ commands = # explicitly to avoid unnecessarily installing the checked-out repo too. deps = bindep commands = bindep test - -[testenv:lower-constraints] -deps = - -c{toxinidir}/lower-constraints.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt -- GitLab From 60f6c5e8f5acab2d74fefba013220757adb9e50b Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 26 Apr 2021 14:47:52 -0400 Subject: [PATCH 8/9] Ignore already deleted lease When we try and release a lease, we might get an object not found exception meaning that the lease doesn't exist. So there is no need to release something that doesn't exist. Change-Id: I7912a7adf95f97074ee41441d7bfb8d2405b6533 --- oslo_vmware/rw_handles.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oslo_vmware/rw_handles.py b/oslo_vmware/rw_handles.py index e3769ec..a7b3e72 100644 --- a/oslo_vmware/rw_handles.py +++ b/oslo_vmware/rw_handles.py @@ -556,6 +556,10 @@ class VmdkWriteHandle(VmdkHandle): """ try: self._release_lease() + except exceptions.ManagedObjectNotFoundException: + LOG.info("Lease for %(url)s not found. No need to release.", + {'url': self._url}) + return except exceptions.VimException: LOG.warning("Error occurred while releasing the lease " "for %s.", @@ -637,6 +641,10 @@ class VmdkReadHandle(VmdkHandle): """ try: self._release_lease() + except exceptions.ManagedObjectNotFoundException: + LOG.info("Lease for %(url)s not found. No need to release.", + {'url': self._url}) + return except exceptions.VimException: LOG.warning("Error occurred while releasing the lease " "for %s.", -- GitLab From 3e3fa66cb6f6e845c3f53bea8a13771c1f2b748f Mon Sep 17 00:00:00 2001 From: yangyawei Date: Fri, 14 May 2021 16:53:07 +0800 Subject: [PATCH 9/9] setup.cfg: Replace dashes with underscores Setuptools v54.1.0 introduces a warning that the use of dash-separated options in 'setup.cfg' will not be supported in a future version [1]. Get ahead of the issue by replacing the dashes with underscores. Without this, we see 'UserWarning' messages like the following on new enough versions of setuptools: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead [1] https://github.com/pypa/setuptools/commit/a2e9ae4cb Change-Id: If3e2e3c7b3fc0f170f38721a3350e85e8e7eff36 --- setup.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2a1d676..1f6663a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,12 @@ [metadata] name = oslo.vmware summary = Oslo VMware library -description-file = +description_file = README.rst author = OpenStack -author-email = openstack-discuss@lists.openstack.org -home-page = https://docs.openstack.org/oslo.vmware/latest/ -python-requires = >=3.6 +author_email = openstack-discuss@lists.openstack.org +home_page = https://docs.openstack.org/oslo.vmware/latest/ +python_requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology -- GitLab