Merge "trivial: Use 'from foo import bar'"
This commit is contained in:
@@ -51,8 +51,9 @@ from nova.tests.unit import cast_as_call
|
|||||||
from nova.tests.unit import fake_block_device
|
from nova.tests.unit import fake_block_device
|
||||||
from nova.tests.unit import fake_notifier
|
from nova.tests.unit import fake_notifier
|
||||||
from nova.tests.unit import fake_requests
|
from nova.tests.unit import fake_requests
|
||||||
import nova.tests.unit.image.fake
|
from nova.tests.unit.image import fake as fake_image
|
||||||
from nova.tests.unit.objects import test_instance_info_cache
|
from nova.tests.unit.objects import test_instance_info_cache
|
||||||
|
from nova import utils as nova_utils
|
||||||
from nova.virt import fake
|
from nova.virt import fake
|
||||||
from nova import volume
|
from nova import volume
|
||||||
|
|
||||||
@@ -1371,8 +1372,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
|
|||||||
# Now update the image metadata to be something that won't work with
|
# Now update the image metadata to be something that won't work with
|
||||||
# the fake compute driver we're using since the fake driver has an
|
# the fake compute driver we're using since the fake driver has an
|
||||||
# "x86_64" architecture.
|
# "x86_64" architecture.
|
||||||
rebuild_image_ref = (
|
rebuild_image_ref = fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID
|
||||||
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
|
|
||||||
self.api.put_image_meta_key(
|
self.api.put_image_meta_key(
|
||||||
rebuild_image_ref, 'hw_architecture', 'unicore32')
|
rebuild_image_ref, 'hw_architecture', 'unicore32')
|
||||||
# Now rebuild the server with that updated image and it should result
|
# Now rebuild the server with that updated image and it should result
|
||||||
@@ -1485,8 +1485,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
|
|||||||
allocs = allocs[rp_uuid]['resources']
|
allocs = allocs[rp_uuid]['resources']
|
||||||
assertFlavorMatchesAllocation(flavor, allocs)
|
assertFlavorMatchesAllocation(flavor, allocs)
|
||||||
|
|
||||||
rebuild_image_ref = (
|
rebuild_image_ref = fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID
|
||||||
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
|
|
||||||
# Now rebuild the server with a different image.
|
# Now rebuild the server with a different image.
|
||||||
rebuild_req_body = {
|
rebuild_req_body = {
|
||||||
'rebuild': {
|
'rebuild': {
|
||||||
@@ -1539,8 +1538,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
|
|||||||
|
|
||||||
# Now rebuild the server with a different image than was used to create
|
# Now rebuild the server with a different image than was used to create
|
||||||
# our fake volume.
|
# our fake volume.
|
||||||
rebuild_image_ref = (
|
rebuild_image_ref = fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID
|
||||||
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
|
|
||||||
rebuild_req_body = {
|
rebuild_req_body = {
|
||||||
'rebuild': {
|
'rebuild': {
|
||||||
'imageRef': rebuild_image_ref
|
'imageRef': rebuild_image_ref
|
||||||
@@ -3699,13 +3697,11 @@ class ServerDeleteBuildTests(integrated_helpers.ProviderUsageBaseTestCase):
|
|||||||
networks='none')
|
networks='none')
|
||||||
|
|
||||||
with test.nested(
|
with test.nested(
|
||||||
mock.patch.object(nova.scheduler.filter_scheduler.
|
mock.patch('nova.scheduler.filter_scheduler.FilterScheduler.'
|
||||||
FilterScheduler,
|
'_ensure_sufficient_hosts'),
|
||||||
'_ensure_sufficient_hosts'),
|
mock.patch('nova.conductor.manager.ComputeTaskManager.'
|
||||||
mock.patch.object(nova.conductor.manager.
|
'_bury_in_cell0')
|
||||||
ComputeTaskManager,
|
) as (mock_suff_hosts, mock_bury):
|
||||||
'_bury_in_cell0')
|
|
||||||
) as (mock_suff_hosts, mock_bury):
|
|
||||||
mock_suff_hosts.side_effect = test.TestingException('oops')
|
mock_suff_hosts.side_effect = test.TestingException('oops')
|
||||||
server = self.api.post_server({'server': server_req})
|
server = self.api.post_server({'server': server_req})
|
||||||
self._wait_for_server_allocations(server['id'])
|
self._wait_for_server_allocations(server['id'])
|
||||||
@@ -4083,7 +4079,7 @@ class TraitsBasedSchedulingTest(integrated_helpers.ProviderUsageBaseTestCase):
|
|||||||
|
|
||||||
# Note that we're using v2.35 explicitly as the api returns 404
|
# Note that we're using v2.35 explicitly as the api returns 404
|
||||||
# starting with 2.36
|
# starting with 2.36
|
||||||
with nova.utils.temporary_mutation(self.api, microversion='2.35'):
|
with nova_utils.temporary_mutation(self.api, microversion='2.35'):
|
||||||
images = self.api.get_images()
|
images = self.api.get_images()
|
||||||
self.image_id_with_trait = images[0]['id']
|
self.image_id_with_trait = images[0]['id']
|
||||||
self.api.api_put('/images/%s/metadata' % self.image_id_with_trait,
|
self.api.api_put('/images/%s/metadata' % self.image_id_with_trait,
|
||||||
@@ -6525,7 +6521,7 @@ class ServerMoveWithPortResourceRequestTest(
|
|||||||
server = self._create_server_with_ports_and_check_allocation(
|
server = self._create_server_with_ports_and_check_allocation(
|
||||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||||
|
|
||||||
orig_get_service = nova.objects.Service.get_by_host_and_binary
|
orig_get_service = objects.Service.get_by_host_and_binary
|
||||||
|
|
||||||
def fake_get_service(context, host, binary):
|
def fake_get_service(context, host, binary):
|
||||||
# host2 is the only migration target, let's make it too old so the
|
# host2 is the only migration target, let's make it too old so the
|
||||||
@@ -6579,7 +6575,7 @@ class ServerMoveWithPortResourceRequestTest(
|
|||||||
server = self._create_server_with_ports_and_check_allocation(
|
server = self._create_server_with_ports_and_check_allocation(
|
||||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||||
|
|
||||||
orig_get_service = nova.objects.Service.get_by_host_and_binary
|
orig_get_service = objects.Service.get_by_host_and_binary
|
||||||
|
|
||||||
def fake_get_service(context, host, binary):
|
def fake_get_service(context, host, binary):
|
||||||
# host2 is the first migration target, let's make it too old so the
|
# host2 is the first migration target, let's make it too old so the
|
||||||
@@ -7280,8 +7276,7 @@ class ServerMoveWithPortResourceRequestTest(
|
|||||||
server = self._create_server_with_ports_and_check_allocation(
|
server = self._create_server_with_ports_and_check_allocation(
|
||||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||||
|
|
||||||
orig_check = nova.virt.fake.FakeDriver.\
|
orig_check = fake.FakeDriver.check_can_live_migrate_destination
|
||||||
check_can_live_migrate_destination
|
|
||||||
|
|
||||||
def fake_check_can_live_migrate_destination(
|
def fake_check_can_live_migrate_destination(
|
||||||
context, instance, src_compute_info, dst_compute_info,
|
context, instance, src_compute_info, dst_compute_info,
|
||||||
@@ -7558,7 +7553,7 @@ class PortResourceRequestReSchedulingTest(
|
|||||||
# First call is during boot, we want that to succeed normally. Then the
|
# First call is during boot, we want that to succeed normally. Then the
|
||||||
# fake virt driver triggers a re-schedule. During that re-schedule the
|
# fake virt driver triggers a re-schedule. During that re-schedule the
|
||||||
# fill is called again, and we simulate that call raises.
|
# fill is called again, and we simulate that call raises.
|
||||||
original_fill = nova.scheduler.utils.fill_provider_mapping
|
original_fill = utils.fill_provider_mapping
|
||||||
|
|
||||||
def stub_fill_provider_mapping(*args, **kwargs):
|
def stub_fill_provider_mapping(*args, **kwargs):
|
||||||
if not mock_fill.called:
|
if not mock_fill.called:
|
||||||
|
|||||||
Reference in New Issue
Block a user