Handle Python 3 transition and fix tests
While dropping Python 2.7 support, the upstream project has been updated, so we'll have to move the templates in-tree. While at it, we're updating the supported Python versions. Some Nova fixtures have been moved to oslo.test, so in order to be able to unblock the gate, we'll have to squash those fixes as well. For the same reason, we'll have to remove nova-network checks, which has been completely dropped. A few options have been moved to a separate config group, which we'll have to take into account. Change-Id: Ibce6b062a81200611bcaac3f2cb90b14b559375b
This commit is contained in:
parent
e8d536108c
commit
bd2aacc14f
|
@ -8,7 +8,9 @@
|
|||
|
||||
- project:
|
||||
templates:
|
||||
- check-requirements
|
||||
- openstack-lower-constraints-jobs
|
||||
- openstack-python3-ussuri-jobs
|
||||
check:
|
||||
jobs:
|
||||
- build-openstack-releasenotes
|
||||
|
|
|
@ -180,7 +180,7 @@ class ImageCache(imagecache.ImageCacheManager):
|
|||
# change the timestamp on the image so as to reflect the last
|
||||
# time it was used
|
||||
self._update_image_timestamp(img)
|
||||
elif CONF.remove_unused_base_images:
|
||||
elif CONF.image_cache.remove_unused_base_images:
|
||||
self._remove_if_old_image(img)
|
||||
|
||||
def _update_image_timestamp(self, image):
|
||||
|
@ -205,7 +205,8 @@ class ImageCache(imagecache.ImageCacheManager):
|
|||
|
||||
def _remove_if_old_image(self, image):
|
||||
backing_files = self._get_image_backing_files(image)
|
||||
max_age_seconds = CONF.remove_unused_original_minimum_age_seconds
|
||||
max_age_seconds = (
|
||||
CONF.image_cache.remove_unused_original_minimum_age_seconds)
|
||||
|
||||
for img in backing_files:
|
||||
age_seconds = self._pathutils.get_age_of_file(img)
|
||||
|
|
|
@ -18,7 +18,6 @@ import abc
|
|||
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
import nova.network
|
||||
from nova.network import model
|
||||
from nova.network import os_vif_util
|
||||
import os_vif
|
||||
|
@ -74,10 +73,7 @@ class HyperVVIFDriver(object):
|
|||
self._metricsutils = utilsfactory.get_metricsutils()
|
||||
self._netutils = utilsfactory.get_networkutils()
|
||||
self._vmutils = utilsfactory.get_vmutils()
|
||||
if nova.network.is_neutron():
|
||||
self._vif_plugin = HyperVNeutronVIFPlugin()
|
||||
else:
|
||||
self._vif_plugin = HyperVNovaNetworkVIFPlugin()
|
||||
self._vif_plugin = HyperVNeutronVIFPlugin()
|
||||
|
||||
def plug(self, instance, vif):
|
||||
vif_type = vif['type']
|
||||
|
|
|
@ -383,11 +383,10 @@ class VMOps(object):
|
|||
# already up will not undergo that transition, and for
|
||||
# anything that might be stale (cache-wise) assume it's
|
||||
# already up so we don't block on it.
|
||||
if utils.is_neutron() and CONF.vif_plugging_timeout:
|
||||
if CONF.vif_plugging_timeout:
|
||||
return [('network-vif-plugged', vif['id'])
|
||||
for vif in network_info if vif.get('active') is False]
|
||||
else:
|
||||
return []
|
||||
return []
|
||||
|
||||
def create_instance(self, context, instance, network_info,
|
||||
block_device_info, vm_gen, image_meta):
|
||||
|
|
|
@ -21,8 +21,6 @@ inline callbacks.
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import eventlet
|
||||
eventlet.monkey_patch(os=False)
|
||||
|
||||
|
@ -89,17 +87,15 @@ class NoDBTestCase(base.BaseTestCase):
|
|||
|
||||
def setUp(self):
|
||||
"""Run before each test method to initialize test environment."""
|
||||
super(NoDBTestCase, self).setUp()
|
||||
self.useFixture(mock_fixture.MockAutospecFixture())
|
||||
self.useFixture(nova_fixtures.Timeout(
|
||||
os.environ.get('OS_TEST_TIMEOUT', 0),
|
||||
self.TIMEOUT_SCALING_FACTOR))
|
||||
# Ensure BaseTestCase's ConfigureLogging fixture is disabled since
|
||||
# we're using the one from Nova (StandardLogging).
|
||||
with fixtures.EnvironmentVariable('OS_LOG_CAPTURE', '0'):
|
||||
super(NoDBTestCase, self).setUp()
|
||||
|
||||
self.useFixture(mock_fixture.MockAutospecFixture())
|
||||
|
||||
self.useFixture(fixtures.NestedTempfile())
|
||||
self.useFixture(fixtures.TempHomeDir())
|
||||
self.useFixture(log_fixture.get_logging_handle_error_fixture())
|
||||
|
||||
self.useFixture(nova_fixtures.OutputStreamCapture())
|
||||
self.useFixture(nova_fixtures.StandardLogging())
|
||||
self.useFixture(conf_fixture.ConfFixture(CONF))
|
||||
|
||||
|
|
|
@ -450,11 +450,6 @@ class HyperVDriverTestCase(test_base.HyperVBaseTestCase):
|
|||
self.driver._vmops.unplug_vifs.assert_called_once_with(
|
||||
mock.sentinel.instance, mock.sentinel.network_info)
|
||||
|
||||
def test_refresh_instance_security_rules(self):
|
||||
self.assertRaises(NotImplementedError,
|
||||
self.driver.refresh_instance_security_rules,
|
||||
instance=mock.sentinel.instance)
|
||||
|
||||
def test_migrate_disk_and_power_off(self):
|
||||
self.driver.migrate_disk_and_power_off(
|
||||
mock.sentinel.context, mock.sentinel.instance, mock.sentinel.dest,
|
||||
|
|
|
@ -188,7 +188,8 @@ class ImageCacheTestCase(test_base.HyperVBaseTestCase):
|
|||
|
||||
@ddt.data(True, False)
|
||||
def test_age_and_verify_cached_images(self, remove_unused_base_images):
|
||||
self.flags(remove_unused_base_images=remove_unused_base_images)
|
||||
self.flags(remove_unused_base_images=remove_unused_base_images,
|
||||
group='image_cache')
|
||||
|
||||
fake_images = [mock.sentinel.FAKE_IMG1, mock.sentinel.FAKE_IMG2]
|
||||
fake_used_images = [mock.sentinel.FAKE_IMG1]
|
||||
|
|
|
@ -54,21 +54,6 @@ class HyperVVIFDriverTestCase(test_base.HyperVBaseTestCase):
|
|||
self._vmutils = self.vif_driver._vmutils
|
||||
self._metricsutils = self.vif_driver._metricsutils
|
||||
|
||||
@mock.patch.object(vif.nova.network, 'is_neutron')
|
||||
def test_init_neutron(self, mock_is_neutron):
|
||||
mock_is_neutron.return_value = True
|
||||
|
||||
driver = vif.HyperVVIFDriver()
|
||||
self.assertIsInstance(driver._vif_plugin, vif.HyperVNeutronVIFPlugin)
|
||||
|
||||
@mock.patch.object(vif.nova.network, 'is_neutron')
|
||||
def test_init_nova(self, mock_is_neutron):
|
||||
mock_is_neutron.return_value = False
|
||||
|
||||
driver = vif.HyperVVIFDriver()
|
||||
self.assertIsInstance(driver._vif_plugin,
|
||||
vif.HyperVNovaNetworkVIFPlugin)
|
||||
|
||||
def test_plug(self):
|
||||
vif = {'type': model.VIF_TYPE_HYPERV}
|
||||
self.vif_driver.plug(mock.sentinel.instance, vif)
|
||||
|
|
|
@ -625,8 +625,7 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
|
|||
self._vmops._neutron_failed_callback,
|
||||
mock.sentinel.event_name, mock.sentinel.instance)
|
||||
|
||||
@mock.patch.object(vmops.utils, 'is_neutron')
|
||||
def test_get_neutron_events(self, mock_is_neutron):
|
||||
def test_get_neutron_events(self):
|
||||
network_info = [{'id': mock.sentinel.vif_id1, 'active': True},
|
||||
{'id': mock.sentinel.vif_id2, 'active': False},
|
||||
{'id': mock.sentinel.vif_id3}]
|
||||
|
@ -634,16 +633,13 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
|
|||
events = self._vmops._get_neutron_events(network_info)
|
||||
self.assertEqual([('network-vif-plugged', mock.sentinel.vif_id2)],
|
||||
events)
|
||||
mock_is_neutron.assert_called_once_with()
|
||||
|
||||
@mock.patch.object(vmops.utils, 'is_neutron')
|
||||
def test_get_neutron_events_no_timeout(self, mock_is_neutron):
|
||||
def test_get_neutron_events_no_timeout(self):
|
||||
self.flags(vif_plugging_timeout=0)
|
||||
network_info = [{'id': mock.sentinel.vif_id1, 'active': True}]
|
||||
|
||||
events = self._vmops._get_neutron_events(network_info)
|
||||
self.assertEqual([], events)
|
||||
mock_is_neutron.assert_called_once_with()
|
||||
|
||||
@mock.patch.object(vmops.VMOps, 'configure_instance_metrics')
|
||||
@mock.patch.object(vmops.VMOps, 'update_vm_resources')
|
||||
|
|
|
@ -18,6 +18,7 @@ classifier =
|
|||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
keywords = openstack nova hyper-v compute
|
||||
|
||||
[files]
|
||||
|
|
Loading…
Reference in New Issue