Merge "Implements proper UUID format for test_compute_cells and test_compute_utils."
This commit is contained in:
commit
a237fc84d3
@ -87,6 +87,7 @@ from nova.tests.unit.objects import test_flavor
|
|||||||
from nova.tests.unit.objects import test_instance_numa_topology
|
from nova.tests.unit.objects import test_instance_numa_topology
|
||||||
from nova.tests.unit.objects import test_migration
|
from nova.tests.unit.objects import test_migration
|
||||||
from nova.tests.unit import utils as test_utils
|
from nova.tests.unit import utils as test_utils
|
||||||
|
from nova.tests import uuidsentinel as uuids
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt import block_device as driver_block_device
|
from nova.virt import block_device as driver_block_device
|
||||||
from nova.virt import event
|
from nova.virt import event
|
||||||
@ -10956,7 +10957,8 @@ class ComputePolicyTestCase(BaseTestCase):
|
|||||||
"network:validate_networks": []}
|
"network:validate_networks": []}
|
||||||
self.policy.set_rules(rules)
|
self.policy.set_rules(rules)
|
||||||
|
|
||||||
self.compute_api.create(self.context, None, '1',
|
self.compute_api.create(self.context, None,
|
||||||
|
image_href=uuids.host_instance,
|
||||||
availability_zone='1:1')
|
availability_zone='1:1')
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ from nova import test
|
|||||||
from nova.tests.unit.compute import test_compute
|
from nova.tests.unit.compute import test_compute
|
||||||
from nova.tests.unit import fake_instance
|
from nova.tests.unit import fake_instance
|
||||||
from nova.tests.unit.objects import test_flavor
|
from nova.tests.unit.objects import test_flavor
|
||||||
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
|
|
||||||
ORIG_COMPUTE_API = None
|
ORIG_COMPUTE_API = None
|
||||||
@ -196,7 +197,8 @@ class CellsComputeAPITestCase(test_compute.ComputeAPITestCase):
|
|||||||
# it will raise ObjectActionError if the instance has already
|
# it will raise ObjectActionError if the instance has already
|
||||||
# been deleted by a instance_destroy_at_top, and instance.refresh()
|
# been deleted by a instance_destroy_at_top, and instance.refresh()
|
||||||
# will raise InstanceNotFound
|
# will raise InstanceNotFound
|
||||||
instance = objects.Instance(uuid='fake-uuid', cell_name=None)
|
instance = objects.Instance(uuid=uuids.destroy_instance,
|
||||||
|
cell_name=None)
|
||||||
actionerror = exception.ObjectActionError(action='destroy', reason='')
|
actionerror = exception.ObjectActionError(action='destroy', reason='')
|
||||||
notfound = exception.InstanceNotFound(instance_id=instance.uuid)
|
notfound = exception.InstanceNotFound(instance_id=instance.uuid)
|
||||||
|
|
||||||
@ -223,7 +225,7 @@ class CellsComputeAPITestCase(test_compute.ComputeAPITestCase):
|
|||||||
# lookup before instance.destroy() is reached, if the instance has
|
# lookup before instance.destroy() is reached, if the instance has
|
||||||
# already been deleted by a instance_destroy_at_top,
|
# already been deleted by a instance_destroy_at_top,
|
||||||
# InstanceNotFound will be raised
|
# InstanceNotFound will be raised
|
||||||
instance = objects.Instance(uuid='fake-uuid', cell_name=None)
|
instance = objects.Instance(uuid=uuids.delete_instance, cell_name=None)
|
||||||
notfound = exception.InstanceNotFound(instance_id=instance.uuid)
|
notfound = exception.InstanceNotFound(instance_id=instance.uuid)
|
||||||
|
|
||||||
@mock.patch.object(compute_api.API, 'delete')
|
@mock.patch.object(compute_api.API, 'delete')
|
||||||
|
@ -48,6 +48,7 @@ from nova.tests.unit import fake_server_actions
|
|||||||
import nova.tests.unit.image.fake
|
import nova.tests.unit.image.fake
|
||||||
from nova.tests.unit.objects import test_flavor
|
from nova.tests.unit.objects import test_flavor
|
||||||
from nova.tests.unit.objects import test_migration
|
from nova.tests.unit.objects import test_migration
|
||||||
|
from nova.tests import uuidsentinel as uuids
|
||||||
from nova.virt import driver
|
from nova.virt import driver
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -237,7 +238,8 @@ class DefaultDeviceNamesForInstanceTestCase(test.NoDBTestCase):
|
|||||||
self.ephemerals = block_device_obj.block_device_make_list(
|
self.ephemerals = block_device_obj.block_device_make_list(
|
||||||
self.context,
|
self.context,
|
||||||
[fake_block_device.FakeDbBlockDeviceDict(
|
[fake_block_device.FakeDbBlockDeviceDict(
|
||||||
{'id': 1, 'instance_uuid': 'fake-instance',
|
{'id': 1,
|
||||||
|
'instance_uuid': uuids.block_device_instance,
|
||||||
'device_name': '/dev/vdb',
|
'device_name': '/dev/vdb',
|
||||||
'source_type': 'blank',
|
'source_type': 'blank',
|
||||||
'destination_type': 'local',
|
'destination_type': 'local',
|
||||||
@ -248,7 +250,8 @@ class DefaultDeviceNamesForInstanceTestCase(test.NoDBTestCase):
|
|||||||
self.swap = block_device_obj.block_device_make_list(
|
self.swap = block_device_obj.block_device_make_list(
|
||||||
self.context,
|
self.context,
|
||||||
[fake_block_device.FakeDbBlockDeviceDict(
|
[fake_block_device.FakeDbBlockDeviceDict(
|
||||||
{'id': 2, 'instance_uuid': 'fake-instance',
|
{'id': 2,
|
||||||
|
'instance_uuid': uuids.block_device_instance,
|
||||||
'device_name': '/dev/vdc',
|
'device_name': '/dev/vdc',
|
||||||
'source_type': 'blank',
|
'source_type': 'blank',
|
||||||
'destination_type': 'local',
|
'destination_type': 'local',
|
||||||
@ -259,26 +262,30 @@ class DefaultDeviceNamesForInstanceTestCase(test.NoDBTestCase):
|
|||||||
self.block_device_mapping = block_device_obj.block_device_make_list(
|
self.block_device_mapping = block_device_obj.block_device_make_list(
|
||||||
self.context,
|
self.context,
|
||||||
[fake_block_device.FakeDbBlockDeviceDict(
|
[fake_block_device.FakeDbBlockDeviceDict(
|
||||||
{'id': 3, 'instance_uuid': 'fake-instance',
|
{'id': 3,
|
||||||
|
'instance_uuid': uuids.block_device_instance,
|
||||||
'device_name': '/dev/vda',
|
'device_name': '/dev/vda',
|
||||||
'source_type': 'volume',
|
'source_type': 'volume',
|
||||||
'destination_type': 'volume',
|
'destination_type': 'volume',
|
||||||
'volume_id': 'fake-volume-id-1',
|
'volume_id': 'fake-volume-id-1',
|
||||||
'boot_index': 0}),
|
'boot_index': 0}),
|
||||||
fake_block_device.FakeDbBlockDeviceDict(
|
fake_block_device.FakeDbBlockDeviceDict(
|
||||||
{'id': 4, 'instance_uuid': 'fake-instance',
|
{'id': 4,
|
||||||
|
'instance_uuid': uuids.block_device_instance,
|
||||||
'device_name': '/dev/vdd',
|
'device_name': '/dev/vdd',
|
||||||
'source_type': 'snapshot',
|
'source_type': 'snapshot',
|
||||||
'destination_type': 'volume',
|
'destination_type': 'volume',
|
||||||
'snapshot_id': 'fake-snapshot-id-1',
|
'snapshot_id': 'fake-snapshot-id-1',
|
||||||
'boot_index': -1}),
|
'boot_index': -1}),
|
||||||
fake_block_device.FakeDbBlockDeviceDict(
|
fake_block_device.FakeDbBlockDeviceDict(
|
||||||
{'id': 5, 'instance_uuid': 'fake-instance',
|
{'id': 5,
|
||||||
|
'instance_uuid': uuids.block_device_instance,
|
||||||
'device_name': '/dev/vde',
|
'device_name': '/dev/vde',
|
||||||
'source_type': 'blank',
|
'source_type': 'blank',
|
||||||
'destination_type': 'volume',
|
'destination_type': 'volume',
|
||||||
'boot_index': -1})])
|
'boot_index': -1})])
|
||||||
self.instance = {'uuid': 'fake_instance', 'ephemeral_gb': 2}
|
self.instance = {'uuid': uuids.instance,
|
||||||
|
'ephemeral_gb': 2}
|
||||||
self.is_libvirt = False
|
self.is_libvirt = False
|
||||||
self.root_device_name = '/dev/vda'
|
self.root_device_name = '/dev/vda'
|
||||||
self.update_called = False
|
self.update_called = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user