Merge "Replace MB with MiB"

This commit is contained in:
Zuul 2018-10-27 05:55:20 +00:00 committed by Gerrit Code Review
commit 58b3ac457a
11 changed files with 63 additions and 62 deletions

View File

@ -1027,7 +1027,7 @@ Boot a new server.
driver chooses suitable device depending on
selected bus; note the libvirt driver always
uses default device names), size=size of the
block device in MB(for swap) and in GiB(for
block device in MiB(for swap) and in GiB(for
other formats) (if omitted, hypervisor driver
calculates size), format=device will be
formatted (e.g. swap, ntfs, ...; optional),
@ -1046,7 +1046,7 @@ Boot a new server.
``--swap <swap_size>``
Create and attach a local swap block device of
<swap_size> MB.
<swap_size> MiB.
``--ephemeral``
size=<size>[,format=<format>]
@ -1334,7 +1334,7 @@ Create a new flavor.
generated a UUID for the ID.
``<ram>``
Memory size in MB.
Memory size in MiB.
``<disk>``
Disk size in GiB.
@ -1348,7 +1348,7 @@ Create a new flavor.
Ephemeral space size in GiB (default 0).
``--swap <swap>``
Swap space size in MB (default 0).
Swap space size in MiB (default 0).
``--rxtx-factor <factor>``
RX/TX factor (default 1).
@ -1430,7 +1430,7 @@ Print a list of available 'flavors' (sizes of servers).
Filters the flavors by a minimum disk space, in GiB.
``--min-ram <min-ram>``
Filters the flavors by a minimum RAM, in MB.
Filters the flavors by a minimum RAM, in MiB.
``--limit <limit>``
Maximum number of flavors to display. If limit is

View File

@ -49,7 +49,7 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
params='--flavor m1.tiny')
def test_admin_flavor_list(self):
self.assertIn("Memory_MB", self.nova('flavor-list'))
self.assertIn("Memory_MiB", self.nova('flavor-list'))
def test_admin_hypervisor_list(self):
self.nova('hypervisor-list')

View File

@ -59,10 +59,10 @@ class FakeClient(object):
self.assert_called('GET', '/flavors/aa1/os-extra_specs')
2. self.run_command(["boot", "--image", "1",
"--flavor", "512 MB Server",
"--flavor", "512 MiB Server",
"--max-count", "3", "server"])
self.assert_called('GET', '/images/1', pos=0)
self.assert_called('GET', '/flavors/512 MB Server', pos=1)
self.assert_called('GET', '/flavors/512 MiB Server', pos=1)
self.assert_called('GET', '/flavors?is_public=None', pos=2)
self.assert_called('GET', '/flavors/2', pos=3)
self.assert_called(

View File

@ -43,7 +43,7 @@ class Base(base.Fixture):
},
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "e4d909c290d0fb1ca068ffaddf22cbd0",
"status": "BUILD",
@ -85,7 +85,7 @@ class Base(base.Fixture):
},
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "9e107d9d372bb6826bd81d3542a419d6",
"status": "ACTIVE",
@ -127,7 +127,7 @@ class Base(base.Fixture):
"image": "",
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "9e107d9d372bb6826bd81d3542a419d6",
"status": "ACTIVE",

View File

@ -49,7 +49,7 @@ class BaseTest(utils.TestCase):
def test_resource_lazy_getattr(self):
cs = fakes.FakeClient(api_versions.APIVersion("2.0"))
f = flavors.Flavor(cs.flavors, {'id': 1})
self.assertEqual('256 MB Server', f.name)
self.assertEqual('256 MiB Server', f.name)
cs.assert_called('GET', '/flavors/1')
# Missing stuff still fails after a second get

View File

@ -409,7 +409,7 @@ class FakeSessionClient(base_client.SessionClient):
},
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "e4d909c290d0fb1ca068ffaddf22cbd0",
"status": "BUILD",
@ -450,7 +450,7 @@ class FakeSessionClient(base_client.SessionClient):
},
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "9e107d9d372bb6826bd81d3542a419d6",
"status": "ACTIVE",
@ -491,7 +491,7 @@ class FakeSessionClient(base_client.SessionClient):
"image": "",
"flavor": {
"id": 1,
"name": "256 MB Server",
"name": "256 MiB Server",
},
"hostId": "9e107d9d372bb6826bd81d3542a419d6",
"status": "ACTIVE",
@ -844,19 +844,19 @@ class FakeSessionClient(base_client.SessionClient):
def get_flavors_detail(self, **kw):
flavors = {'flavors': [
{'id': 1, 'name': '256 MB Server', 'ram': 256, 'disk': 10,
{'id': 1, 'name': '256 MiB Server', 'ram': 256, 'disk': 10,
'OS-FLV-EXT-DATA:ephemeral': 10,
'os-flavor-access:is_public': True,
'links': {}},
{'id': 2, 'name': '512 MB Server', 'ram': 512, 'disk': 20,
{'id': 2, 'name': '512 MiB Server', 'ram': 512, 'disk': 20,
'OS-FLV-EXT-DATA:ephemeral': 20,
'os-flavor-access:is_public': False,
'links': {}},
{'id': 4, 'name': '1024 MB Server', 'ram': 1024, 'disk': 10,
{'id': 4, 'name': '1024 MiB Server', 'ram': 1024, 'disk': 10,
'OS-FLV-EXT-DATA:ephemeral': 10,
'os-flavor-access:is_public': True,
'links': {}},
{'id': 'aa1', 'name': '128 MB Server', 'ram': 128, 'disk': 0,
{'id': 'aa1', 'name': '128 MiB Server', 'ram': 128, 'disk': 0,
'OS-FLV-EXT-DATA:ephemeral': 0,
'os-flavor-access:is_public': True,
'links': {}}
@ -925,16 +925,16 @@ class FakeSessionClient(base_client.SessionClient):
FAKE_RESPONSE_HEADERS,
{'flavor': {
'id': 3,
'name': '256 MB Server',
'name': '256 MiB Server',
'ram': 256,
'disk': 10,
}},
)
def get_flavors_512_MB_Server(self, **kw):
def get_flavors_512_MiB_Server(self, **kw):
raise exceptions.NotFound('404')
def get_flavors_128_MB_Server(self, **kw):
def get_flavors_128_MiB_Server(self, **kw):
raise exceptions.NotFound('404')
def get_flavors_80645cf4_6ad3_410a_bbc8_6f3e1e291f51(self, **kw):

View File

@ -122,11 +122,11 @@ class FlavorsTest(utils.TestCase):
f = self.cs.flavors.find(ram=256)
self.assert_request_id(f, fakes.FAKE_REQUEST_ID_LIST)
self.cs.assert_called('GET', '/flavors/detail')
self.assertEqual('256 MB Server', f.name)
self.assertEqual('256 MiB Server', f.name)
f = self.cs.flavors.find(disk=0)
self.assert_request_id(f, fakes.FAKE_REQUEST_ID_LIST)
self.assertEqual('128 MB Server', f.name)
self.assertEqual('128 MiB Server', f.name)
self.assertRaises(exceptions.NotFound, self.cs.flavors.find,
disk=12345)

View File

@ -455,9 +455,10 @@ class ServersTest(utils.FixturedTestCase):
self.assertEqual('sample-server', server.name)
self.assertRaises(exceptions.NoUniqueMatch, self.cs.servers.find,
flavor={"id": 1, "name": "256 MB Server"})
flavor={"id": 1, "name": "256 MiB Server"})
sl = self.cs.servers.findall(flavor={"id": 1, "name": "256 MB Server"})
sl = self.cs.servers.findall(flavor={"id": 1,
"name": "256 MiB Server"})
self.assert_request_id(sl, fakes.FAKE_REQUEST_ID_LIST)
self.assertEqual([1234, 5678, 9012], [s.id for s in sl])

View File

@ -1165,10 +1165,10 @@ class ShellTest(utils.TestCase):
def test_boot_named_flavor(self):
self.run_command(["boot", "--image", FAKE_UUID_1,
"--flavor", "512 MB Server",
"--flavor", "512 MiB Server",
"--max-count", "3", "server"])
self.assert_called('GET', '/v2/images/' + FAKE_UUID_1, pos=0)
self.assert_called('GET', '/flavors/512 MB Server', pos=1)
self.assert_called('GET', '/flavors/512 MiB Server', pos=1)
self.assert_called('GET', '/flavors?is_public=None', pos=2)
self.assert_called('GET', '/flavors/2', pos=3)
self.assert_called(
@ -1404,15 +1404,15 @@ class ShellTest(utils.TestCase):
self.assert_called_anytime('GET', '/flavors/aa1')
def test_flavor_show_by_name(self):
self.run_command(['flavor-show', '128 MB Server'])
self.assert_called('GET', '/flavors/128 MB Server', pos=0)
self.run_command(['flavor-show', '128 MiB Server'])
self.assert_called('GET', '/flavors/128 MiB Server', pos=0)
self.assert_called('GET', '/flavors?is_public=None', pos=1)
self.assert_called('GET', '/flavors/aa1', pos=2)
self.assert_called('GET', '/flavors/aa1/os-extra_specs', pos=3)
def test_flavor_show_by_name_priv(self):
self.run_command(['flavor-show', '512 MB Server'])
self.assert_called('GET', '/flavors/512 MB Server', pos=0)
self.run_command(['flavor-show', '512 MiB Server'])
self.assert_called('GET', '/flavors/512 MiB Server', pos=0)
self.assert_called('GET', '/flavors?is_public=None', pos=1)
self.assert_called('GET', '/flavors/2', pos=2)
self.assert_called('GET', '/flavors/2/os-extra_specs', pos=3)
@ -1444,7 +1444,7 @@ class ShellTest(utils.TestCase):
{'addTenantAccess': {'tenant': 'proj2'}})
def test_flavor_access_add_by_name(self):
self.run_command(['flavor-access-add', '512 MB Server', 'proj2'])
self.run_command(['flavor-access-add', '512 MiB Server', 'proj2'])
self.assert_called('POST', '/flavors/2/action',
{'addTenantAccess': {'tenant': 'proj2'}})
@ -1454,7 +1454,7 @@ class ShellTest(utils.TestCase):
{'removeTenantAccess': {'tenant': 'proj2'}})
def test_flavor_access_remove_by_name(self):
self.run_command(['flavor-access-remove', '512 MB Server', 'proj2'])
self.run_command(['flavor-access-remove', '512 MiB Server', 'proj2'])
self.assert_called('POST', '/flavors/2/action',
{'removeTenantAccess': {'tenant': 'proj2'}})
@ -2336,8 +2336,8 @@ class ShellTest(utils.TestCase):
'start=2000-01-20T00:00:00&' +
'end=2005-02-01T00:00:00&' +
'detailed=1')
# Servers, RAM MB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('1 | 25451.76 | 49.71 | 0.00', stdout)
# Servers, RAM MiB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('1 | 25451.76 | 49.71 | 0.00', stdout)
def test_usage_list_stitch_together_next_results(self):
cmd = 'usage-list --start 2000-01-20 --end 2005-02-01'
@ -2357,8 +2357,8 @@ class ShellTest(utils.TestCase):
'start=2000-01-20T00:00:00&'
'end=2005-02-01T00:00:00&'
'marker=%s&detailed=1' % (marker), pos=pos + 1)
# Servers, RAM MB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('2 | 50903.53 | 99.42 | 0.00', stdout)
# Servers, RAM MiB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('2 | 50903.53 | 99.42 | 0.00', stdout)
def test_usage_list_no_args(self):
timeutils.set_time_override(datetime.datetime(2005, 2, 1, 0, 0))
@ -2377,8 +2377,8 @@ class ShellTest(utils.TestCase):
'/os-simple-tenant-usage/test?' +
'start=2000-01-20T00:00:00&' +
'end=2005-02-01T00:00:00')
# Servers, RAM MB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('1 | 25451.76 | 49.71 | 0.00', stdout)
# Servers, RAM MiB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('1 | 25451.76 | 49.71 | 0.00', stdout)
def test_usage_stitch_together_next_results(self):
cmd = 'usage --start 2000-01-20 --end 2005-02-01'
@ -2397,8 +2397,8 @@ class ShellTest(utils.TestCase):
'start=2000-01-20T00:00:00&'
'end=2005-02-01T00:00:00&'
'marker=%s' % (marker), pos=pos + 1)
# Servers, RAM MB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('2 | 50903.53 | 99.42 | 0.00', stdout)
# Servers, RAM MiB-Hours, CPU Hours, Disk GiB-Hours
self.assertIn('2 | 50903.53 | 99.42 | 0.00', stdout)
def test_usage_no_tenant(self):
self.run_command('usage --start 2000-01-20 --end 2005-02-01')

View File

@ -114,7 +114,7 @@ class FlavorManager(base.ManagerWithFind):
:param marker: Begin returning flavors that appear later in the flavor
list than that represented by this flavor id (optional).
:param min_disk: Filters the flavors by a minimum disk space, in GiB.
:param min_ram: Filters the flavors by a minimum RAM, in MB.
:param min_ram: Filters the flavors by a minimum RAM, in MiB.
:param limit: maximum number of flavors to return (optional).
:param sort_key: Flavors list sort key (optional).
:param sort_dir: Flavors list sort direction (optional).
@ -183,14 +183,14 @@ class FlavorManager(base.ManagerWithFind):
"""Create a flavor.
:param name: Descriptive name of the flavor
:param ram: Memory in MB for the flavor
:param ram: Memory in MiB for the flavor
:param vcpus: Number of VCPUs for the flavor
:param disk: Size of local disk in GiB
:param flavorid: ID for the flavor (optional). You can use the reserved
value ``"auto"`` to have Nova generate a UUID for the
flavor in cases where you cannot simply pass ``None``.
:param ephemeral: Ephemeral disk space in GiB.
:param swap: Swap space in MB
:param swap: Swap space in MiB
:param rxtx_factor: RX/TX factor
:param is_public: Whether or not the flavor is public.
:param description: A free form description of the flavor.

View File

@ -644,7 +644,7 @@ def _boot(cs, args):
"if omitted, hypervisor driver chooses suitable device "
"depending on selected bus; note the libvirt driver always "
"uses default device names), "
"size=size of the block device in MB(for swap) and in "
"size=size of the block device in MiB(for swap) and in "
"GiB(for other formats) "
"(if omitted, hypervisor driver calculates size), "
"format=device will be formatted (e.g. swap, ntfs, ...; optional), "
@ -674,7 +674,7 @@ def _boot(cs, args):
"if omitted, hypervisor driver chooses suitable device "
"depending on selected bus; note the libvirt driver always "
"uses default device names), "
"size=size of the block device in MB(for swap) and in "
"size=size of the block device in MiB(for swap) and in "
"GiB(for other formats) "
"(if omitted, hypervisor driver calculates size), "
"format=device will be formatted (e.g. swap, ntfs, ...; optional), "
@ -703,7 +703,7 @@ def _boot(cs, args):
"if omitted, hypervisor driver chooses suitable device "
"depending on selected bus; note the libvirt driver always "
"uses default device names), "
"size=size of the block device in MB(for swap) and in "
"size=size of the block device in MiB(for swap) and in "
"GiB(for other formats) "
"(if omitted, hypervisor driver calculates size), "
"format=device will be formatted (e.g. swap, ntfs, ...; optional), "
@ -732,7 +732,7 @@ def _boot(cs, args):
"if omitted, hypervisor driver chooses suitable device "
"depending on selected bus; note the libvirt driver always "
"uses default device names), "
"size=size of the block device in MB(for swap) and in "
"size=size of the block device in MiB(for swap) and in "
"GiB(for other formats) "
"(if omitted, hypervisor driver calculates size), "
"format=device will be formatted (e.g. swap, ntfs, ...; optional), "
@ -761,7 +761,7 @@ def _boot(cs, args):
"if omitted, hypervisor driver chooses suitable device "
"depending on selected bus; note the libvirt driver always "
"uses default device names), "
"size=size of the block device in MB(for swap) and in "
"size=size of the block device in MiB(for swap) and in "
"GiB(for other formats) "
"(if omitted, hypervisor driver calculates size), "
"format=device will be formatted (e.g. swap, ntfs, ...; optional), "
@ -778,7 +778,7 @@ def _boot(cs, args):
'--swap',
metavar="<swap_size>",
default=None,
help=_("Create and attach a local swap block device of <swap_size> MB."))
help=_("Create and attach a local swap block device of <swap_size> MiB."))
@utils.arg(
'--ephemeral',
metavar="size=<size>[,format=<format>]",
@ -1060,7 +1060,7 @@ def _translate_extended_states(collection):
def _translate_flavor_keys(collection):
_translate_keys(collection, [('ram', 'memory_mb')])
_translate_keys(collection, [('ram', 'memory_mib')])
def _print_flavor_extra_specs(flavor):
@ -1076,7 +1076,7 @@ def _print_flavor_list(cs, flavors, show_extra_specs=False):
headers = [
'ID',
'Name',
'Memory_MB',
'Memory_MiB',
'Disk',
'Ephemeral',
'Swap',
@ -1129,7 +1129,7 @@ def _print_flavor_list(cs, flavors, show_extra_specs=False):
dest='min_ram',
metavar='<min-ram>',
default=None,
help=_('Filters the flavors by a minimum RAM, in MB.'))
help=_('Filters the flavors by a minimum RAM, in MiB.'))
@utils.arg(
'--limit',
dest='limit',
@ -1196,7 +1196,7 @@ def do_flavor_show(cs, args):
@utils.arg(
'ram',
metavar='<ram>',
help=_("Memory size in MB."))
help=_("Memory size in MiB."))
@utils.arg(
'disk',
metavar='<disk>',
@ -1213,7 +1213,7 @@ def do_flavor_show(cs, args):
@utils.arg(
'--swap',
metavar='<swap>',
help=_("Additional swap space size in MB (default 0)."),
help=_("Additional swap space size in MiB (default 0)."),
default=0)
@utils.arg(
'--rxtx-factor',
@ -3089,7 +3089,7 @@ def _merge_usage_list(usages, next_usage_list):
def do_usage_list(cs, args):
"""List usage data for all tenants."""
dateformat = "%Y-%m-%d"
rows = ["Tenant ID", "Servers", "RAM MB-Hours", "CPU Hours",
rows = ["Tenant ID", "Servers", "RAM MiB-Hours", "CPU Hours",
"Disk GiB-Hours"]
now = timeutils.utcnow()
@ -3158,7 +3158,7 @@ def do_usage_list(cs, args):
def do_usage(cs, args):
"""Show usage data for a single tenant."""
dateformat = "%Y-%m-%d"
rows = ["Servers", "RAM MB-Hours", "CPU Hours", "Disk GiB-Hours"]
rows = ["Servers", "RAM MiB-Hours", "CPU Hours", "Disk GiB-Hours"]
now = timeutils.utcnow()
@ -4810,13 +4810,13 @@ def do_cell_show(cs, args):
def do_cell_capacities(cs, args):
"""Get cell capacities for all cells or a given cell."""
cell = cs.cells.capacities(args.cell)
print(_("Ram Available: %s MB") % cell.capacities['ram_free']['total_mb'])
print(_("Ram Available: %s MiB") % cell.capacities['ram_free']['total_mb'])
utils.print_dict(cell.capacities['ram_free']['units_by_mb'],
dict_property='Ram(MB)', dict_value="Units")
print(_("\nDisk Available: %s MB") %
dict_property='Ram(MiB)', dict_value="Units")
print(_("\nDisk Available: %s MiB") %
cell.capacities['disk_free']['total_mb'])
utils.print_dict(cell.capacities['disk_free']['units_by_mb'],
dict_property='Disk(MB)', dict_value="Units")
dict_property='Disk(MiB)', dict_value="Units")
@utils.arg('server', metavar='<server>', help='Name or ID of server.')