<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/nova.git/nova/tests/unit/objects/test_cell_mapping.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>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>Fix formatting non-templated cell URLs with no config</title>
<updated>2018-10-16T20:11:17+00:00</updated>
<author>
<name>Dan Smith</name>
<email>dansmith@redhat.com</email>
</author>
<published>2018-10-16T16:58:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=133d6b3bcc26bb2e66ef303011280e38add00702'/>
<id>133d6b3bcc26bb2e66ef303011280e38add00702</id>
<content type='text'>
If transport_url or connection are unset in config, we will fail to format
even non-templated cell mapping URLs due to an overly specific check in the
format routines. This fixes it by always bailing on templating if the config
is unset, and keeping the error message if we were unable to format a
template as a result.

Change-Id: I760580b8e6594be2bee99a5b825a690b07ab9deb
Closes-Bug: #1798158
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If transport_url or connection are unset in config, we will fail to format
even non-templated cell mapping URLs due to an overly specific check in the
format routines. This fixes it by always bailing on templating if the config
is unset, and keeping the error message if we were unable to format a
template as a result.

Change-Id: I760580b8e6594be2bee99a5b825a690b07ab9deb
Closes-Bug: #1798158
</pre>
</div>
</content>
</entry>
<entry>
<title>Use uuidsentinel from oslo.utils</title>
<updated>2018-09-05T14:08:54+00:00</updated>
<author>
<name>Eric Fried</name>
<email>efried@us.ibm.com</email>
</author>
<published>2018-09-05T14:08:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=8e1ca5bf34f924b9a23ddbcf31ae727a7dcacb20'/>
<id>8e1ca5bf34f924b9a23ddbcf31ae727a7dcacb20</id>
<content type='text'>
oslo.utils release 3.37.0 [1] introduced uuidsentinel [2]. This change
rips out nova's uuidsentinel and replaces it with the one from
oslo.utils.

[1] https://review.openstack.org/#/c/599754/
[2] https://review.openstack.org/#/c/594179/

Change-Id: I7f5f08691ca3f73073c66c29dddb996fb2c2b266
Depends-On: https://review.openstack.org/600041
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
oslo.utils release 3.37.0 [1] introduced uuidsentinel [2]. This change
rips out nova's uuidsentinel and replaces it with the one from
oslo.utils.

[1] https://review.openstack.org/#/c/599754/
[2] https://review.openstack.org/#/c/594179/

Change-Id: I7f5f08691ca3f73073c66c29dddb996fb2c2b266
Depends-On: https://review.openstack.org/600041
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow templated cell_mapping URLs</title>
<updated>2018-06-27T19:54:44+00:00</updated>
<author>
<name>Dan Smith</name>
<email>dansmith@redhat.com</email>
</author>
<published>2018-06-26T17:44:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=50658eee4fe26a55854642119beeff46c0d0108a'/>
<id>50658eee4fe26a55854642119beeff46c0d0108a</id>
<content type='text'>
The way we store DB and MQ URLs in the API database causes issues for
some deployments (and deployment tools) which want to use per-host
credentials or remote hostnames. Since all the URLs loaded from the
database are the same on all systems, this becomes very difficult and
some have even resorted to using client-based aliasing underneath Nova
and just providing URLs that reference those aliases.

This makes our CellMapping object load the URLs out of the database,
and apply variable substitution from the CONF-resident base URLs
for any fields provided. Such functionality will let operators
define per-host credentials in [database]/connection, for example,
and have those applied to the database_connection URLs loaded from
CellMapping records.

Change-Id: Iab296c27bcd56162e2efca5fb232cae0aea1160e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The way we store DB and MQ URLs in the API database causes issues for
some deployments (and deployment tools) which want to use per-host
credentials or remote hostnames. Since all the URLs loaded from the
database are the same on all systems, this becomes very difficult and
some have even resorted to using client-based aliasing underneath Nova
and just providing URLs that reference those aliases.

This makes our CellMapping object load the URLs out of the database,
and apply variable substitution from the CONF-resident base URLs
for any fields provided. Such functionality will let operators
define per-host credentials in [database]/connection, for example,
and have those applied to the database_connection URLs loaded from
CellMapping records.

Change-Id: Iab296c27bcd56162e2efca5fb232cae0aea1160e
</pre>
</div>
</content>
</entry>
<entry>
<title>Cleanup patch for the cell-disable series</title>
<updated>2018-04-13T08:03:53+00:00</updated>
<author>
<name>Surya Seetharaman</name>
<email>suryaseetharaman.9@gmail.com</email>
</author>
<published>2018-04-06T09:25:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=441a637771d0be7387ff65598872ceec13e87778'/>
<id>441a637771d0be7387ff65598872ceec13e87778</id>
<content type='text'>
This patch addresses the cleanup comments from the reviewers
for the cell-disable spec series.

Change-Id: I9e6e9518ca380b497f411dd01fed85562dd2731c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch addresses the cleanup comments from the reviewers
for the cell-disable spec series.

Change-Id: I9e6e9518ca380b497f411dd01fed85562dd2731c
</pre>
</div>
</content>
</entry>
<entry>
<title>Add CellMappingList.get_by_disabled() query method</title>
<updated>2018-03-21T15:52:17+00:00</updated>
<author>
<name>Surya Seetharaman</name>
<email>suryaseetharaman.9@gmail.com</email>
</author>
<published>2018-03-06T18:31:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=a26ad9f9a82dfb5210e4a979e67e000989d7ff91'/>
<id>a26ad9f9a82dfb5210e4a979e67e000989d7ff91</id>
<content type='text'>
This query methods helps us to query for either the enabled cells if
False is passed as the value to the disabled argument or the disabled
cells if True is passed as a value to the disabled argument in the call.

Related to blueprint cell-disable

Change-Id: I3e0e1da186e4b3531b42e699ebd466280702d588
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This query methods helps us to query for either the enabled cells if
False is passed as the value to the disabled argument or the disabled
cells if True is passed as a value to the disabled argument in the call.

Related to blueprint cell-disable

Change-Id: I3e0e1da186e4b3531b42e699ebd466280702d588
</pre>
</div>
</content>
</entry>
<entry>
<title>Add disabled field to CellMapping object</title>
<updated>2018-03-20T14:38:29+00:00</updated>
<author>
<name>Surya Seetharaman</name>
<email>suryaseetharaman.9@gmail.com</email>
</author>
<published>2018-03-13T12:32:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=9377127eb887d263ba1c80990f93329fda3c19bc'/>
<id>9377127eb887d263ba1c80990f93329fda3c19bc</id>
<content type='text'>
This patch adds a new field disabled to the CellMapping
object which would be used to represent the value in the
disabled column of the cell_mappings table for each record.

Related to blueprint cell-disable

Change-Id: I1263c5b85f36f65860b9efcfa082948a866ad751
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds a new field disabled to the CellMapping
object which would be used to represent the value in the
disabled column of the cell_mappings table for each record.

Related to blueprint cell-disable

Change-Id: I1263c5b85f36f65860b9efcfa082948a866ad751
</pre>
</div>
</content>
</entry>
<entry>
<title>Sort CellMappingList.get_all() for safety</title>
<updated>2017-04-24T19:00:22+00:00</updated>
<author>
<name>Dan Smith</name>
<email>dansmith@redhat.com</email>
</author>
<published>2017-03-08T15:10:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=32ecd3b50aed66b952cb73ef7cab7b999381ef18'/>
<id>32ecd3b50aed66b952cb73ef7cab7b999381ef18</id>
<content type='text'>
The result of this method should be stable in database order, but since
we depend on it for some pagination, this patch sorts the results by
the most efficient thing we have to be sure.

Related to blueprint cells-aware-api

Change-Id: I81fb8a2a342ad54adc386c02a5fe4a90800fcbb0
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The result of this method should be stable in database order, but since
we depend on it for some pagination, this patch sorts the results by
the most efficient thing we have to be sure.

Related to blueprint cells-aware-api

Change-Id: I81fb8a2a342ad54adc386c02a5fe4a90800fcbb0
</pre>
</div>
</content>
</entry>
<entry>
<title>Add identity helper property to CellMapping</title>
<updated>2017-03-10T17:58:34+00:00</updated>
<author>
<name>Dan Smith</name>
<email>dansmith@redhat.com</email>
</author>
<published>2017-03-09T16:14:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=35f803f6f4069902f1d343e5db7cdec081af91cd'/>
<id>35f803f6f4069902f1d343e5db7cdec081af91cd</id>
<content type='text'>
This adds CellMapping.identity, a property to help with quick logging of
a CellMapping. It's tempting to just log a a whole CellMapping object,
but that can be bad due to the credentials stored within. This adds a
convenient way to log the uuid or name-and-uuid of a CellMapping without
having to replicate the is-name-set-or-none logic everywhere.

Related to blueprint cells-aware-api
Change-Id: Ie8eaf08e9f5bda56431358c40ccf187251be4542
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds CellMapping.identity, a property to help with quick logging of
a CellMapping. It's tempting to just log a a whole CellMapping object,
but that can be bad due to the credentials stored within. This adds a
convenient way to log the uuid or name-and-uuid of a CellMapping without
having to replicate the is-name-set-or-none logic everywhere.

Related to blueprint cells-aware-api
Change-Id: Ie8eaf08e9f5bda56431358c40ccf187251be4542
</pre>
</div>
</content>
</entry>
<entry>
<title>Add is_cell0 helper method</title>
<updated>2016-09-15T14:35:26+00:00</updated>
<author>
<name>Andrew Laski</name>
<email>andrew@lascii.com</email>
</author>
<published>2016-09-15T14:35:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=e202a01491a81e80d8e6df77cf44367e071d6ce2'/>
<id>e202a01491a81e80d8e6df77cf44367e071d6ce2</id>
<content type='text'>
This simplifies the task of checking if a CellMapping object is for
cell0 by adding a helper method.

Change-Id: I7e71ccfa0e1e6224cc807a2f27cd476ae705da99
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This simplifies the task of checking if a CellMapping object is for
cell0 by adding a helper method.

Change-Id: I7e71ccfa0e1e6224cc807a2f27cd476ae705da99
</pre>
</div>
</content>
</entry>
</feed>
