Fix code for U-Release

These changes are required to keep
nova-powervm code in sync with the
changes happening in rest of the
community for U release.

This also includes changes proposed in -
https://review.opendev.org/#/c/700683/
to fix the failing py27 job.

Change-Id: I13d8ead2c411973bc280f64bbb94d9115e3ce294
This commit is contained in:
Arun Mani 2020-04-20 07:00:33 -04:00 committed by Elod Illes
parent 376d9493e2
commit 14e2b7043a
16 changed files with 29 additions and 36 deletions

View File

@ -2,6 +2,5 @@
templates:
- check-requirements
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python36-jobs
- openstack-python3-ussuri-jobs
- periodic-stable-jobs

View File

@ -1,4 +1,3 @@
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2,!=2.1.0;python_version>='3.4' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2,!=2.1.0 # BSD
openstackdocstheme>=1.19.0 # Apache-2.0
sphinx-feature-classification>=0.2.0 # Apache-2.0

View File

@ -111,7 +111,7 @@ class TestLocalDisk(test.NoDBTestCase):
self.assertEqual(3, mock_sleep.call_count)
@mock.patch('pypowervm.tasks.storage.upload_new_vdisk', autospec=True)
@mock.patch('nova.image.api.API.download')
@mock.patch('nova.image.glance.API.download')
@mock.patch('nova_powervm.virt.powervm.disk.driver.IterableToFileAdapter')
@mock.patch('nova_powervm.virt.powervm.disk.localdisk.LocalStorage.'
'_get_vg_wrap')

View File

@ -273,7 +273,7 @@ class TestSSPDiskAdapter(test.NoDBTestCase):
@mock.patch('nova_powervm.virt.powervm.disk.driver.DiskAdapter.'
'_get_disk_name')
@mock.patch('pypowervm.tasks.storage.crt_lu')
@mock.patch('nova.image.api.API.download')
@mock.patch('nova.image.glance.API.download')
@mock.patch('nova_powervm.virt.powervm.disk.driver.IterableToFileAdapter')
def test_create_disk_from_image(self, mock_it2f, mock_dl, mock_crt_lu,
mock_gdn, mock_vuuid, mock_gin, mock_goru):

View File

@ -1,4 +1,4 @@
# Copyright 2015, 2017 IBM Corp.
# Copyright 2015, 2020 IBM Corp.
#
# All Rights Reserved.
#
@ -34,7 +34,8 @@ class ImageAPI(fixtures.Fixture):
def setUp(self):
super(ImageAPI, self).setUp()
self.img_api_fx = self.useFixture(fixtures.MockPatch('nova.image.API'))
self.img_api_fx = self.useFixture(
fixtures.MockPatch('nova.image.glance.API'))
class DiskAdapter(fixtures.Fixture):

View File

@ -1366,8 +1366,9 @@ class TestPowerVMDriver(test.NoDBTestCase):
# Validate the rollbacks were called.
self.assertEqual(2, self.vol_drv.connect_volume.call_count)
@mock.patch('nova.compute.utils.netifaces', autospec=True)
@mock.patch('nova_powervm.virt.powervm.slot.build_slot_mgr', autospec=True)
def test_migrate_disk_and_power_off(self, mock_bld_slot_mgr):
def test_migrate_disk_and_power_off(self, mock_bld_slot_mgr, mock_netif):
"""Validates the PowerVM driver migrate / resize operation."""
# Set up the mocks to the migrate / resize operation.
host = self.drv.get_host_ip_addr()
@ -1835,7 +1836,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
fake_bdi = {'block_device_mapping': ['content']}
self.assertListEqual(['content'], self.drv._extract_bdm(fake_bdi))
def test_get_host_ip_addr(self):
@mock.patch('nova.compute.utils.netifaces', autospec=True)
def test_get_host_ip_addr(self, mock_netifaces):
self.assertEqual(self.drv.get_host_ip_addr(), '127.0.0.1')
@mock.patch('nova.virt.powervm_ext.driver.LOG.warning', autospec=True)

View File

@ -31,7 +31,7 @@ class TestImage(test.NoDBTestCase):
@mock.patch('nova.utils.temporary_chown', autospec=True)
@mock.patch(_BUILTIN + '.open', autospec=True)
@mock.patch('nova.image.api.API', autospec=True)
@mock.patch('nova.image.glance.API', autospec=True)
def test_stream_blockdev_to_glance(self, mock_api, mock_open, mock_chown):
mock_open.return_value.__enter__.return_value = 'mock_stream'
image.stream_blockdev_to_glance('context', mock_api, 'image_id',
@ -41,7 +41,7 @@ class TestImage(test.NoDBTestCase):
mock_api.update.assert_called_with('context', 'image_id', 'metadata',
'mock_stream')
@mock.patch('nova.image.api.API', autospec=True)
@mock.patch('nova.image.glance.API', autospec=True)
def test_generate_snapshot_metadata(self, mock_api):
mock_api.get.return_value = {'name': 'image_name'}
mock_instance = mock.Mock()

View File

@ -1,4 +1,4 @@
# Copyright 2016, 2018 IBM Corp.
# Copyright 2016, 2020 IBM Corp.
#
# All Rights Reserved.
#
@ -18,7 +18,7 @@ import mock
from nova import exception
from nova.network import model
from nova.network.neutronv2 import api as netapi
from nova.network import neutron as netapi
from nova import test
from oslo_config import cfg
from pypowervm import exceptions as pvm_ex

View File

@ -20,7 +20,7 @@ from oslo_log import log as logging
from oslo_utils import excutils
from nova import exception as nova_exc
from nova import image
from nova.image import glance
from pypowervm import const as pvm_const
from pypowervm import exceptions as pvm_exc
@ -40,7 +40,7 @@ from nova_powervm.virt.powervm import vm
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
IMAGE_API = image.API()
IMAGE_API = glance.API()
class LocalStorage(disk_dvr.DiskAdapter):

View File

@ -23,7 +23,7 @@ from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm import vm
from nova import image
from nova.image import glance
from oslo_utils import excutils
import pypowervm.const as pvm_const
from pypowervm.tasks import cluster_ssp as tsk_cs
@ -37,7 +37,7 @@ import pypowervm.wrappers.storage as pvm_stg
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
IMAGE_API = image.API()
IMAGE_API = glance.API()
class SSPDiskAdapter(disk_drv.DiskAdapter):

View File

@ -21,7 +21,7 @@ from nova.compute import vm_states
from nova.console import type as console_type
from nova import context as ctx
from nova import exception
from nova import image
from nova.image import glance
from nova import objects
from nova import utils as n_utils
from nova.virt import configdrive
@ -144,7 +144,7 @@ class PowerVMDriver(driver.ComputeDriver):
# Initialize the disk adapter. Sets self.disk_dvr
self._setup_disk_adapter()
self.image_api = image.API()
self.image_api = glance.API()
self._setup_rebuild_store()

View File

@ -1,4 +1,4 @@
# Copyright 2016, 2018 IBM Corp.
# Copyright 2016, 2020 IBM Corp.
#
# All Rights Reserved.
#
@ -19,8 +19,8 @@ import six
from nova import context as ctx
from nova import exception
from nova import network as net_api
from nova.network import model as network_model
from nova.network import neutron as net_api
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils

View File

@ -10,8 +10,7 @@ oslo.serialization!=2.19.1,>=2.21.1 # Apache-2.0
oslo.utils>=3.37.0 # Apache-2.0
os-resource-classes>=0.1.0 # Apache-2.0
pypowervm>=1.1.23 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD
python-swiftclient>=3.2.0 # Apache-2.0
taskflow>=2.16.0 # Apache-2.0
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL

View File

@ -12,10 +12,9 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[files]
packages =

View File

@ -1,13 +1,13 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0
# Do not add hacking, this comes from nova
# hacking>=1.1.0,<1.2.0 # Apache-2.0
bashate>=0.5.1 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
stestr>=1.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT

View File

@ -1,6 +1,6 @@
[tox]
minversion = 3.1.1
envlist = py36,py27,pep8
envlist = py36,pep8
skipsdist = True
# Automatic envs (pyXX) will use the python version appropriate to that
# env and ignore basepython inherited from [testenv]. That's what we
@ -29,12 +29,6 @@ whitelist_externals =
bash
commands =
[testenv:py27]
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
commands =
{[testenv]commands}