Validate rxtx_factor as a float.

Updates the rxtx_factor validations in the instance_types modules so
that rxtx_factor is validated as a float. Given that rxtx_factor is stored
as a float in the database this makes sense... and also adheres
to some of the extension documentation as well (although some of
the extension docs were incorrect as well).

Previously rxtx_factor was being cast into an int which caused it to
be stored and displayed incorrectly via the API.

This patchset adds a test which fails with the old code.

Additionally some of the API docs are corrected so that rxtx_factor is
listed as a float in all examples.

Fixes LP Bug #1081287.

Change-Id: Iae98522a1f2ed63cbd2497b0b0af5ac2d9bb935c
This commit is contained in:
Dan Prince
2012-11-27 10:28:01 -05:00
parent c4b6f35af2
commit 1cdc56ebec
2 changed files with 17 additions and 4 deletions

View File

@@ -808,7 +808,7 @@ class InstanceTypeCommands(object):
@args('--is_public', dest="is_public", metavar='<is_public>',
help='Make flavor accessible to the public')
def create(self, name, memory, vcpus, root_gb, ephemeral_gb=0,
flavorid=None, swap=0, rxtx_factor=1, is_public=True):
flavorid=None, swap=0, rxtx_factor=1.0, is_public=True):
"""Creates instance types / flavors"""
try:
instance_types.create(name, memory, vcpus, root_gb,