<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/nova.git/nova/tests/unit/objects/test_fields.py, branch master</title>
<subtitle>opendev.org: openstack/nova.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/'/>
<entry>
<title>Merge "objects: Don't use generic 'Field' container"</title>
<updated>2022-08-11T03:36:19+00:00</updated>
<author>
<name>Zuul</name>
<email>zuul@review.opendev.org</email>
</author>
<published>2022-08-11T03:36:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=627af67f5e631e8e1b23aa1527517a6cd6abd462'/>
<id>627af67f5e631e8e1b23aa1527517a6cd6abd462</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use unittest.mock instead of third party mock</title>
<updated>2022-08-01T15:46:26+00:00</updated>
<author>
<name>Stephen Finucane</name>
<email>stephenfin@redhat.com</email>
</author>
<published>2020-03-24T15:12:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=89ef050b8c049b9a6f0e2c70408fc93c826c55e0'/>
<id>89ef050b8c049b9a6f0e2c70408fc93c826c55e0</id>
<content type='text'>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib. Most of this
is autogenerated, as described below, but there is one manual change
necessary:

nova/tests/functional/regressions/test_bug_1781286.py
  We need to avoid using 'fixtures.MockPatch' since fixtures is using
  'mock' (the library) under the hood and a call to 'mock.patch.stop'
  found in that test will now "stop" mocks from the wrong library. We
  have discussed making this configurable but the option proposed isn't
  that pretty [1] so this is better.

The remainder was auto-generated with the following (hacky) script, with
one or two manual tweaks after the fact:

  import glob

  for path in glob.glob('nova/tests/**/*.py', recursive=True):
      with open(path) as fh:
          lines = fh.readlines()
      if 'import mock\n' not in lines:
          continue
      import_group_found = False
      create_first_party_group = False
      for num, line in enumerate(lines):
          line = line.strip()
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              for lib in (
                  'ddt', 'six', 'webob', 'fixtures', 'testtools'
                  'neutron', 'cinder', 'ironic', 'keystone', 'oslo',
              ):
                  if lib in tokens[1]:
                      create_first_party_group = True
                      break
              if create_first_party_group:
                  break
              import_group_found = True
          if not import_group_found:
              continue
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              if tokens[1] &gt; 'unittest':
                  break
              elif tokens[1] == 'unittest' and (
                  len(tokens) == 2 or tokens[4] &gt; 'mock'
              ):
                  break
          elif not line:
              break
      if create_first_party_group:
          lines.insert(num, 'from unittest import mock\n\n')
      else:
          lines.insert(num, 'from unittest import mock\n')
      del lines[lines.index('import mock\n')]
      with open(path, 'w+') as fh:
          fh.writelines(lines)

Note that we cannot remove mock from our requirements files yet due to
importing pypowervm unit test code in nova unit tests. This library
still uses the mock lib, and since we are importing test code and that
lib (correctly) only declares mock in its test-requirements.txt, mock
would not otherwise be installed and would cause errors while loading
nova unit test code.

[1] https://github.com/testing-cabal/fixtures/pull/49

Change-Id: Id5b04cf2f6ca24af8e366d23f15cf0e5cac8e1cc
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib. Most of this
is autogenerated, as described below, but there is one manual change
necessary:

nova/tests/functional/regressions/test_bug_1781286.py
  We need to avoid using 'fixtures.MockPatch' since fixtures is using
  'mock' (the library) under the hood and a call to 'mock.patch.stop'
  found in that test will now "stop" mocks from the wrong library. We
  have discussed making this configurable but the option proposed isn't
  that pretty [1] so this is better.

The remainder was auto-generated with the following (hacky) script, with
one or two manual tweaks after the fact:

  import glob

  for path in glob.glob('nova/tests/**/*.py', recursive=True):
      with open(path) as fh:
          lines = fh.readlines()
      if 'import mock\n' not in lines:
          continue
      import_group_found = False
      create_first_party_group = False
      for num, line in enumerate(lines):
          line = line.strip()
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              for lib in (
                  'ddt', 'six', 'webob', 'fixtures', 'testtools'
                  'neutron', 'cinder', 'ironic', 'keystone', 'oslo',
              ):
                  if lib in tokens[1]:
                      create_first_party_group = True
                      break
              if create_first_party_group:
                  break
              import_group_found = True
          if not import_group_found:
              continue
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              if tokens[1] &gt; 'unittest':
                  break
              elif tokens[1] == 'unittest' and (
                  len(tokens) == 2 or tokens[4] &gt; 'mock'
              ):
                  break
          elif not line:
              break
      if create_first_party_group:
          lines.insert(num, 'from unittest import mock\n\n')
      else:
          lines.insert(num, 'from unittest import mock\n')
      del lines[lines.index('import mock\n')]
      with open(path, 'w+') as fh:
          fh.writelines(lines)

Note that we cannot remove mock from our requirements files yet due to
importing pypowervm unit test code in nova unit tests. This library
still uses the mock lib, and since we are importing test code and that
lib (correctly) only declares mock in its test-requirements.txt, mock
would not otherwise be installed and would cause errors while loading
nova unit test code.

[1] https://github.com/testing-cabal/fixtures/pull/49

Change-Id: Id5b04cf2f6ca24af8e366d23f15cf0e5cac8e1cc
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>objects: Don't use generic 'Field' container</title>
<updated>2022-03-29T08:56:01+00:00</updated>
<author>
<name>Stephen Finucane</name>
<email>stephenfin@redhat.com</email>
</author>
<published>2020-06-26T15:43:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=01980cfb0873ecc210fbb65093e79a723021c09d'/>
<id>01980cfb0873ecc210fbb65093e79a723021c09d</id>
<content type='text'>
We have specific fields for most field types. Do the same here.

Change-Id: I261f7cdc1e029d546e75723d6112fa2d2dc68e58
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have specific fields for most field types. Do the same here.

Change-Id: I261f7cdc1e029d546e75723d6112fa2d2dc68e58
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: Poison os.uname</title>
<updated>2021-02-20T15:32:15+00:00</updated>
<author>
<name>Stephen Finucane</name>
<email>stephenfin@redhat.com</email>
</author>
<published>2021-02-12T15:53:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=f7e3e179911e0a7fbad0d108c202c475560dbcea'/>
<id>f7e3e179911e0a7fbad0d108c202c475560dbcea</id>
<content type='text'>
We shouldn't be looking up the architecture of the test node during
tests to ensure tests work across nodes with varying architectures.

Change-Id: I458b1db091e33c0b835e44b5a86de6c0a08f99a3
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
Co-authored-by: Lee Yarwood &lt;lyarwood@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We shouldn't be looking up the architecture of the test node during
tests to ensure tests work across nodes with varying architectures.

Change-Id: I458b1db091e33c0b835e44b5a86de6c0a08f99a3
Signed-off-by: Stephen Finucane &lt;stephenfin@redhat.com&gt;
Co-authored-by: Lee Yarwood &lt;lyarwood@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove six.PY2 and six.PY3</title>
<updated>2020-08-15T07:45:23+00:00</updated>
<author>
<name>Takashi Natsume</name>
<email>takanattie@gmail.com</email>
</author>
<published>2020-05-09T09:34:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=28ed0c5c9a7572c002e520685bed60ccc706175b'/>
<id>28ed0c5c9a7572c002e520685bed60ccc706175b</id>
<content type='text'>
Remove six.PY2 and six.PY3.
Subsequent patches will replace other six usages.

Change-Id: Iccce0ab50eee515e533ab36c8e7adc10cb3f7019
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume &lt;takanattie@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove six.PY2 and six.PY3.
Subsequent patches will replace other six usages.

Change-Id: Iccce0ab50eee515e533ab36c8e7adc10cb3f7019
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume &lt;takanattie@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Switch to using os-resource-classes</title>
<updated>2019-02-07T11:11:09+00:00</updated>
<author>
<name>Chris Dent</name>
<email>cdent@anticdent.org</email>
</author>
<published>2019-01-03T19:31:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=27617ee1931b3240dbd0ad4c7d8ffd64cc202bc9'/>
<id>27617ee1931b3240dbd0ad4c7d8ffd64cc202bc9</id>
<content type='text'>
With the extraction of placement we ended up with resource class names
being duplicated between nova and placement. To address that, the
os-resource-classes library [1] was created to provide a single
authority for standard resource classes and the format of custom
classes.

This patch changes nova to use it, removing the use of the rc_fields
module which used to have the information. A method left in it
(normalize_name) has been moved to utils.py, renamed as
normalize_rc_name, and callers and tests updated accordingly.

Because the placement code is being kept in nova for the time being,
that code's use of rc_fields is maintained, and the module too.
A note is added in the module explain that. Backporting the changes
from extracted-placement to placement-in-nova was considered but
because we no longer have placement tests in nova, that didn't seem
like the right thing to do.

requirements and lower-constraints have been updated.
os-resource-classes is already in global requirements.

For reference the related placement change is at [2].

[1] https://docs.openstack.org/os-resource-classes
[2] https://review.openstack.org/#/c/623556/

Change-Id: I8e579920c0eaca81b563a87429c930b21b3d4dc5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the extraction of placement we ended up with resource class names
being duplicated between nova and placement. To address that, the
os-resource-classes library [1] was created to provide a single
authority for standard resource classes and the format of custom
classes.

This patch changes nova to use it, removing the use of the rc_fields
module which used to have the information. A method left in it
(normalize_name) has been moved to utils.py, renamed as
normalize_rc_name, and callers and tests updated accordingly.

Because the placement code is being kept in nova for the time being,
that code's use of rc_fields is maintained, and the module too.
A note is added in the module explain that. Backporting the changes
from extracted-placement to placement-in-nova was considered but
because we no longer have placement tests in nova, that didn't seem
like the right thing to do.

requirements and lower-constraints have been updated.
os-resource-classes is already in global requirements.

For reference the related placement change is at [2].

[1] https://docs.openstack.org/os-resource-classes
[2] https://review.openstack.org/#/c/623556/

Change-Id: I8e579920c0eaca81b563a87429c930b21b3d4dc5
</pre>
</div>
</content>
</entry>
<entry>
<title>Add bandwidth related standard resource classes</title>
<updated>2018-11-05T22:47:13+00:00</updated>
<author>
<name>Balazs Gibizer</name>
<email>balazs.gibizer@ericsson.com</email>
</author>
<published>2018-05-25T04:47:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=b93b40c6c01a1161f40592d29353c3461669de19'/>
<id>b93b40c6c01a1161f40592d29353c3461669de19</id>
<content type='text'>
Introduce NET_BW_EGR_KILOBIT_PER_SEC and
NET_BW_IGR_KILOBIT_PER_SEC resource classes.

blueprint bandwidth-resource-provider

Change-Id: I996bf705b14b564106426a2e57299638fb178750
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce NET_BW_EGR_KILOBIT_PER_SEC and
NET_BW_IGR_KILOBIT_PER_SEC resource classes.

blueprint bandwidth-resource-provider

Change-Id: I996bf705b14b564106426a2e57299638fb178750
</pre>
</div>
</content>
</entry>
<entry>
<title>Add VIFMigrateData object for live migration</title>
<updated>2018-07-19T13:08:12+00:00</updated>
<author>
<name>Sean Mooney</name>
<email>sean.k.mooney@intel.com</email>
</author>
<published>2017-10-25T14:38:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=0a71a542e02e41ba514984ad49608168b5865696'/>
<id>0a71a542e02e41ba514984ad49608168b5865696</id>
<content type='text'>
- This change adds a new VIFMigrateData object.
- This change adds a new vifs field to the
  base LiveMigrateData object.

Later patches will populate this information during
live migration where nova uses the neutron port
binding extended API to bind the port on the destination
host, and store the destination host binding details
in this object to be leveraged on the source host for
things like defining vif details in the guest before
starting the live migration in the hypervisor.

Note that vif_details and profile must be stored as
serialized dicts similar to
LibvirtLiveMigrateBDMInfo.connection_info_json.

Co-Authored-By: Matt Riedemann &lt;mriedem.os@gmail.com&gt;

Part of blueprint neutron-new-port-binding-api

Change-Id: I174ae21f143016bb23b8043fa22465dac6c71314
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- This change adds a new VIFMigrateData object.
- This change adds a new vifs field to the
  base LiveMigrateData object.

Later patches will populate this information during
live migration where nova uses the neutron port
binding extended API to bind the port on the destination
host, and store the destination host binding details
in this object to be leveraged on the source host for
things like defining vif details in the guest before
starting the live migration in the hypervisor.

Note that vif_details and profile must be stored as
serialized dicts similar to
LibvirtLiveMigrateBDMInfo.connection_info_json.

Co-Authored-By: Matt Riedemann &lt;mriedem.os@gmail.com&gt;

Part of blueprint neutron-new-port-binding-api

Change-Id: I174ae21f143016bb23b8043fa22465dac6c71314
</pre>
</div>
</content>
</entry>
<entry>
<title>Make ResourceClass.normalize_name handle sharp S</title>
<updated>2018-04-10T17:24:40+00:00</updated>
<author>
<name>Eric Fried</name>
<email>efried@us.ibm.com</email>
</author>
<published>2018-04-10T17:24:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=7fd2de85b632575315df0dce2287b3a7b44492f1'/>
<id>7fd2de85b632575315df0dce2287b3a7b44492f1</id>
<content type='text'>
Fixes ResourceClass.normalize_name to produce the same result in py2 and
py3 even when sharp S ('ß') is part of the input.

We do this by waiting until after replacing non-alphanumerics to upcase.

Change-Id: I431fa29d36d0d633374973fc25168344042d6c1a
Closes-Bug: #1762789
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes ResourceClass.normalize_name to produce the same result in py2 and
py3 even when sharp S ('ß') is part of the input.

We do this by waiting until after replacing non-alphanumerics to upcase.

Change-Id: I431fa29d36d0d633374973fc25168344042d6c1a
Closes-Bug: #1762789
</pre>
</div>
</content>
</entry>
<entry>
<title>Test case: ResourceClass.normalize_name with ß</title>
<updated>2018-04-10T17:17:17+00:00</updated>
<author>
<name>Eric Fried</name>
<email>efried@us.ibm.com</email>
</author>
<published>2018-04-10T17:17:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=443980399b03282c37e64e7a529be4960689b34d'/>
<id>443980399b03282c37e64e7a529be4960689b34d</id>
<content type='text'>
Demonstrates the cited bug by invoking ResourceClass.normalize_name on a
string containing sharp S ('ß').  The result is different for py2 and
py3.

Change-Id: I632995c1a234f26f05ef0b5675e0e22b9866b03d
Related-Bug: #1762789
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Demonstrates the cited bug by invoking ResourceClass.normalize_name on a
string containing sharp S ('ß').  The result is different for py2 and
py3.

Change-Id: I632995c1a234f26f05ef0b5675e0e22b9866b03d
Related-Bug: #1762789
</pre>
</div>
</content>
</entry>
</feed>
