Merge "Fix for backward compatibility with stable/diablo flavors"
This commit is contained in:
commit
6d8e445b79
@ -18,7 +18,7 @@ class Flavor(base.Resource):
|
||||
"""
|
||||
Provide a user-friendly accessor to OS-FLV-EXT-DATA:ephemeral
|
||||
"""
|
||||
return self._info["OS-FLV-EXT-DATA:ephemeral"]
|
||||
return self._info.get("OS-FLV-EXT-DATA:ephemeral", 'N/A')
|
||||
|
||||
|
||||
class FlavorManager(base.ManagerWithFind):
|
||||
|
@ -354,6 +354,11 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
def get_flavors_2(self, **kw):
|
||||
return (200, {'flavor': self.get_flavors_detail()[1]['flavors'][1]})
|
||||
|
||||
def get_flavors_3(self, **kw):
|
||||
# Diablo has no ephemeral
|
||||
return (200, {'flavor': {'id': 3, 'name': '256 MB Server',
|
||||
'ram': 256, 'disk': 10}})
|
||||
|
||||
def delete_flavors_flavordelete(self, **kw):
|
||||
return (202, None)
|
||||
|
||||
|
@ -25,6 +25,15 @@ class FlavorsTest(utils.TestCase):
|
||||
self.assertTrue(isinstance(f, flavors.Flavor))
|
||||
self.assertEqual(f.ram, 256)
|
||||
self.assertEqual(f.disk, 10)
|
||||
self.assertEqual(f.ephemeral, 10)
|
||||
|
||||
def test_get_flavor_details_diablo(self):
|
||||
f = cs.flavors.get(3)
|
||||
cs.assert_called('GET', '/flavors/3')
|
||||
self.assertTrue(isinstance(f, flavors.Flavor))
|
||||
self.assertEqual(f.ram, 256)
|
||||
self.assertEqual(f.disk, 10)
|
||||
self.assertEqual(f.ephemeral, 'N/A')
|
||||
|
||||
def test_find(self):
|
||||
f = cs.flavors.find(ram=256)
|
||||
|
Loading…
Reference in New Issue
Block a user