Browse Source

functional: Add and use 'GlanceFixture'

This rather beefy (but also quite simple) patch replaces the
'stub_out_image_service' call and associated cleanup in all functional
tests with a new 'GlanceFixture', based on the old 'FakeImageService'.
The use of a fixture means we don't have to worry about teardown and
allows us to stub Glance in the same manners as Cinder, Neutron,
Placement etc.

Unit test cleanup is handled in a later patch.

Change-Id: I6daea47988181dfa6dde3d9c42004c0ecf6ae87a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
changes/07/745907/9
Stephen Finucane 1 year ago
parent
commit
cc45581a18
  1. 315
      nova/tests/fixtures.py
  2. 3
      nova/tests/functional/api_sample_tests/test_aggregates.py
  3. 4
      nova/tests/functional/api_sample_tests/test_create_backup.py
  4. 13
      nova/tests/functional/api_sample_tests/test_images.py
  5. 5
      nova/tests/functional/api_sample_tests/test_multiple_create.py
  6. 4
      nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py
  7. 33
      nova/tests/functional/api_sample_tests/test_servers.py
  8. 8
      nova/tests/functional/compute/test_resource_tracker.py
  9. 13
      nova/tests/functional/integrated_helpers.py
  10. 9
      nova/tests/functional/libvirt/test_evacuate.py
  11. 2
      nova/tests/functional/libvirt/test_numa_servers.py
  12. 12
      nova/tests/functional/libvirt/test_shared_resource_provider.py
  13. 6
      nova/tests/functional/notification_sample_tests/notification_sample_base.py
  14. 8
      nova/tests/functional/regressions/test_bug_1522536.py
  15. 11
      nova/tests/functional/regressions/test_bug_1541691.py
  16. 15
      nova/tests/functional/regressions/test_bug_1548980.py
  17. 8
      nova/tests/functional/regressions/test_bug_1558866.py
  18. 7
      nova/tests/functional/regressions/test_bug_1595962.py
  19. 6
      nova/tests/functional/regressions/test_bug_1620248.py
  20. 6
      nova/tests/functional/regressions/test_bug_1670627.py
  21. 8
      nova/tests/functional/regressions/test_bug_1671648.py
  22. 5
      nova/tests/functional/regressions/test_bug_1675570.py
  23. 4
      nova/tests/functional/regressions/test_bug_1679750.py
  24. 4
      nova/tests/functional/regressions/test_bug_1682693.py
  25. 4
      nova/tests/functional/regressions/test_bug_1689692.py
  26. 4
      nova/tests/functional/regressions/test_bug_1702454.py
  27. 6
      nova/tests/functional/regressions/test_bug_1713783.py
  28. 5
      nova/tests/functional/regressions/test_bug_1718455.py
  29. 4
      nova/tests/functional/regressions/test_bug_1718512.py
  30. 4
      nova/tests/functional/regressions/test_bug_1719730.py
  31. 7
      nova/tests/functional/regressions/test_bug_1735407.py
  32. 5
      nova/tests/functional/regressions/test_bug_1741307.py
  33. 7
      nova/tests/functional/regressions/test_bug_1746483.py
  34. 4
      nova/tests/functional/regressions/test_bug_1764556.py
  35. 8
      nova/tests/functional/regressions/test_bug_1764883.py
  36. 13
      nova/tests/functional/regressions/test_bug_1780373.py
  37. 8
      nova/tests/functional/regressions/test_bug_1781286.py
  38. 9
      nova/tests/functional/regressions/test_bug_1781710.py
  39. 8
      nova/tests/functional/regressions/test_bug_1784353.py
  40. 9
      nova/tests/functional/regressions/test_bug_1797580.py
  41. 6
      nova/tests/functional/regressions/test_bug_1806515.py
  42. 5
      nova/tests/functional/regressions/test_bug_1815153.py
  43. 4
      nova/tests/functional/regressions/test_bug_1825020.py
  44. 5
      nova/tests/functional/regressions/test_bug_1825034.py
  45. 4
      nova/tests/functional/regressions/test_bug_1830747.py
  46. 7
      nova/tests/functional/regressions/test_bug_1835822.py
  47. 3
      nova/tests/functional/regressions/test_bug_1843708.py
  48. 5
      nova/tests/functional/regressions/test_bug_1849409.py
  49. 4
      nova/tests/functional/regressions/test_bug_1852458.py
  50. 4
      nova/tests/functional/regressions/test_bug_1862633.py
  51. 13
      nova/tests/functional/regressions/test_bug_1893284.py
  52. 33
      nova/tests/functional/test_aggregates.py
  53. 5
      nova/tests/functional/test_availability_zones.py
  54. 6
      nova/tests/functional/test_boot_from_volume.py
  55. 4
      nova/tests/functional/test_cross_az_attach.py
  56. 6
      nova/tests/functional/test_cross_cell_migrate.py
  57. 4
      nova/tests/functional/test_external_networks.py
  58. 4
      nova/tests/functional/test_instance_actions.py
  59. 10
      nova/tests/functional/test_list_servers_ip_filter.py
  60. 4
      nova/tests/functional/test_metadata.py
  61. 5
      nova/tests/functional/test_nova_manage.py
  62. 4
      nova/tests/functional/test_policy.py
  63. 4
      nova/tests/functional/test_scheduler.py
  64. 5
      nova/tests/functional/test_server_faults.py
  65. 16
      nova/tests/functional/test_server_group.py
  66. 12
      nova/tests/functional/test_servers.py
  67. 5
      nova/tests/functional/test_service.py
  68. 5
      nova/tests/functional/wsgi/test_secgroup.py
  69. 22
      nova/tests/functional/wsgi/test_servers.py
  70. 100
      nova/tests/unit/test_fixtures.py

315
nova/tests/fixtures.py

@ -15,9 +15,11 @@
# under the License.
"""Fixtures for Nova tests."""
import collections
from contextlib import contextmanager
import copy
import datetime
import logging as std_logging
import os
import random
@ -56,6 +58,7 @@ from nova.network import constants as neutron_constants
from nova.network import model as network_model
from nova import objects
from nova.objects import base as obj_base
from nova.objects import fields as obj_fields
from nova.objects import service as service_obj
import nova.privsep
from nova import quota as nova_quota
@ -2046,6 +2049,318 @@ class EventReporterStub(fixtures.Fixture):
lambda *args, **kwargs: mock.MagicMock()))
class GlanceFixture(fixtures.Fixture):
"""A fixture for simulating Glance."""
# NOTE(justinsb): The OpenStack API can't upload an image?
# So, make sure we've got one..
timestamp = datetime.datetime(2011, 1, 1, 1, 2, 3)
image1 = {
'id': '155d900f-4e14-4e4c-a73d-069cbf4541e6',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'raw',
'disk_format': 'raw',
'size': '25165824',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': ['tag1', 'tag2'],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
},
}
image2 = {
'id': 'a2459075-d96c-40d5-893e-577ff92e721c',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '58145823',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
},
}
image3 = {
'id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'bare',
'disk_format': 'raw',
'size': '83594576',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': ['tag3', 'tag4'],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
},
}
image4 = {
'id': 'cedef40a-ed67-4d10-800e-17455edce175',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '84035174',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
},
}
image5 = {
'id': 'c905cedb-7281-47e4-8a62-f26bc5fc4c77',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '26360814',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': '155d900f-4e14-4e4c-a73d-069cbf4541e6',
'ramdisk_id': None,
},
}
auto_disk_config_disabled_image = {
'id': 'a440c04b-79fa-479c-bed1-0b816eaec379',
'name': 'fakeimage6',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'ova',
'disk_format': 'vhd',
'size': '49163826',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
'auto_disk_config': 'False',
},
}
auto_disk_config_enabled_image = {
'id': '70a599e0-31e7-49b7-b260-868f441e862b',
'name': 'fakeimage7',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'ova',
'disk_format': 'vhd',
'size': '74185822',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
'auto_disk_config': 'True',
},
}
def __init__(self, test):
super().__init__()
self.test = test
self.images = {}
def setUp(self):
super().setUp()
self.test.useFixture(
ConfPatcher(group='glance', api_servers=['http://localhost:9292'])
)
self.test.stub_out(
'nova.image.glance.API.get_remote_image_service',
lambda context, image_href: (self, image_href))
self.test.stub_out(
'nova.image.glance.get_default_image_service',
lambda: self)
self.create(None, self.image1)
self.create(None, self.image2)
self.create(None, self.image3)
self.create(None, self.image4)
self.create(None, self.image5)
self.create(None, self.auto_disk_config_disabled_image)
self.create(None, self.auto_disk_config_enabled_image)
self._imagedata = {}
# TODO(bcwaldon): implement optional kwargs such as limit, sort_dir
def detail(self, context, **kwargs):
"""Return list of detailed image information."""
return copy.deepcopy(list(self.images.values()))
def download(
self, context, image_id, data=None, dst_path=None, trusted_certs=None,
):
self.show(context, image_id)
if data:
data.write(self._imagedata.get(image_id, b''))
elif dst_path:
with open(dst_path, 'wb') as data:
data.write(self._imagedata.get(image_id, b''))
def show(
self, context, image_id, include_locations=False, show_deleted=True,
):
"""Get data about specified image.
Returns a dict containing image data for the given opaque image id.
"""
image = self.images.get(str(image_id))
if image:
return copy.deepcopy(image)
LOG.warning(
'Unable to find image id %s. Have images: %s',
image_id, self.images)
raise exception.ImageNotFound(image_id=image_id)
def create(self, context, metadata, data=None):
"""Store the image data and return the new image id.
:raises: Duplicate if the image already exist.
"""
image_id = str(metadata.get('id', uuidutils.generate_uuid()))
metadata['id'] = image_id
if image_id in self.images:
raise exception.CouldNotUploadImage(image_id=image_id)
image_meta = copy.deepcopy(metadata)
# Glance sets the size value when an image is created, so we
# need to do that here to fake things out if it's not provided
# by the caller. This is needed to avoid a KeyError in the
# image-size API.
if 'size' not in image_meta:
image_meta['size'] = None
# Similarly, Glance provides the status on the image once it's created
# and this is checked in the compute API when booting a server from
# this image, so we just fake it out to be 'active' even though this
# is mostly a lie on a newly created image.
if 'status' not in metadata:
image_meta['status'] = 'active'
# The owner of the image is by default the request context project_id.
if context and 'owner' not in image_meta.get('properties', {}):
# Note that normally "owner" is a top-level field in an image
# resource in glance but we have to fake this out for the images
# proxy API by throwing it into the generic "properties" dict.
image_meta.get('properties', {})['owner'] = context.project_id
self.images[image_id] = image_meta
if data:
self._imagedata[image_id] = data.read()
return self.images[image_id]
def update(self, context, image_id, metadata, data=None,
purge_props=False):
"""Replace the contents of the given image with the new data.
:raises: ImageNotFound if the image does not exist.
"""
if not self.images.get(image_id):
raise exception.ImageNotFound(image_id=image_id)
if purge_props:
self.images[image_id] = copy.deepcopy(metadata)
else:
image = self.images[image_id]
try:
image['properties'].update(metadata.pop('properties'))
except KeyError:
pass
image.update(metadata)
return self.images[image_id]
def delete(self, context, image_id):
"""Delete the given image.
:raises: ImageNotFound if the image does not exist.
"""
removed = self.images.pop(image_id, None)
if not removed:
raise exception.ImageNotFound(image_id=image_id)
def get_location(self, context, image_id):
if image_id in self.images:
return 'fake_location'
return None
class CinderFixture(fixtures.Fixture):
"""A fixture to volume operations with the new Cinder attach/detach API"""

3
nova/tests/functional/api_sample_tests/test_aggregates.py

@ -16,7 +16,6 @@
from oslo_serialization import jsonutils
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake as fake_image
class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
@ -132,7 +131,7 @@ class AggregatesV2_81_SampleJsonTest(AggregatesV2_41_SampleJsonTest):
def test_images(self):
agg_id = self._test_aggregate_create()
image = fake_image.get_valid_image_id()
image = self.glance.auto_disk_config_enabled_image['id']
response = self._do_post('os-aggregates/%s/images' % agg_id,
'aggregate-images-post-req',
{'image_id': image})

4
nova/tests/functional/api_sample_tests/test_create_backup.py

@ -15,8 +15,8 @@
import mock
from nova.tests import fixtures
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake
class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
@ -30,7 +30,7 @@ class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
super(CreateBackupSamplesJsonTest, self).setUp()
self.uuid = self._post_server()
@mock.patch.object(fake._FakeImageService, 'detail', return_value=[])
@mock.patch.object(fixtures.GlanceFixture, 'detail', return_value=[])
def test_post_backup_server(self, mock_method):
# Get api samples to backup server request.
response = self._do_post('servers/%s/action' % self.uuid,

13
nova/tests/functional/api_sample_tests/test_images.py

@ -14,7 +14,6 @@
# under the License.
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake
class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
@ -27,7 +26,7 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
def test_image_get(self):
# Get api sample of one single image details request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_get('images/%s' % image_id)
subs = {'image_id': image_id}
self._verify_response('image-get-resp', subs, response, 200)
@ -39,14 +38,14 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
def test_image_metadata_get(self):
# Get api sample of an image metadata request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_get('images/%s/metadata' % image_id)
subs = {'image_id': image_id}
self._verify_response('image-metadata-get-resp', subs, response, 200)
def test_image_metadata_post(self):
# Get api sample to update metadata of an image metadata request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_post(
'images/%s/metadata' % image_id,
'image-metadata-post-req', {})
@ -54,21 +53,21 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
def test_image_metadata_put(self):
# Get api sample of image metadata put request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_put('images/%s/metadata' %
(image_id), 'image-metadata-put-req', {})
self._verify_response('image-metadata-put-resp', {}, response, 200)
def test_image_meta_key_get(self):
# Get api sample of an image metadata key request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
key = "kernel_id"
response = self._do_get('images/%s/metadata/%s' % (image_id, key))
self._verify_response('image-meta-key-get', {}, response, 200)
def test_image_meta_key_put(self):
# Get api sample of image metadata key put request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
key = "auto_disk_config"
response = self._do_put('images/%s/metadata/%s' % (image_id, key),
'image-meta-key-put-req', {})

5
nova/tests/functional/api_sample_tests/test_multiple_create.py

@ -14,7 +14,6 @@
# under the License.
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake
class MultipleCreateJsonTest(test_servers.ServersSampleBase):
@ -22,7 +21,7 @@ class MultipleCreateJsonTest(test_servers.ServersSampleBase):
def test_multiple_create(self):
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'compute_endpoint': self._get_compute_endpoint(),
'min_count': "2",
'max_count': "3"
@ -32,7 +31,7 @@ class MultipleCreateJsonTest(test_servers.ServersSampleBase):
def test_multiple_create_without_reservation_id(self):
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'compute_endpoint': self._get_compute_endpoint(),
'min_count': "2",
'max_count': "3"

4
nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py

@ -14,7 +14,6 @@
from nova.compute import api as compute_api
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake
class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):
@ -22,9 +21,8 @@ class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):
def _test_server_rebuild_preserve_ephemeral(self, value, resp_tpl=None):
uuid = self._post_server()
image = fake.get_valid_image_id()
subs = {'host': self._get_host(),
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',

33
nova/tests/functional/api_sample_tests/test_servers.py

@ -25,7 +25,6 @@ import nova.conf
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.api.openstack import fakes
from nova.tests.unit.image import fake
CONF = nova.conf.CONF
@ -61,7 +60,7 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
# common server sample files from 'servers' directory.
# Set False if tests need to use extension specific sample files
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'host': self._get_host(),
'compute_endpoint': self._get_compute_endpoint(),
'versioned_compute_endpoint': self._get_vers_compute_endpoint(),
@ -192,7 +191,7 @@ class ServersSampleJson219Test(ServersSampleJsonTest):
uuid = self.test_servers_post()
response = self._do_put('servers/%s' % uuid, 'server-put-req', {})
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'hostid': '[a-f0-9]+',
'glance_host': self._get_glance_host(),
'access_ip_v4': '1.2.3.4',
@ -235,9 +234,8 @@ class ServersSampleJson247Test(ServersSampleJsonTest):
def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@ -284,10 +282,8 @@ class ServersSampleJson263Test(ServersSampleBase):
def test_server_rebuild(self):
uuid = self._post_server(use_common_server_api_samples=False)
fakes.stub_out_key_pair_funcs(self)
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',
@ -484,9 +480,8 @@ class ServersSampleJson271Test(ServersSampleBase):
def test_servers_rebuild_with_server_groups(self):
uuid = self._test_servers_post()
fakes.stub_out_key_pair_funcs(self)
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',
@ -558,9 +553,8 @@ class ServersSampleJson273Test(ServersSampleBase):
def test_server_rebuild_with_empty_locked_reason(self):
uuid = self._post_server(use_common_server_api_samples=False)
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@ -647,9 +641,8 @@ class ServersSampleJson275Test(ServersUpdateSampleJsonTest):
def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@ -711,9 +704,8 @@ class ServersActionsJsonTest(ServersSampleBase, _ServersActionsJsonTestMixin):
def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@ -828,9 +820,8 @@ class ServersActionsJson219Test(ServersSampleBase):
def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'description': 'description of foobar',
'pass': 'seekr3t',
@ -855,9 +846,8 @@ class ServersActionsJson226Test(ServersSampleBase):
def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'access_ip_v4': '1.2.3.4',
'access_ip_v6': '80fe::',
'disk_config': 'AUTO',
@ -895,9 +885,8 @@ class ServersActionsJson254Test(ServersSampleBase):
def test_server_rebuild(self):
fakes.stub_out_key_pair_funcs(self)
uuid = self._create_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',

8
nova/tests/functional/compute/test_resource_tracker.py

@ -33,7 +33,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
from nova.tests.unit.image import fake as fake_image
from nova.virt import driver as virt_driver
@ -697,10 +696,9 @@ class TestProviderConfig(integrated_helpers.ProviderUsageBaseTestCase):
compute service that provides that trait.
"""
self.neutron = nova_fixtures.NeutronFixture(self)
self.useFixture(self.neutron)
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
# Start nova services.
self.api = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1')).admin_api

13
nova/tests/functional/integrated_helpers.py

@ -42,7 +42,6 @@ from nova.tests.functional.api import client as api_client
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
from nova import utils
@ -1050,15 +1049,12 @@ class _IntegratedTestBase(test.TestCase, PlacementInstanceHelperMixin):
def setUp(self):
super(_IntegratedTestBase, self).setUp()
self.fake_image_service =\
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(cast_as_call.CastAsCall(self))
self.placement = self.useFixture(func_fixtures.PlacementFixture()).api
self.neutron = self.useFixture(nova_fixtures.NeutronFixture(self))
self.cinder = self.useFixture(nova_fixtures.CinderFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.policy = self.useFixture(policy_fixture.RealPolicyFixture())
fake_notifier.stub_notifier(self)
@ -1128,6 +1124,7 @@ class ProviderUsageBaseTestCase(test.TestCase, PlacementInstanceHelperMixin):
self.policy = self.useFixture(policy_fixture.RealPolicyFixture())
self.neutron = self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.placement = self.useFixture(func_fixtures.PlacementFixture()).api
self.useFixture(nova_fixtures.AllServicesCurrent())
@ -1141,11 +1138,5 @@ class ProviderUsageBaseTestCase(test.TestCase, PlacementInstanceHelperMixin):
self.admin_api.microversion = self.microversion
self.api = self.admin_api
# the image fake backend needed for image discovery
self.image_service = (
nova.tests.unit.image.fake.stub_out_image_service(self))
self.start_service('conductor')
self.scheduler_service = self.start_service('scheduler')
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

9
nova/tests/functional/libvirt/test_evacuate.py

@ -31,7 +31,6 @@ from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake as fake_image
from nova.tests.unit.virt.libvirt import fakelibvirt
from nova.virt.libvirt import config as libvirt_config
@ -50,10 +49,8 @@ FLAVOR_FIXTURES = [
'root_gb': 1, 'ephemeral_gb': 0, 'swap': 1},
]
# Choice of image id is arbitrary, but fixed for consistency.
IMAGE_ID = fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID
IMAGE_ID = nova_fixtures.GlanceFixture.auto_disk_config_enabled_image['id']
# NOTE(mdbooth): Change I76448196 tests for creation of any local disk, and
# short-circuits as soon as it sees one created. Disks are created in order:
@ -423,6 +420,7 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):
self.useFixture(nova_fixtures.CinderFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
fake_network.set_stub_network_methods(self)
@ -433,9 +431,6 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):
# force_down and evacuate without onSharedStorage
self.api.microversion = '2.14'
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)

2
nova/tests/functional/libvirt/test_numa_servers.py

@ -1251,7 +1251,7 @@ class NUMAServersRebuildTests(NUMAServersTestBase):
# 2 virtual numa nodes.
ctx = nova_context.get_admin_context()
image_meta = {'properties': {'hw_numa_nodes': 2}}
self.fake_image_service.update(ctx, self.image_ref_1, image_meta)
self.glance.update(ctx, self.image_ref_1, image_meta)
# NOTE(sean-k-mooney): this should fail because rebuild uses noop
# claims therefore it is not allowed for the NUMA topology or resource

12
nova/tests/functional/libvirt/test_shared_resource_provider.py

@ -19,7 +19,7 @@ import unittest
from nova.compute import instance_actions
from nova import conf
from nova.tests.functional.libvirt import integrated_helpers
import nova.tests.unit.image.fake
from nova import utils
CONF = conf.CONF
@ -126,10 +126,9 @@ class SharedStorageProviderUsageTestCase(
networks='none'
)
rebuild_image_ref = (
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
rebuild_image_ref = self.glance.auto_disk_config_enabled_image['id']
with nova.utils.temporary_mutation(self.api, microversion='2.35'):
with utils.temporary_mutation(self.api, microversion='2.35'):
self.api.api_put('/images/%s/metadata' % rebuild_image_ref,
{'metadata': {
'trait:STORAGE_DISK_SSD': 'required'}})
@ -185,10 +184,9 @@ class SharedStorageProviderUsageTestCase(
networks='none',
)
rebuild_image_ref = (
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
rebuild_image_ref = self.glance.auto_disk_config_enabled_image['id']
with nova.utils.temporary_mutation(self.api, microversion='2.35'):
with utils.temporary_mutation(self.api, microversion='2.35'):
self.api.api_put('/images/%s/metadata' % rebuild_image_ref,
{'metadata': {
'trait:CUSTOM_FOO': 'required'}})

6
nova/tests/functional/notification_sample_tests/notification_sample_base.py

@ -28,7 +28,6 @@ from nova.tests import json_ref
from nova.tests.unit.api.openstack.compute import test_services
from nova.tests.unit import fake_crypto
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
CONF = cfg.CONF
@ -80,10 +79,7 @@ class NotificationSampleTestBase(test.TestCase,
self.addCleanup(fake_notifier.reset)
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
context_patcher = self.mock_gen_request_id = mock.patch(

8
nova/tests/functional/regressions/test_bug_1522536.py

@ -12,13 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -29,20 +26,17 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.start_service('conductor')
self.start_service('scheduler')
self.compute = self.start_service('compute')
self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

11
nova/tests/functional/regressions/test_bug_1541691.py

@ -12,12 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -28,14 +25,12 @@ class TestServerValidation(test.TestCase):
def setUp(self):
super(TestServerValidation, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.api = api_fixture.api
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

15
nova/tests/functional/regressions/test_bug_1548980.py

@ -14,13 +14,10 @@
import time
import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -31,27 +28,23 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(cast_as_call.CastAsCall(self))
# The non-admin API client is fine to stay at 2.1 since it just creates
# and deletes the server.
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
# The admin API client needs to be at microversion 2.16 to exhibit the
# regression.
self.admin_api.microversion = '2.16'
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.start_service('conductor')
self.start_service('scheduler')
self.compute = self.start_service('compute')
self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

8
nova/tests/functional/regressions/test_bug_1558866.py

@ -17,7 +17,6 @@ import datetime
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client as api_client
from nova.tests.unit.image import fake as fake_image
from nova.tests.unit import policy_fixture
@ -27,15 +26,12 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
# the image fake backend needed for image discovery
image_service = fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
# NOTE(mriedem): This image has an invalid architecture metadata value
# and is used for negative testing in the functional stack.
timestamp = datetime.datetime(2011, 1, 1, 1, 2, 3)
@ -53,7 +49,7 @@ class TestServerGet(test.TestCase):
'properties': {'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': 'x64'}}
self.image_id = image_service.create(None, image)['id']
self.image_id = self.glance.create(None, image)['id']
self.flavor_id = self.api.get_flavors()[0]['id']
def test_boot_server_with_invalid_image_meta(self):

7
nova/tests/functional/regressions/test_bug_1595962.py

@ -18,7 +18,6 @@ import fixtures
import io
import mock
import nova
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
@ -35,6 +34,7 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
super(TestSerialConsoleLiveMigrate, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
@ -53,10 +53,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
self.admin_api = api_fixture.admin_api
self.api = api_fixture.api
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
nova.tests.unit.fake_network.set_stub_network_methods(self)
self.flags(compute_driver='libvirt.LibvirtDriver')
self.flags(enabled=True, group="serial_console")
self.flags(enabled=False, group="vnc")
@ -68,7 +64,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
self.compute = self.start_service('compute', host='test_compute1')
self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

6
nova/tests/functional/regressions/test_bug_1620248.py

@ -13,7 +13,6 @@
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -24,6 +23,7 @@ class TestServerUpdate(test.TestCase):
super(TestServerUpdate, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
# Simulate requests coming in before the instance is scheduled by
# using a no-op for conductor build_instances
self.useFixture(nova_fixtures.NoopConductorFixture())
@ -32,11 +32,7 @@ class TestServerUpdate(test.TestCase):
self.api = api_fixture.api
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

6
nova/tests/functional/regressions/test_bug_1670627.py

@ -18,7 +18,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -50,13 +49,12 @@ class TestDeleteFromCell0CheckQuota(test.TestCase):
super(TestDeleteFromCell0CheckQuota, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.start_service('conductor')
self.start_service('scheduler')

8
nova/tests/functional/regressions/test_bug_1671648.py

@ -14,14 +14,13 @@
import time
import nova.compute.resource_tracker
from nova.compute import resource_tracker
from nova import exception
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
from nova.tests.unit import fake_network
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -59,7 +58,7 @@ class TestRetryBetweenComputeNodeBuilds(test.TestCase):
self.admin_api = api_fixture.admin_api
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.useFixture(nova_fixtures.GlanceFixture(self))
self.start_service('conductor')
@ -86,8 +85,7 @@ class TestRetryBetweenComputeNodeBuilds(test.TestCase):
# https://opendev.org/openstack/nova/src/commit/
# bb02d1110a9529217a5e9b1e1fe8ca25873cac59/
# nova/compute/resource_tracker.py#L121-L130
real_instance_claim =\
nova.compute.resource_tracker.ResourceTracker.instance_claim
real_instance_claim = resource_tracker.ResourceTracker.instance_claim
def fake_instance_claim(_self, *args, **kwargs):
self.attempts += 1

5
nova/tests/functional/regressions/test_bug_1675570.py

@ -21,7 +21,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
LOG = logging.getLogger(__name__)
@ -60,7 +59,7 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
self.api.microversion = 'latest'
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.useFixture(nova_fixtures.GlanceFixture(self))
self.start_service('conductor')
self.start_service('scheduler')
@ -128,7 +127,7 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
LOG.info('Creating server and waiting for it to be ACTIVE.')
server = dict(
name='local-delete-volume-attach-test',
# The image ID comes from nova.tests.unit.image.fake.
# The image ID comes from GlanceFixture
imageRef='76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
flavorRef=self.flavor_id,
# Bypass network setup on the compute.

4
nova/tests/functional/regressions/test_bug_1679750.py

@ -19,7 +19,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -30,14 +29,13 @@ class TestLocalDeleteAllocations(test.TestCase,
self.useFixture(policy_fixture.RealPolicyFixture())
# The NeutronFixture is needed to show security groups for a server.
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
# We need the latest microversion to force-down the compute service
self.admin_api.microversion = 'latest'
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.start_service('conductor')

4
nova/tests/functional/regressions/test_bug_1682693.py

@ -16,7 +16,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture
@ -41,8 +40,7 @@ class ServerTagsFilteringTest(test.TestCase,
self.api = api_fixture.api
# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))
# Use the latest microversion available to make sure something does
# not regress in new microversions; cap as necessary.

4
nova/tests/functional/regressions/test_bug_1689692.py

@ -16,7 +16,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import cast_as_call
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture
@ -42,8 +41,7 @@ class ServerListLimitMarkerCell0Test(test.TestCase,
self.api = api_fixture.api
# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))
# Use the latest microversion available to make sure something does
# not regress in new microversions; cap as necessary.

4
nova/tests/functional/regressions/test_bug_1702454.py

@ -15,7 +15,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import cast_as_call
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture
@ -59,8 +58,7 @@ class SchedulerOnlyChecksTargetTest(test.TestCase,
self.api = api_fixture.api
# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))
self.start_service('conductor')

6
nova/tests/functional/regressions/test_bug_1713783.py

@ -22,7 +22,6 @@ from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
@ -47,6 +46,7 @@ class FailedEvacuateStateTests(test.TestCase,
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@ -55,13 +55,9 @@ class FailedEvacuateStateTests(test.TestCase,
self.api = api_fixture.admin_api
self.api.microversion = self.microversion
nova.tests.unit.image.fake.stub_out_image_service(self)
self.start_service('conductor')
self.start_service('scheduler')
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.hostname = 'host1'
self.compute1 = self.start_service('compute', host=self.hostname)
fake_network.set_stub_network_methods(self)