diff options
| author | Thierry Carrez <thierry@openstack.org> | 2011-06-17 20:47:23 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-06-17 20:47:23 +0000 |
| commit | a854d4e17214269b729777967e028600fdf4ee50 (patch) | |
| tree | 83c1a750b1f271b068a5fa1aa970c9929a078970 | |
| parent | 2e6c26fcc8967192e35e0d2b2473bae578eb5b04 (diff) | |
| parent | a0ab4e7f141ccf14caca23f15eed5408079a58d0 (diff) | |
| download | nova-a854d4e17214269b729777967e028600fdf4ee50.tar.gz nova-a854d4e17214269b729777967e028600fdf4ee50.tar.xz nova-a854d4e17214269b729777967e028600fdf4ee50.zip | |
Make EC2 update_instance() only update updatable_fields, rather than all
fields. Patch courtesy of Vladimir Popovski.
| -rw-r--r-- | nova/api/ec2/cloud.py | 3 | ||||
| -rw-r--r-- | nova/tests/test_cloud.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index e1c65ae40..c8a7e69be 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -974,7 +974,8 @@ class CloudController(object): changes[field] = kwargs[field] if changes: instance_id = ec2utils.ec2_id_to_id(instance_id) - self.compute_api.update(context, instance_id=instance_id, **kwargs) + self.compute_api.update(context, instance_id=instance_id, + **changes) return True @staticmethod diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py index 8ba2164e7..cbb6233ac 100644 --- a/nova/tests/test_cloud.py +++ b/nova/tests/test_cloud.py @@ -544,7 +544,9 @@ class CloudTestCase(test.TestCase): def test_update_of_instance_wont_update_private_fields(self): inst = db.instance_create(self.context, {}) - self.cloud.update_instance(self.context, inst['id'], + ec2_id = ec2utils.id_to_ec2_id(inst['id']) + self.cloud.update_instance(self.context, ec2_id, + display_name='c00l 1m4g3', mac_address='DE:AD:BE:EF') inst = db.instance_get(self.context, inst['id']) self.assertEqual(None, inst['mac_address']) |
