commit python-oslo.vmware for openSUSE:Factory
Hello community, here is the log from the commit of package python-oslo.vmware for openSUSE:Factory checked in at 2019-05-03 22:42:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-oslo.vmware (Old) and /work/SRC/openSUSE:Factory/.python-oslo.vmware.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-oslo.vmware" Fri May 3 22:42:56 2019 rev:14 rq:692869 version:2.32.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-oslo.vmware/python-oslo.vmware.changes 2018-09-07 15:39:20.962539652 +0200 +++ /work/SRC/openSUSE:Factory/.python-oslo.vmware.new.5148/python-oslo.vmware.changes 2019-05-03 22:42:57.987309665 +0200 @@ -1,0 +2,19 @@ +Mon Apr 8 11:31:42 UTC 2019 - cloud-devel@suse.de + +- update to version 2.32.2 + - Change openstack-dev to openstack-discuss + - add lib-forward-testing-python3 test job + - Add DVS utility methods + - import zuul job settings from project-config + - Imported Translations from Zanata + - Update reno for stable/rocky + - Clean up .gitignore references to personal tools + - Use template for lower-constraints + - add python 3.6 unit test job + - py37: deal with Exception repr changes + - Check if there is a context set before updating the store + - add python 3.7 unit test job + - Set request context when polling vCenter tasks + - delete useless indent + +------------------------------------------------------------------- Old: ---- oslo.vmware-2.31.0.tar.gz New: ---- oslo.vmware-2.32.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-oslo.vmware.spec ++++++ --- /var/tmp/diff_new_pack.sb4LN3/_old 2019-05-03 22:42:58.423310583 +0200 +++ /var/tmp/diff_new_pack.sb4LN3/_new 2019-05-03 22:42:58.423310583 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-oslo.vmware # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,18 +12,18 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: python-oslo.vmware -Version: 2.31.0 +Version: 2.32.2 Release: 0 Summary: Oslo VMware library for OpenStack projects License: Apache-2.0 Group: Development/Languages/Python URL: https://launchpad.net/oslo.vmware -Source0: https://files.pythonhosted.org/packages/source/o/oslo.vmware/oslo.vmware-2.3... +Source0: https://files.pythonhosted.org/packages/source/o/oslo.vmware/oslo.vmware-2.3... BuildRequires: openstack-macros BuildRequires: python-devel BuildRequires: python2-Babel @@ -35,6 +35,7 @@ BuildRequires: python2-mox3 BuildRequires: python2-netaddr >= 0.7.18 BuildRequires: python2-oslo.concurrency >= 3.26.0 +BuildRequires: python2-oslo.context >= 2.19.2 BuildRequires: python2-oslo.i18n >= 3.15.3 BuildRequires: python2-oslo.utils >= 3.33.0 BuildRequires: python2-pbr >= 2.0.0 @@ -55,6 +56,7 @@ BuildRequires: python3-mox3 BuildRequires: python3-netaddr >= 0.7.18 BuildRequires: python3-oslo.concurrency >= 3.26.0 +BuildRequires: python3-oslo.context >= 2.19.2 BuildRequires: python3-oslo.i18n >= 3.15.3 BuildRequires: python3-oslo.utils >= 3.33.0 BuildRequires: python3-pbr >= 2.0.0 @@ -70,6 +72,7 @@ Requires: python-lxml >= 3.4.1 Requires: python-netaddr >= 0.7.18 Requires: python-oslo.concurrency >= 3.26.0 +Requires: python-oslo.context >= 2.19.2 Requires: python-oslo.i18n >= 3.15.3 Requires: python-oslo.utils >= 3.33.0 Requires: python-requests >= 2.14.2 @@ -102,9 +105,8 @@ Documentation for OpenStack common VMware library. %prep -%autosetup -p1 -n oslo.vmware-2.31.0 +%autosetup -p1 -n oslo.vmware-2.32.2 %py_req_cleanup -sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg %build %python_build ++++++ _service ++++++ --- /var/tmp/diff_new_pack.sb4LN3/_old 2019-05-03 22:42:58.447310633 +0200 +++ /var/tmp/diff_new_pack.sb4LN3/_new 2019-05-03 22:42:58.447310633 +0200 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/rocky/openstack/oslo.vmware/oslo.vmware.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/stein/openstack/oslo.vmware/oslo.vmware.spec.j2</param> <param name="output-name">python-oslo.vmware.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.vmware/stable/rocky/requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.vmware/stable/stein/requirements.txt</param> <param name="changelog-email">cloud-devel@suse.de</param> <param name="changelog-provider">gh,openstack,oslo.vmware</param> </service> ++++++ oslo.vmware-2.31.0.tar.gz -> oslo.vmware-2.32.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/.zuul.yaml new/oslo.vmware-2.32.2/.zuul.yaml --- old/oslo.vmware-2.31.0/.zuul.yaml 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/.zuul.yaml 2019-02-28 19:02:46.000000000 +0100 @@ -1,7 +1,12 @@ - project: - check: - jobs: - - openstack-tox-lower-constraints - gate: - jobs: - - openstack-tox-lower-constraints + templates: + - check-requirements + - lib-forward-testing + - lib-forward-testing-python3 + - openstack-lower-constraints-jobs + - openstack-python-jobs + - openstack-python35-jobs + - openstack-python36-jobs + - openstack-python37-jobs + - publish-openstack-docs-pti + - release-notes-jobs-python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/AUTHORS new/oslo.vmware-2.32.2/AUTHORS --- old/oslo.vmware-2.31.0/AUTHORS 2018-07-20 03:10:14.000000000 +0200 +++ new/oslo.vmware-2.32.2/AUTHORS 2019-02-28 19:05:12.000000000 +0100 @@ -9,6 +9,7 @@ Cedric Brandily <zzelle@gmail.com> ChangBo Guo(gcb) <eric.guo@easystack.cn> Christian Berendt <berendt@b1-systems.de> +Corey Bryant <corey.bryant@canonical.com> Dan Prince <dprince@redhat.com> Davanum Srinivas <davanum@gmail.com> Davanum Srinivas <dims@linux.vnet.ibm.com> @@ -49,13 +50,14 @@ Vu Cong Tuan <tuanvc@vn.fujitsu.com> Vui Lam <vui@vmware.com> ZHU ZHU <zhuzhubj@cn.ibm.com> +ZhongShengping <chdzsp@163.com> Zhongcheng Lao <zlao@vmware.com> -Zuul <zuul@review.openstack.org> avnish <avnish.pal@nectechnologies.in> howardlee <lihongweibj@inspur.com> int32bit <krystism@gmail.com> loooosy <syluo5695@fiberhome.com> melissaml <ma.lei@99cloud.net> +qingszhao <zhao.daqing@99cloud.net> ricolin <rico.lin@easystack.cn> wangqi <wang.qi@99cloud.net> zhang.lei <zhang.lei@99cloud.net> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/ChangeLog new/oslo.vmware-2.32.2/ChangeLog --- old/oslo.vmware-2.31.0/ChangeLog 2018-07-20 03:10:14.000000000 +0200 +++ new/oslo.vmware-2.32.2/ChangeLog 2019-02-28 19:05:12.000000000 +0100 @@ -1,6 +1,28 @@ CHANGES ======= +2.32.2 +------ + +* add python 3.7 unit test job +* Use template for lower-constraints +* Change openstack-dev to openstack-discuss +* delete useless indent +* Clean up .gitignore references to personal tools + +2.32.1 +------ + +* Add DVS utility methods +* Check if there is a context set before updating the store +* Imported Translations from Zanata +* add lib-forward-testing-python3 test job +* add python 3.6 unit test job +* Set request context when polling vCenter tasks +* import zuul job settings from project-config +* py37: deal with Exception repr changes +* Update reno for stable/rocky + 2.31.0 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/HACKING.rst new/oslo.vmware-2.32.2/HACKING.rst --- old/oslo.vmware-2.31.0/HACKING.rst 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/HACKING.rst 2019-02-28 19:02:46.000000000 +0100 @@ -1,5 +1,5 @@ - Style Commandments -==================== +Style Commandments +================== Read the OpenStack Style Commandments in the following link diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/PKG-INFO new/oslo.vmware-2.32.2/PKG-INFO --- old/oslo.vmware-2.31.0/PKG-INFO 2018-07-20 03:10:15.000000000 +0200 +++ new/oslo.vmware-2.32.2/PKG-INFO 2019-02-28 19:05:12.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: oslo.vmware -Version: 2.31.0 +Version: 2.32.2 Summary: Oslo VMware library Home-page: https://docs.openstack.org/oslo.vmware/latest/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/RELEASENOTES.rst new/oslo.vmware-2.32.2/RELEASENOTES.rst --- old/oslo.vmware-2.31.0/RELEASENOTES.rst 2018-07-20 03:10:15.000000000 +0200 +++ new/oslo.vmware-2.32.2/RELEASENOTES.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -=========== -oslo.vmware -=========== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/lower-constraints.txt new/oslo.vmware-2.32.2/lower-constraints.txt --- old/oslo.vmware-2.31.0/lower-constraints.txt 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/lower-constraints.txt 2019-02-28 19:02:46.000000000 +0100 @@ -29,6 +29,7 @@ openstackdocstheme==1.18.1 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo.vmware.egg-info/PKG-INFO new/oslo.vmware-2.32.2/oslo.vmware.egg-info/PKG-INFO --- old/oslo.vmware-2.31.0/oslo.vmware.egg-info/PKG-INFO 2018-07-20 03:10:14.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo.vmware.egg-info/PKG-INFO 2019-02-28 19:05:12.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: oslo.vmware -Version: 2.31.0 +Version: 2.32.2 Summary: Oslo VMware library Home-page: https://docs.openstack.org/oslo.vmware/latest/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo.vmware.egg-info/SOURCES.txt new/oslo.vmware-2.32.2/oslo.vmware.egg-info/SOURCES.txt --- old/oslo.vmware-2.31.0/oslo.vmware.egg-info/SOURCES.txt 2018-07-20 03:10:15.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo.vmware.egg-info/SOURCES.txt 2019-02-28 19:05:12.000000000 +0100 @@ -35,6 +35,7 @@ oslo_vmware/_i18n.py oslo_vmware/api.py oslo_vmware/constants.py +oslo_vmware/dvs_util.py oslo_vmware/exceptions.py oslo_vmware/image_transfer.py oslo_vmware/image_util.py @@ -57,6 +58,7 @@ oslo_vmware/tests/base.py oslo_vmware/tests/test.ovf oslo_vmware/tests/test_api.py +oslo_vmware/tests/test_dvs_util.py oslo_vmware/tests/test_exceptions.py oslo_vmware/tests/test_hacking.py oslo_vmware/tests/test_image_transfer.py @@ -102,6 +104,7 @@ releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/queens.rst +releasenotes/source/rocky.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo.vmware.egg-info/pbr.json new/oslo.vmware-2.32.2/oslo.vmware.egg-info/pbr.json --- old/oslo.vmware-2.31.0/oslo.vmware.egg-info/pbr.json 2018-07-20 03:10:14.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo.vmware.egg-info/pbr.json 2019-02-28 19:05:12.000000000 +0100 @@ -1 +1 @@ -{"git_version": "01e404f", "is_release": true} \ No newline at end of file +{"git_version": "69f36d5", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo.vmware.egg-info/requires.txt new/oslo.vmware-2.32.2/oslo.vmware.egg-info/requires.txt --- old/oslo.vmware-2.31.0/oslo.vmware.egg-info/requires.txt 2018-07-20 03:10:14.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo.vmware.egg-info/requires.txt 2019-02-28 19:05:12.000000000 +0100 @@ -11,3 +11,4 @@ requests>=2.14.2 urllib3>=1.21.1 oslo.concurrency>=3.26.0 +oslo.context>=2.19.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo_vmware/api.py new/oslo.vmware-2.32.2/oslo_vmware/api.py --- old/oslo.vmware-2.31.0/oslo_vmware/api.py 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo_vmware/api.py 2019-02-28 19:02:46.000000000 +0100 @@ -24,6 +24,7 @@ import logging from oslo_concurrency import lockutils +from oslo_context import context from oslo_utils import excutils from oslo_utils import reflection import six @@ -390,12 +391,13 @@ :raises: VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException """ - loop = loopingcall.FixedIntervalLoopingCall(self._poll_task, task) + ctx = context.get_current() + loop = loopingcall.FixedIntervalLoopingCall(self._poll_task, task, ctx) evt = loop.start(self._task_poll_interval) LOG.debug("Waiting for the task: %s to complete.", task) return evt.wait() - def _poll_task(self, task): + def _poll_task(self, task, ctx): """Poll the given task until completion. If the task completes successfully, the method returns the task info @@ -403,7 +405,10 @@ exception is set in the event. :param task: managed object reference of the task + :param ctx: request context for the corresponding task """ + if ctx is not None: + ctx.update_store() try: # we poll tasks too often, so skip logging the opID as it generates # too much noise in the logs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo_vmware/dvs_util.py new/oslo.vmware-2.32.2/oslo_vmware/dvs_util.py --- old/oslo.vmware-2.31.0/oslo_vmware/dvs_util.py 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.vmware-2.32.2/oslo_vmware/dvs_util.py 2019-02-28 19:02:46.000000000 +0100 @@ -0,0 +1,159 @@ +# Copyright (c) 2018 VMware, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import logging + +from oslo_vmware import vim_util + + +LOG = logging.getLogger(__name__) + + +def get_dvs_moref(value): + """Get managed DVS object reference. + + :param value: value of the DVS managed object + :returns: managed object reference with given value and type + 'VmwareDistributedVirtualSwitch' + """ + + return vim_util.get_moref(value, 'VmwareDistributedVirtualSwitch') + + +def get_vlan_spec(session, vlan_id): + """Gets portgroup vlan spec. + + :param session: vCenter soap session + :param vlan_id: the vlan_id for the port + :returns: The configuration when a single vlan_id is used for a port + """ + # Create the spec for the vlan tag + client_factory = session.vim.client.factory + spec_ns = 'ns0:VmwareDistributedVirtualSwitchVlanIdSpec' + vl_spec = client_factory.create(spec_ns) + vl_spec.vlanId = vlan_id + vl_spec.inherited = '0' + return vl_spec + + +def get_trunk_vlan_spec(session, start=0, end=4094): + """Gets portgroup trunk vlan spec. + + :param session: vCenter soap session + :param start: the starting id + :param end: then end id + :returns: The configuration when a port uses trunk mode. This allows + a guest to manage the vlan id. + """ + client_factory = session.vim.client.factory + spec_ns = 'ns0:VmwareDistributedVirtualSwitchTrunkVlanSpec' + vlan_id = client_factory.create('ns0:NumericRange') + vlan_id.start = start + vlan_id.end = end + vl_spec = client_factory.create(spec_ns) + vl_spec.vlanId = vlan_id + vl_spec.inherited = '0' + return vl_spec + + +def get_port_group_spec(session, name, vlan_id, trunk_mode=False): + """Gets the port group spec for a distributed port group + + :param session: vCenter soap session + :param name: the name of the port group + :param vlan_id: vlan_id for the port + :param trunk_mode: indicates if the port will have trunk mode or use + specific tag above + :returns: The configuration for a port group. + """ + client_factory = session.vim.client.factory + pg_spec = client_factory.create('ns0:DVPortgroupConfigSpec') + pg_spec.name = name + pg_spec.type = 'ephemeral' + config = client_factory.create('ns0:VMwareDVSPortSetting') + if trunk_mode: + config.vlan = get_trunk_vlan_spec(session) + elif vlan_id: + config.vlan = get_vlan_spec(session, vlan_id) + pg_spec.defaultPortConfig = config + return pg_spec + + +def add_port_group(session, dvs_moref, name, vlan_id=None, + trunk_mode=False): + """Add a new port group to the dvs_moref + + :param session: vCenter soap session + :param dvs_moref: managed DVS object reference + :param name: the name of the port group + :param vlan_id: vlan_id for the port + :param trunk_mode: indicates if the port will have trunk mode or use + specific tag above + :returns: The new portgroup moref + """ + pg_spec = get_port_group_spec(session, name, vlan_id, + trunk_mode=trunk_mode) + task = session.invoke_api(session.vim, + 'CreateDVPortgroup_Task', + dvs_moref, + spec=pg_spec) + task_info = session.wait_for_task(task) + LOG.info("%(name)s create on %(dvs)s with %(value)s.", + {'name': name, + 'dvs': dvs_moref.value, + 'value': task_info.result.value}) + return task_info.result + + +def get_portgroups(session, dvs_moref): + """Gets all configured portgroups on the dvs_moref + + :param session: vCenter soap session + :param dvs_moref: managed DVS object reference + :returns: List of tuples that have the following format: + (portgroup name, port group moref) + """ + pgs = [] + port_groups = session.invoke_api(vim_util, + 'get_object_properties', + session.vim, + dvs_moref, + ['portgroup']) + while port_groups: + if len(port_groups) and hasattr(port_groups[0], 'propSet'): + for prop in port_groups[0].propSet: + for val in prop.val[0]: + props = session.invoke_api(vim_util, + 'get_object_properties', + session.vim, + val, ['name']) + if len(props) and hasattr(props[0], 'propSet'): + for prop in props[0].propSet: + pgs.append((prop.val, val)) + port_groups = session._call_method(vim_util, 'continue_retrieval', + port_groups) + return pgs + + +def delete_port_group(session, portgroup_moref): + """Delete a specific port group + + :param session: vCenter soap session + :param portgroup_moref: managed portgroup object reference + """ + task = session.invoke_api(session.vim, + 'Destroy_Task', + portgroup_moref) + session.wait_for_task(task) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo_vmware/tests/test_api.py new/oslo.vmware-2.32.2/oslo_vmware/tests/test_api.py --- old/oslo.vmware-2.31.0/oslo_vmware/tests/test_api.py 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo_vmware/tests/test_api.py 2019-02-28 19:02:46.000000000 +0100 @@ -24,6 +24,7 @@ import six import suds +from oslo_context import context from oslo_vmware import api from oslo_vmware import exceptions from oslo_vmware import pbm @@ -393,7 +394,10 @@ 'api') self.assertEqual(fault_list, ex.fault_list) - def test_wait_for_task(self): + @mock.patch.object(context, 'get_current') + def test_wait_for_task(self, mock_curr_ctx): + ctx = mock.Mock() + mock_curr_ctx.return_value = ctx api_session = self._create_api_session(True) task_info_list = [('queued', 0), ('running', 40), ('success', 100)] task_info_list_size = len(task_info_list) @@ -420,8 +424,41 @@ skip_op_id=True) self.assertEqual(task_info_list_size, api_session.invoke_api.call_count) + mock_curr_ctx.assert_called_once() + self.assertEqual(3, ctx.update_store.call_count) - def test_wait_for_task_with_error_state(self): + @mock.patch.object(context, 'get_current', return_value=None) + def test_wait_for_task_no_ctx(self, mock_curr_ctx): + api_session = self._create_api_session(True) + task_info_list = [('queued', 0), ('running', 40), ('success', 100)] + task_info_list_size = len(task_info_list) + + def invoke_api_side_effect(module, method, *args, **kwargs): + (state, progress) = task_info_list.pop(0) + task_info = mock.Mock() + task_info.progress = progress + task_info.queueTime = datetime(2016, 12, 6, 15, 29, 43, 79060) + task_info.completeTime = datetime(2016, 12, 6, 15, 29, 50, 79060) + task_info.state = state + return task_info + + api_session.invoke_api = mock.Mock(side_effect=invoke_api_side_effect) + task = mock.Mock() + with mock.patch.object(greenthread, 'sleep'): + ret = api_session.wait_for_task(task) + self.assertEqual('success', ret.state) + self.assertEqual(100, ret.progress) + api_session.invoke_api.assert_called_with(vim_util, + 'get_object_property', + api_session.vim, task, + 'info', + skip_op_id=True) + self.assertEqual(task_info_list_size, + api_session.invoke_api.call_count) + mock_curr_ctx.assert_called_once() + + @mock.patch.object(context, 'get_current') + def test_wait_for_task_with_error_state(self, mock_curr_ctx): api_session = self._create_api_session(True) task_info_list = [('queued', 0), ('running', 40), ('error', -1)] task_info_list_size = len(task_info_list) @@ -446,8 +483,10 @@ skip_op_id=True) self.assertEqual(task_info_list_size, api_session.invoke_api.call_count) + mock_curr_ctx.assert_called_once() - def test_wait_for_task_with_invoke_api_exception(self): + @mock.patch.object(context, 'get_current') + def test_wait_for_task_with_invoke_api_exception(self, mock_curr_ctx): api_session = self._create_api_session(True) api_session.invoke_api = mock.Mock( side_effect=exceptions.VimException(None)) @@ -461,6 +500,7 @@ api_session.vim, task, 'info', skip_op_id=True) + mock_curr_ctx.assert_called_once() def test_wait_for_lease_ready(self): api_session = self._create_api_session(True) @@ -551,9 +591,11 @@ ): fake_task = mock.Mock() fake_task.value = 'task-1' + ctx = mock.Mock() self.assertRaises(expected_exception, api_session._poll_task, - fake_task) + fake_task, + ctx) def test_poll_task_well_known_exceptions(self): for k, v in six.iteritems(exceptions._fault_classes_registry): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo_vmware/tests/test_dvs_util.py new/oslo.vmware-2.32.2/oslo_vmware/tests/test_dvs_util.py --- old/oslo.vmware-2.31.0/oslo_vmware/tests/test_dvs_util.py 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.vmware-2.32.2/oslo_vmware/tests/test_dvs_util.py 2019-02-28 19:02:46.000000000 +0100 @@ -0,0 +1,139 @@ +# Copyright (c) 2018 VMware, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +""" +Unit tests for VMware DVS utility module. +""" + +import collections + +import mock + +from oslo_vmware import dvs_util +from oslo_vmware.tests import base +from oslo_vmware import vim_util + +ObjectContent = collections.namedtuple('ObjectContent', ['obj', 'propSet']) +DynamicProperty = collections.namedtuple('Property', ['name', 'val']) +Moref = collections.namedtuple('Moref', ['name', 'type']) + + +class DvsUtilTest(base.TestCase): + """Test class for utility methods in dvs_util.""" + + def test_get_dvs_moref(self): + moref = dvs_util.get_dvs_moref('dvs-123') + self.assertEqual('dvs-123', moref.value) + self.assertEqual('VmwareDistributedVirtualSwitch', moref._type) + + def test_get_vlan_spec(self): + session = mock.Mock() + spec = dvs_util.get_vlan_spec(session, 7) + self.assertEqual(7, spec.vlanId) + + def test_get_trunk_vlan_spec(self): + session = mock.Mock() + spec = dvs_util.get_trunk_vlan_spec(session, start=1, end=2) + self.assertEqual(1, spec.vlanId.start) + self.assertEqual(2, spec.vlanId.end) + + def test_get_port_group_spec(self): + session = mock.Mock() + spec = dvs_util.get_port_group_spec(session, 'pg', 7) + self.assertEqual('pg', spec.name) + self.assertEqual('ephemeral', spec.type) + self.assertEqual(7, spec.defaultPortConfig.vlan.vlanId) + + def test_get_port_group_spec_trunk(self): + session = mock.Mock() + spec = dvs_util.get_port_group_spec(session, 'pg', None, + trunk_mode=True) + self.assertEqual('pg', spec.name) + self.assertEqual('ephemeral', spec.type) + self.assertEqual(0, spec.defaultPortConfig.vlan.start) + self.assertEqual(4094, spec.defaultPortConfig.vlan.end) + + @mock.patch.object(dvs_util, 'get_port_group_spec') + def test_add_port_group(self, mock_spec): + session = mock.Mock() + dvs_moref = dvs_util.get_dvs_moref('dvs-123') + spec = dvs_util.get_port_group_spec(session, 'pg', 7) + mock_spec.return_value = spec + pg_moref = vim_util.get_moref('dvportgroup-7', + 'DistributedVirtualPortgroup') + + def wait_for_task_side_effect(task): + task_info = mock.Mock() + task_info.result = pg_moref + return task_info + + session.wait_for_task.side_effect = wait_for_task_side_effect + pg = dvs_util.add_port_group(session, dvs_moref, 'pg', + vlan_id=7) + self.assertEqual(pg, pg_moref) + session.invoke_api.assert_called_once_with( + session.vim, 'CreateDVPortgroup_Task', dvs_moref, + spec=spec) + + @mock.patch.object(dvs_util, 'get_port_group_spec') + def test_add_port_group_trunk(self, mock_spec): + session = mock.Mock() + dvs_moref = dvs_util.get_dvs_moref('dvs-123') + spec = dvs_util.get_port_group_spec(session, 'pg', None, + trunk_mode=True) + mock_spec.return_value = spec + dvs_util.add_port_group(session, dvs_moref, 'pg', + trunk_mode=True) + session.invoke_api.assert_called_once_with( + session.vim, 'CreateDVPortgroup_Task', dvs_moref, + spec=spec) + + def test_get_portgroups_empty(self): + session = mock.Mock() + dvs_moref = dvs_util.get_dvs_moref('dvs-123') + session.invoke_api.return_value = [] + pgs = dvs_util.get_portgroups(session, dvs_moref) + self.assertEqual([], pgs) + + def test_get_portgroups(self): + session = mock.Mock() + dvs_moref = dvs_util.get_dvs_moref('dvs-123') + pg_moref = vim_util.get_moref('dvportgroup-7', + 'DistributedVirtualPortgroup') + + def session_invoke_api_side_effect(module, method, *args, **kwargs): + if module == vim_util and method == 'get_object_properties': + if ['portgroup'] in args: + propSet = [DynamicProperty(name='portgroup', + val=[[pg_moref]])] + return [ObjectContent(obj=dvs_moref, + propSet=propSet)] + if ['name'] in args: + propSet = [DynamicProperty(name='name', + val='pg-name')] + return [ObjectContent(obj=pg_moref, + propSet=propSet)] + + session.invoke_api.side_effect = session_invoke_api_side_effect + session._call_method.return_value = [] + pgs = dvs_util.get_portgroups(session, dvs_moref) + result = [('pg-name', pg_moref)] + self.assertEqual(result, pgs) + + def test_delete_port_group(self): + session = mock.Mock() + dvs_util.delete_port_group(session, 'pg-moref') + session.invoke_api.assert_called_once_with( + session.vim, 'Destroy_Task', 'pg-moref') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/oslo_vmware/tests/test_exceptions.py new/oslo.vmware-2.32.2/oslo_vmware/tests/test_exceptions.py --- old/oslo.vmware-2.31.0/oslo_vmware/tests/test_exceptions.py 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/oslo_vmware/tests/test_exceptions.py 2019-02-28 19:02:46.000000000 +0100 @@ -43,7 +43,8 @@ def test_vim_fault_exception(self): vfe = exceptions.VimFaultException([ValueError("example")], _("cause")) string = str(vfe) - self.assertEqual("cause\nFaults: [ValueError('example',)]", string) + self.assertIn(string, ["cause\nFaults: [ValueError('example',)]", + "cause\nFaults: [ValueError('example')]"]) def test_vim_fault_exception_with_cause_and_details(self): vfe = exceptions.VimFaultException([ValueError("example")], @@ -51,11 +52,14 @@ "FooBar", {'foo': 'bar'}) string = str(vfe) - self.assertEqual("MyMessage\n" - "Cause: FooBar\n" - "Faults: [ValueError('example',)]\n" - "Details: {'foo': 'bar'}", - string) + self.assertIn(string, ["MyMessage\n" + "Cause: FooBar\n" + "Faults: [ValueError('example',)]\n" + "Details: {'foo': 'bar'}", + "MyMessage\n" + "Cause: FooBar\n" + "Faults: [ValueError('example')]\n" + "Details: {'foo': 'bar'}"]) def _create_subclass_exception(self): class VimSubClass(exceptions.VimException): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/releasenotes/notes/reno.cache new/oslo.vmware-2.32.2/releasenotes/notes/reno.cache --- old/oslo.vmware-2.31.0/releasenotes/notes/reno.cache 2018-07-20 03:10:15.000000000 +0200 +++ new/oslo.vmware-2.32.2/releasenotes/notes/reno.cache 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ ---- -file-contents: {} -notes: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/releasenotes/source/index.rst new/oslo.vmware-2.32.2/releasenotes/source/index.rst --- old/oslo.vmware-2.31.0/releasenotes/source/index.rst 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/releasenotes/source/index.rst 2019-02-28 19:02:46.000000000 +0100 @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + rocky queens pike ocata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/releasenotes/source/locale/en_GB/LC_MESSAGES/releasenotes.po new/oslo.vmware-2.32.2/releasenotes/source/locale/en_GB/LC_MESSAGES/releasenotes.po --- old/oslo.vmware-2.31.0/releasenotes/source/locale/en_GB/LC_MESSAGES/releasenotes.po 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/releasenotes/source/locale/en_GB/LC_MESSAGES/releasenotes.po 2019-02-28 19:02:46.000000000 +0100 @@ -3,13 +3,13 @@ # Andi Chandler <andi@gowling.com>, 2018. #zanata msgid "" msgstr "" -"Project-Id-Version: oslo.vmware Release Notes\n" +"Project-Id-Version: oslo.vmware\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-30 01:47+0000\n" +"POT-Creation-Date: 2018-08-13 07:06+0000\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2018-01-27 01:25+0000\n" +"PO-Revision-Date: 2018-08-08 07:53+0000\n" "Last-Translator: Andi Chandler <andi@gowling.com>\n" "Language-Team: English (United Kingdom)\n" "Language: en_GB\n" @@ -34,6 +34,9 @@ msgid "Queens Series Release Notes" msgstr "Queens Series Release Notes" +msgid "Rocky Series Release Notes" +msgstr "Rocky Series Release Notes" + msgid "Switch to reno for managing release notes." msgstr "Switch to reno for managing release notes." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/releasenotes/source/rocky.rst new/oslo.vmware-2.32.2/releasenotes/source/rocky.rst --- old/oslo.vmware-2.31.0/releasenotes/source/rocky.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.vmware-2.32.2/releasenotes/source/rocky.rst 2019-02-28 19:02:46.000000000 +0100 @@ -0,0 +1,6 @@ +=================================== + Rocky Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/rocky diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/requirements.txt new/oslo.vmware-2.32.2/requirements.txt --- old/oslo.vmware-2.31.0/requirements.txt 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/requirements.txt 2019-02-28 19:02:46.000000000 +0100 @@ -20,3 +20,4 @@ requests>=2.14.2 # Apache-2.0 urllib3>=1.21.1 # MIT oslo.concurrency>=3.26.0 # Apache-2.0 +oslo.context>=2.19.2 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/setup.cfg new/oslo.vmware-2.32.2/setup.cfg --- old/oslo.vmware-2.31.0/setup.cfg 2018-07-20 03:10:15.000000000 +0200 +++ new/oslo.vmware-2.32.2/setup.cfg 2019-02-28 19:05:12.000000000 +0100 @@ -4,7 +4,7 @@ description-file = README.rst author = OpenStack -author-email = openstack-dev@lists.openstack.org +author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/oslo.vmware/latest/ classifier = Environment :: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.vmware-2.31.0/test-requirements.txt new/oslo.vmware-2.32.2/test-requirements.txt --- old/oslo.vmware-2.31.0/test-requirements.txt 2018-07-20 03:07:21.000000000 +0200 +++ new/oslo.vmware-2.32.2/test-requirements.txt 2019-02-28 19:02:46.000000000 +0100 @@ -22,3 +22,4 @@ bandit>=1.1.0 # Apache-2.0 ddt>=1.0.1 # MIT +oslo.context>=2.19.2 # Apache-2.0
participants (1)
-
root