diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index b3bbe51b3..e066367d4 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -108,6 +108,19 @@ class Proxy(proxy.Proxy): """ self._delete(_flavor.Flavor, flavor, ignore_missing=ignore_missing) + def update_flavor(self, flavor, **attrs): + """Update a flavor + + :param server: Either the ID of a flavot or a + :class:`~openstack.compute.v2.flavor.Flavor` instance. + :attrs kwargs: The attributes to update on the flavor represented + by ``flavor``. + + :returns: The updated flavor + :rtype: :class:`~openstack.compute.v2.flavor.Flavor` + """ + return self._update(_flavor.Flavor, flavor, **attrs) + def get_flavor(self, flavor, get_extra_specs=False): """Get a single flavor diff --git a/openstack/compute/v2/flavor.py b/openstack/compute/v2/flavor.py index 0b43a441a..e92b33b75 100644 --- a/openstack/compute/v2/flavor.py +++ b/openstack/compute/v2/flavor.py @@ -25,6 +25,7 @@ class Flavor(resource.Resource): allow_fetch = True allow_delete = True allow_list = True + allow_commit = True _query_mapping = resource.QueryParameters( "sort_key", "sort_dir", "is_public", diff --git a/openstack/tests/unit/compute/v2/test_flavor.py b/openstack/tests/unit/compute/v2/test_flavor.py index bdaff9b79..56cfa2a38 100644 --- a/openstack/tests/unit/compute/v2/test_flavor.py +++ b/openstack/tests/unit/compute/v2/test_flavor.py @@ -51,7 +51,7 @@ class TestFlavor(base.TestCase): self.assertTrue(sot.allow_fetch) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_list) - self.assertFalse(sot.allow_commit) + self.assertTrue(sot.allow_commit) self.assertDictEqual({"sort_key": "sort_key", "sort_dir": "sort_dir", diff --git a/openstack/tests/unit/compute/v2/test_proxy.py b/openstack/tests/unit/compute/v2/test_proxy.py index 77d223d1c..7513a88bd 100644 --- a/openstack/tests/unit/compute/v2/test_proxy.py +++ b/openstack/tests/unit/compute/v2/test_proxy.py @@ -41,6 +41,9 @@ class TestFlavor(TestComputeProxy): def test_flavor_delete(self): self.verify_delete(self.proxy.delete_flavor, flavor.Flavor, False) + def test_flavor_update(self): + self.verify_update(self.proxy.update_flavor, flavor.Flavor, False) + def test_flavor_delete_ignore(self): self.verify_delete(self.proxy.delete_flavor, flavor.Flavor, True)