Created
January 29, 2015 19:29
-
-
Save mgagne/17fd2b0b462c8c91fa7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 0bd7f478a5d9cee815d07c93ca6e77715a6b6a62 | |
Author: Mathieu Gagné <[email protected]> | |
Date: Thu Jan 29 11:36:55 2015 -0500 | |
Don't create block device mappings in the API cell | |
The child cell will create it and propagate it up to the parent cell. | |
Change-Id: Icc6270d4fc41a6bbac3a29843e5f949d9d894b29 | |
diff --git a/nova/compute/cells_api.py b/nova/compute/cells_api.py | |
index 812e52e..58569b2 100644 | |
--- a/nova/compute/cells_api.py | |
+++ b/nova/compute/cells_api.py | |
@@ -210,6 +210,13 @@ class ComputeCellsAPI(compute_api.API): | |
""" | |
return super(ComputeCellsAPI, self).create(*args, **kwargs) | |
+ def _update_block_device_mapping(self, *args, **kwargs): | |
+ """Don't create block device mappings in the API cell. | |
+ | |
+ The child cell will create it and propagate it up to the parent cell. | |
+ """ | |
+ pass | |
+ | |
def update(self, context, instance, **kwargs): | |
"""Update an instance.""" | |
cell_name = instance['cell_name'] | |
diff --git a/nova/tests/compute/test_compute_cells.py b/nova/tests/compute/test_compute_cells.py | |
index 55f500f..c2663fc 100644 | |
--- a/nova/tests/compute/test_compute_cells.py | |
+++ b/nova/tests/compute/test_compute_cells.py | |
@@ -20,6 +20,7 @@ import functools | |
import mock | |
from oslo.config import cfg | |
+from nova import block_device | |
from nova.cells import manager | |
from nova.compute import api as compute_api | |
from nova.compute import cells_api as compute_cells_api | |
@@ -185,6 +186,19 @@ class CellsComputeAPITestCase(test_compute.ComputeAPITestCase): | |
self.assertEqual(migrations, response) | |
+ def test_update_block_device_mapping(self): | |
+ instance_type = {'swap': 1, 'ephemeral_gb': 1} | |
+ instance = self._create_fake_instance_obj() | |
+ bdms = [block_device.BlockDeviceDict({'source_type': 'image', | |
+ 'destination_type': 'local', | |
+ 'image_id': 'fake-image', | |
+ 'boot_index': 0})] | |
+ self.compute_api._update_block_device_mapping( | |
+ instance_type, instance.uuid, bdms) | |
+ bdms = db.block_device_mapping_get_all_by_instance( | |
+ self.context, instance['uuid']) | |
+ self.assertEqual(0, len(bdms)) | |
+ | |
@mock.patch('nova.cells.messaging._TargetedMessage') | |
def test_rebuild_sig(self, mock_msg): | |
# TODO(belliott) Cells could benefit from better testing to ensure API |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment