summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-04 22:39:11 +0000
committerGerrit Code Review <review@openstack.org>2013-01-04 22:39:11 +0000
commit69b8ec2e9cf48ee836f968ea0817e1d2955b3e63 (patch)
tree7cdcae49bd770d831e33a6f75024854feff0ae48 /nova/tests
parent8fe279661b0c554b19fbfd145fe266ec58cad4fa (diff)
parent10daa81057b2cfc0a3e21624b50b0b5d610b4db2 (diff)
Merge "Move block_device_mapping destroy operations to conductor"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/conductor/test_conductor.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index 4aa552cc7..23930770a 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -305,6 +305,34 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
self.conductor.block_device_mapping_update_or_create(self.context,
fake_bdm)
+ def test_block_device_mapping_destroy(self):
+ fake_bdm = {'id': 'fake-bdm'}
+ fake_bdm2 = {'id': 'fake-bdm-2'}
+ fake_inst = {'uuid': 'fake-uuid'}
+ self.mox.StubOutWithMock(db, 'block_device_mapping_destroy')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_device')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_volume')
+ db.block_device_mapping_destroy(self.context, 'fake-bdm')
+ db.block_device_mapping_destroy(self.context, 'fake-bdm-2')
+ db.block_device_mapping_destroy_by_instance_and_device(self.context,
+ 'fake-uuid',
+ 'fake-device')
+ db.block_device_mapping_destroy_by_instance_and_volume(self.context,
+ 'fake-uuid',
+ 'fake-volume')
+ self.mox.ReplayAll()
+ self.conductor.block_device_mapping_destroy(self.context,
+ [fake_bdm,
+ fake_bdm2])
+ self.conductor.block_device_mapping_destroy(self.context,
+ instance=fake_inst,
+ device_name='fake-device')
+ self.conductor.block_device_mapping_destroy(self.context,
+ instance=fake_inst,
+ volume_id='fake-volume')
+
class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
"""Conductor RPC API Tests"""
@@ -332,6 +360,31 @@ class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
self.conductor.block_device_mapping_update_or_create(self.context,
fake_bdm)
+ def test_block_device_mapping_destroy(self):
+ fake_bdm = {'id': 'fake-bdm'}
+ fake_inst = {'uuid': 'fake-uuid'}
+ self.mox.StubOutWithMock(db, 'block_device_mapping_destroy')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_device')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_volume')
+ db.block_device_mapping_destroy(self.context, 'fake-bdm')
+ db.block_device_mapping_destroy_by_instance_and_device(self.context,
+ 'fake-uuid',
+ 'fake-device')
+ db.block_device_mapping_destroy_by_instance_and_volume(self.context,
+ 'fake-uuid',
+ 'fake-volume')
+ self.mox.ReplayAll()
+ self.conductor.block_device_mapping_destroy(self.context,
+ bdms=[fake_bdm])
+ self.conductor.block_device_mapping_destroy(self.context,
+ instance=fake_inst,
+ device_name='fake-device')
+ self.conductor.block_device_mapping_destroy(self.context,
+ instance=fake_inst,
+ volume_id='fake-volume')
+
class ConductorAPITestCase(_BaseTestCase, test.TestCase):
"""Conductor API Tests"""
@@ -375,6 +428,28 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
self.conductor.block_device_mapping_update_or_create(self.context,
'fake-bdm')
+ def test_block_device_mapping_destroy(self):
+ fake_bdm = {'id': 'fake-bdm'}
+ fake_inst = {'uuid': 'fake-uuid'}
+ self.mox.StubOutWithMock(db, 'block_device_mapping_destroy')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_device')
+ self.mox.StubOutWithMock(
+ db, 'block_device_mapping_destroy_by_instance_and_volume')
+ db.block_device_mapping_destroy(self.context, 'fake-bdm')
+ db.block_device_mapping_destroy_by_instance_and_device(self.context,
+ 'fake-uuid',
+ 'fake-device')
+ db.block_device_mapping_destroy_by_instance_and_volume(self.context,
+ 'fake-uuid',
+ 'fake-volume')
+ self.mox.ReplayAll()
+ self.conductor.block_device_mapping_destroy(self.context, [fake_bdm])
+ self.conductor.block_device_mapping_destroy_by_instance_and_device(
+ self.context, fake_inst, 'fake-device')
+ self.conductor.block_device_mapping_destroy_by_instance_and_volume(
+ self.context, fake_inst, 'fake-volume')
+
class ConductorLocalAPITestCase(ConductorAPITestCase):
"""Conductor LocalAPI Tests"""