Commit Graph

7 Commits

Author SHA1 Message Date
Stephen Finucane deae814611 Remove the PowerVM driver
The PowerVM driver was deprecated in November 2021 as part of change
Icdef0a03c3c6f56b08ec9685c6958d6917bc88cb. As noted there, all
indications suggest that this driver is no longer maintained and may be
abandonware. It's been some time and there's still no activity here so
it's time to abandon this for real.

This isn't as tied into the codebase as the old XenAPI driver was, so
removal is mostly a case of deleting large swathes of code. Lovely.

Change-Id: Ibf4f36136f2c65adad64f75d665c00cf2de4b400
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-08-02 15:31:19 +02:00
Stephen Finucane 89ef050b8c Use unittest.mock instead of third party mock
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] > 'unittest':
                  break
              elif tokens[1] == 'unittest' and (
                  len(tokens) == 2 or tokens[4] > '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 <stephenfin@redhat.com>
2022-08-01 17:46:26 +02:00
esberglu ed525cc403 PowerVM Driver: Network interface attach/detach
This adds the ability to hotplug network interfaces for the powervm
virt driver.

Blueprint: powervm-network-hotplug
Change-Id: I78b94c9731c35e3291d46b9bf9f5554e21c2429e
2018-03-29 09:06:09 -04:00
esberglu db686fe185 Use correct arguments in task inits
The CreateAndConnectCfgDrive and DeleteVOpt tasks were passing the
instance into the task.Task init as the first argument. The first arg
for the Task init is actually the task name [1]. This means that those
task names were string representations of the instance which will cause
failures if there are any non-ascii characters. This corrects the Task
init calls by removing instance as the first argument. The name kwarg
is now being used throughout the PowerVM tasks to avoid similar issues
in the future.

[1] https://github.com/openstack/taskflow/blob/3.1.0/taskflow/task.py#L62

Change-Id: I991a5ea33daa9a21f774fe24882ed40f990b8e0e
Closes-Bug: #1748950
2018-02-13 11:26:47 -06:00
esberglu c352901ce4 Use NoDBTestCase for powervm driver tests
TestCase is being replaced by NoDBTestCase for the powervm driver test
code. This will prevent running the database schema migrations
unnecessarily and will let the developer know if the tests touch the
DB when the test case is claiming that it shouldn't.

Change-Id: I2b04b785c71c6f2cc825215e2773a00e85a67a89
2017-11-15 09:55:53 -06:00
Eric Fried f112dc686d PowerVM Driver: SSP emphemeral disk support
Add support for nova ephemeral disk backed by PowerVM Shared Storage
Pools (a cluster file system).

Change-Id: I3cf397e3b30b083eb46ea29c1817b61558d1e558
Partially-Implements: blueprint powervm-nova-compute-driver
2017-05-25 16:21:23 -05:00
Eric Fried 64914fb15e PowerVM Driver: spawn/destroy #3: TaskFlow
This change set builds on I85f740999b8d085e803a39c35cc1897c0fb063ad,
introducing the TaskFlow framework for spawn and destroy.  It should be
functionally equivalent to the aforementioned, but sets us up for the
more complex TaskFlow usage in subsequent additions to the PowerVM
driver implementation.

Change-Id: Idfefc2db18d0f473a028b7bb8b593d39067e090d
Partially-Implements: blueprint powervm-nova-compute-driver
2017-04-21 10:57:49 -05:00