<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/nova.git/nova/tests/unit/accelerator, 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 typos</title>
<updated>2022-05-30T12:10:00+00:00</updated>
<author>
<name>Rajesh Tailor</name>
<email>ratailor@redhat.com</email>
</author>
<published>2022-05-23T11:26:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=2521810e553593f8d02adeef0f089b60bc7f71a6'/>
<id>2521810e553593f8d02adeef0f089b60bc7f71a6</id>
<content type='text'>
This change fixes some of the typos in unit tests as well
as in nova code-base.

Change-Id: I209bbb270baf889fcb2b9a4d1ce0ab4a962d0d0e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change fixes some of the typos in unit tests as well
as in nova code-base.

Change-Id: I209bbb270baf889fcb2b9a4d1ce0ab4a962d0d0e
</pre>
</div>
</content>
</entry>
<entry>
<title>smartnic support - reject server move and suspend</title>
<updated>2021-08-05T07:58:41+00:00</updated>
<author>
<name>Yongli He</name>
<email>yonglihe@intel.com</email>
</author>
<published>2021-03-11T07:26:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=1f53176d2f4303b909ecad18cb0f027bfcd0b7ae'/>
<id>1f53176d2f4303b909ecad18cb0f027bfcd0b7ae</id>
<content type='text'>
Server with ARQ in the port does not support move and suspend,
reject these operations in API stage:

	- resize
	- shelve
	- live_migrate
	- evacuate
	- suspend
	- attach/detach a smartnic port

Reject create server with smartnic in port if minimal compute
service version less than 57

Reject create server with port which have a malformed device
profile that request multi devices, like:
  {
      "resources:CUSTOM_ACCELERATOR_FPGA": "2",
      "trait:CUSTOM_INTEL_PAC_ARRIA10": "required",
  }

Implements: blueprint sriov-smartnic-support
Change-Id: Ia705a0341fb067e746a3b91ec4fc6d149bcaffb8
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Server with ARQ in the port does not support move and suspend,
reject these operations in API stage:

	- resize
	- shelve
	- live_migrate
	- evacuate
	- suspend
	- attach/detach a smartnic port

Reject create server with smartnic in port if minimal compute
service version less than 57

Reject create server with port which have a malformed device
profile that request multi devices, like:
  {
      "resources:CUSTOM_ACCELERATOR_FPGA": "2",
      "trait:CUSTOM_INTEL_PAC_ARRIA10": "required",
  }

Implements: blueprint sriov-smartnic-support
Change-Id: Ia705a0341fb067e746a3b91ec4fc6d149bcaffb8
</pre>
</div>
</content>
</entry>
<entry>
<title>Smartnic support - cyborg drive</title>
<updated>2021-08-05T07:58:23+00:00</updated>
<author>
<name>Yongli He</name>
<email>yongli.he@@intel.com</email>
</author>
<published>2021-01-19T02:21:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=9c55d5d59da3543bcc79e8e4aaaed5588defe4c1'/>
<id>9c55d5d59da3543bcc79e8e4aaaed5588defe4c1</id>
<content type='text'>
A device profile keeps in port field "device_profile", a cyborg arq
is created based on the device profile.

Few cyborg interfaces added to support smartnic operations.

    - create_arqs
      create arqs from device_profile

    - get_arq_device_rp_uuid
      get arq device provider uuid by arq

    - get_arq_by_uuid
      retrieve arq by arq uuid

Implements: blueprint sriov-smartnic-support

Change-Id: I9ca54d63ebda626f41159b13bbe40549a714f0a1
Co-Authored-By: Shaohe Feng &lt;shaohe.feng@intel.com&gt;
Co-Authored-By: Xinran Wang &lt;xin-ran.wang@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A device profile keeps in port field "device_profile", a cyborg arq
is created based on the device profile.

Few cyborg interfaces added to support smartnic operations.

    - create_arqs
      create arqs from device_profile

    - get_arq_device_rp_uuid
      get arq device provider uuid by arq

    - get_arq_by_uuid
      retrieve arq by arq uuid

Implements: blueprint sriov-smartnic-support

Change-Id: I9ca54d63ebda626f41159b13bbe40549a714f0a1
Co-Authored-By: Shaohe Feng &lt;shaohe.feng@intel.com&gt;
Co-Authored-By: Xinran Wang &lt;xin-ran.wang@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Cyborg evacuate support</title>
<updated>2020-09-01T08:41:45+00:00</updated>
<author>
<name>Sean Mooney</name>
<email>work@seanmooney.info</email>
</author>
<published>2020-03-26T23:01:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=1356ef5b571f80d9fc9a0284034e853cb9c97233'/>
<id>1356ef5b571f80d9fc9a0284034e853cb9c97233</id>
<content type='text'>
This change extends the conductor manager
to append the cyborg resource request to the
request spec when performing an evacuate.

This change passes the ARQs to spawn during rebuild
and evacuate. On evacuate the existing ARQs will be deleted
and new ARQs will be created and bound, during rebuild the
existing ARQs are reused.

This change extends the rebuild_instance compute rpcapi
function to carry the arq_uuids. This eliminates the
need to lookup the uuids associated with the arqs assinged
to the instance by quering cyborg.

Co-Authored-By: Wenping Song &lt;songwenping@inspur.com&gt;
Co-Authored-By: Brin Zhang &lt;zhangbailin@inspur.com&gt;

Implements: blueprint cyborg-rebuild-and-evacuate
Change-Id: I147bf4d95e6d86ff1f967a8ce37260730f21d236
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change extends the conductor manager
to append the cyborg resource request to the
request spec when performing an evacuate.

This change passes the ARQs to spawn during rebuild
and evacuate. On evacuate the existing ARQs will be deleted
and new ARQs will be created and bound, during rebuild the
existing ARQs are reused.

This change extends the rebuild_instance compute rpcapi
function to carry the arq_uuids. This eliminates the
need to lookup the uuids associated with the arqs assinged
to the instance by quering cyborg.

Co-Authored-By: Wenping Song &lt;songwenping@inspur.com&gt;
Co-Authored-By: Brin Zhang &lt;zhangbailin@inspur.com&gt;

Implements: blueprint cyborg-rebuild-and-evacuate
Change-Id: I147bf4d95e6d86ff1f967a8ce37260730f21d236
</pre>
</div>
</content>
</entry>
<entry>
<title>Delete ARQs by UUID if Cyborg ARQ bind fails.</title>
<updated>2020-07-23T07:26:07+00:00</updated>
<author>
<name>Sundar Nadathur</name>
<email>sundar.nadathur@intel.com</email>
</author>
<published>2020-03-31T02:24:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=d94ea23d3d64ecd3f2539a337c066487b938fcad'/>
<id>d94ea23d3d64ecd3f2539a337c066487b938fcad</id>
<content type='text'>
During the reivew of the cyborg series it was noted that
in some cases ARQs could be leaked during binding.
See https://review.opendev.org/#/c/673735/46/nova/conductor/manager.py@1632

This change adds a delete_arqs_by_uuid function that can delete
unbound ARQs by instance uuid.

This change modifies build_instances and schedule_and_build_instances
to handel the AcceleratorRequestBindingFailed exception raised when
binding fails and clean up instance arqs.

Co-Authored-By: Wenping Song &lt;songwenping@inspur.com&gt;

Closes-Bug: #1872730
Change-Id: I86c2f00e2368fe02211175e7328b2cd9c0ebf41b
Blueprint: nova-cyborg-interaction
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During the reivew of the cyborg series it was noted that
in some cases ARQs could be leaked during binding.
See https://review.opendev.org/#/c/673735/46/nova/conductor/manager.py@1632

This change adds a delete_arqs_by_uuid function that can delete
unbound ARQs by instance uuid.

This change modifies build_instances and schedule_and_build_instances
to handel the AcceleratorRequestBindingFailed exception raised when
binding fails and clean up instance arqs.

Co-Authored-By: Wenping Song &lt;songwenping@inspur.com&gt;

Closes-Bug: #1872730
Change-Id: I86c2f00e2368fe02211175e7328b2cd9c0ebf41b
Blueprint: nova-cyborg-interaction
</pre>
</div>
</content>
</entry>
<entry>
<title>Delete ARQs for an instance when the instance is deleted.</title>
<updated>2020-03-25T05:44:18+00:00</updated>
<author>
<name>Sundar Nadathur</name>
<email>sundar.nadathur@intel.com</email>
</author>
<published>2019-07-31T02:55:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=a20aca7f5e8ed0a2e4a76957fe746f60d9b78669'/>
<id>a20aca7f5e8ed0a2e4a76957fe746f60d9b78669</id>
<content type='text'>
This patch series now works for many VM operations with libvirt:
* Creation, deletion of VM instances.
* Pause/unpause

The following works but is a no-op:
* Lock/unlock

Hard reboots are taken up in a later patch in this series.
Soft reboots work for accelerators unless some unrelated failure
forces a hard reboot in the libvirt driver.

Suspend is not supported yet. It would fail with this error:
   libvirtError: Requested operation is not valid:
   domain has assigned non-USB host devices

Shelve is not supported yet.
Live migration is not intended to be supported with accelerators now.

Change-Id: Icb95890d8f16cad1f7dc18487a48def2f7c9aec2
Blueprint: nova-cyborg-interaction
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch series now works for many VM operations with libvirt:
* Creation, deletion of VM instances.
* Pause/unpause

The following works but is a no-op:
* Lock/unlock

Hard reboots are taken up in a later patch in this series.
Soft reboots work for accelerators unless some unrelated failure
forces a hard reboot in the libvirt driver.

Suspend is not supported yet. It would fail with this error:
   libvirtError: Requested operation is not valid:
   domain has assigned non-USB host devices

Shelve is not supported yet.
Live migration is not intended to be supported with accelerators now.

Change-Id: Icb95890d8f16cad1f7dc18487a48def2f7c9aec2
Blueprint: nova-cyborg-interaction
</pre>
</div>
</content>
</entry>
<entry>
<title>Create and bind Cyborg ARQs.</title>
<updated>2020-03-21T19:03:38+00:00</updated>
<author>
<name>Sundar Nadathur</name>
<email>sundar.nadathur@intel.com</email>
</author>
<published>2019-01-16T08:35:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=cc630b4eb62c4a45ff08a1862a8339a0f129e0a3'/>
<id>cc630b4eb62c4a45ff08a1862a8339a0f129e0a3</id>
<content type='text'>
* Call Cyborg with device profile name to get ARQs (Accelerator Requests).
  Each ARQ corresponds to a single device profile group, which
  corrresponds to a single request group in request spec.
* Match each ARQ to associated request group, and thereby obtain the
  corresponding RP for that ARQ.
* Call Cyborg to bind the ARQ to that host/device-RP.
* When Cyborg sends the ARQ bind notification events, wait for those
  events with a timeout.

Change-Id: I0f8b6bf2b4f4510da6c84fede532533602b6af7f
Blueprint: nova-cyborg-interaction
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Call Cyborg with device profile name to get ARQs (Accelerator Requests).
  Each ARQ corresponds to a single device profile group, which
  corrresponds to a single request group in request spec.
* Match each ARQ to associated request group, and thereby obtain the
  corresponding RP for that ARQ.
* Call Cyborg to bind the ARQ to that host/device-RP.
* When Cyborg sends the ARQ bind notification events, wait for those
  events with a timeout.

Change-Id: I0f8b6bf2b4f4510da6c84fede532533602b6af7f
Blueprint: nova-cyborg-interaction
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Cyborg device profile groups to request spec.</title>
<updated>2020-03-21T19:03:37+00:00</updated>
<author>
<name>Sundar Nadathur</name>
<email>sundar.nadathur@intel.com</email>
</author>
<published>2019-07-31T01:54:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=0c52730f6a138ce3b40efd6a0bd2809b2c41dada'/>
<id>0c52730f6a138ce3b40efd6a0bd2809b2c41dada</id>
<content type='text'>
Find the name of the device profile, if any, in flavor extra specs.
Get its profile groups (equiv to flavor request groups) from Cyborg.
Parse/validate them similar to extra_specs.
Generate RequestGroup objects and add them to the request spec
   (in requested_resources field, following precedent).

Change-Id: Icd2ee9024dd4af0a7eb105eca14df8e458e9de77
Blueprint: nova-cyborg-interaction
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Find the name of the device profile, if any, in flavor extra specs.
Get its profile groups (equiv to flavor request groups) from Cyborg.
Parse/validate them similar to extra_specs.
Generate RequestGroup objects and add them to the request spec
   (in requested_resources field, following precedent).

Change-Id: Icd2ee9024dd4af0a7eb105eca14df8e458e9de77
Blueprint: nova-cyborg-interaction
</pre>
</div>
</content>
</entry>
<entry>
<title>ksa auth conf and client for Cyborg access</title>
<updated>2020-03-21T19:03:37+00:00</updated>
<author>
<name>Sundar Nadathur</name>
<email>sundar.nadathur@intel.com</email>
</author>
<published>2019-01-16T08:31:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/nova.git/commit/?id=c071741d565950ba0a6b43f7b66aad0bdbaf1dff'/>
<id>c071741d565950ba0a6b43f7b66aad0bdbaf1dff</id>
<content type='text'>
Framework for communication with the Cyborg API.

- Standard keystoneauth1 config options for setting up authentication in
the [cyborg] section of nova*.conf.
- A new nova.accelerator.cyborg module containing a get_client method to
return a client containing a keystoneauth1 adapter pointing
to the Cyborg service with user- and service- based authentication.
- Requirements updates to pull in the os-service-types release
containing the 'accelerator' service type.

Change-Id: Iee0766269d61948ad701911e8b0e5e24d3d6eb04
Blueprint: nova-cyborg-interaction
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Framework for communication with the Cyborg API.

- Standard keystoneauth1 config options for setting up authentication in
the [cyborg] section of nova*.conf.
- A new nova.accelerator.cyborg module containing a get_client method to
return a client containing a keystoneauth1 adapter pointing
to the Cyborg service with user- and service- based authentication.
- Requirements updates to pull in the os-service-types release
containing the 'accelerator' service type.

Change-Id: Iee0766269d61948ad701911e8b0e5e24d3d6eb04
Blueprint: nova-cyborg-interaction
</pre>
</div>
</content>
</entry>
</feed>
