Merge "Auto-Assign Flavor ID"
This commit is contained in:
commit
f04a24c6ad
|
@ -134,10 +134,8 @@ class FlavorManager(base.ManagerWithFind):
|
|||
except:
|
||||
raise exceptions.CommandError("Disk must be an integer.")
|
||||
|
||||
try:
|
||||
flavorid = int(flavorid)
|
||||
except:
|
||||
raise exceptions.CommandError("Flavor ID must be an integer.")
|
||||
if flavorid == "auto":
|
||||
flavorid = None
|
||||
|
||||
try:
|
||||
swap = int(swap)
|
||||
|
@ -165,7 +163,7 @@ class FlavorManager(base.ManagerWithFind):
|
|||
"ram": int(ram),
|
||||
"vcpus": int(vcpus),
|
||||
"disk": int(disk),
|
||||
"id": int(flavorid),
|
||||
"id": flavorid,
|
||||
"swap": int(swap),
|
||||
"OS-FLV-EXT-DATA:ephemeral": int(ephemeral),
|
||||
"rxtx_factor": int(rxtx_factor),
|
||||
|
|
|
@ -341,9 +341,6 @@ def _print_flavor_list(cs, flavors):
|
|||
def do_flavor_list(cs, _args):
|
||||
"""Print a list of available 'flavors' (sizes of servers)."""
|
||||
flavors = cs.flavors.list()
|
||||
for flavor in flavors:
|
||||
# int needed for numerical sort
|
||||
flavor.id = int(flavor.id)
|
||||
_print_flavor_list(cs, flavors)
|
||||
|
||||
|
||||
|
|
|
@ -98,9 +98,6 @@ class FlavorsTest(utils.TestCase):
|
|||
self.assertRaises(exceptions.CommandError, cs.flavors.create,
|
||||
"flavorcreate", 512, 1, "invalid", 1234, swap=0,
|
||||
ephemeral=0, rxtx_factor=1, is_public=True)
|
||||
self.assertRaises(exceptions.CommandError, cs.flavors.create,
|
||||
"flavorcreate", 512, 1, 10, "invalid", swap=0,
|
||||
ephemeral=0, rxtx_factor=1, is_public=True)
|
||||
self.assertRaises(exceptions.CommandError, cs.flavors.create,
|
||||
"flavorcreate", 512, 1, 10, 1234, swap="invalid",
|
||||
ephemeral=0, rxtx_factor=1, is_public=True)
|
||||
|
|
Loading…
Reference in New Issue