Merge lp:~rvb/maas/fix-memory-units-1.7 into lp:maas/1.7

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 3324
Proposed branch: lp:~rvb/maas/fix-memory-units-1.7
Merge into: lp:maas/1.7
Diff against target: 81 lines (+7/-7)
5 files modified
src/maasserver/forms.py (+1/-1)
src/maasserver/models/node.py (+1/-1)
src/maasserver/node_constraint_filter_forms.py (+1/-1)
src/maasserver/templates/maasserver/nodes_listing.html (+2/-2)
src/maasserver/tests/test_node_constraint_filter_forms.py (+2/-2)
To merge this branch: bzr merge lp:~rvb/maas/fix-memory-units-1.7
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+244702@code.launchpad.net

Commit message

Backport 3401: Show correct units for memory (MiB, GiB).

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Simple backport, self-approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/forms.py'
2--- src/maasserver/forms.py 2014-12-11 15:28:46 +0000
3+++ src/maasserver/forms.py 2014-12-15 10:02:03 +0000
4@@ -617,7 +617,7 @@
5 cpu_count = forms.IntegerField(
6 required=False, initial=0, label="CPU Count")
7 memory = forms.IntegerField(
8- required=False, initial=0, label="Memory (MB)")
9+ required=False, initial=0, label="Memory (MiB)")
10 storage = forms.IntegerField(
11 required=False, initial=0, label="Disk space (MB)")
12
13
14=== modified file 'src/maasserver/models/node.py'
15--- src/maasserver/models/node.py 2014-12-10 18:04:44 +0000
16+++ src/maasserver/models/node.py 2014-12-15 10:02:03 +0000
17@@ -757,7 +757,7 @@
18 return NODE_STATUS_CHOICES_DICT[self.status]
19
20 def display_memory(self):
21- """Return memory in GB."""
22+ """Return memory in GiB."""
23 if self.memory < 1024:
24 return '%.1f' % (self.memory / 1024.0)
25 return '%d' % (self.memory / 1024)
26
27=== modified file 'src/maasserver/node_constraint_filter_forms.py'
28--- src/maasserver/node_constraint_filter_forms.py 2014-08-13 21:49:35 +0000
29+++ src/maasserver/node_constraint_filter_forms.py 2014-12-15 10:02:03 +0000
30@@ -188,7 +188,7 @@
31
32 mem = forms.FloatField(
33 label="Memory", required=False,
34- error_messages={'invalid': "Invalid memory: number of MB required."})
35+ error_messages={'invalid': "Invalid memory: number of MiB required."})
36
37 tags = UnconstrainedMultipleChoiceField(label="Tags", required=False)
38
39
40=== modified file 'src/maasserver/templates/maasserver/nodes_listing.html'
41--- src/maasserver/templates/maasserver/nodes_listing.html 2014-12-10 16:28:52 +0000
42+++ src/maasserver/templates/maasserver/nodes_listing.html 2014-12-15 10:02:03 +0000
43@@ -26,7 +26,7 @@
44 </th>
45 <th>
46 <a href="{{ sort_links.memory }}"
47- class="{{ sort_classes.memory }}">RAM (GB)</a>
48+ class="{{ sort_classes.memory }}">RAM (GiB)</a>
49 </th>
50 <th>
51 <a href="{{ sort_links.storage }}"
52@@ -50,7 +50,7 @@
53 <th>Status</th>
54 <th>Owner</th>
55 <th>Cores</th>
56- <th>RAM (GB)</th>
57+ <th>RAM (GiB)</th>
58 <th>Disk (GB)</th>
59 <th><acronym
60 title="Media Access Control addresses">MAC</acronym></th>
61
62=== modified file 'src/maasserver/tests/test_node_constraint_filter_forms.py'
63--- src/maasserver/tests/test_node_constraint_filter_forms.py 2014-12-02 16:47:25 +0000
64+++ src/maasserver/tests/test_node_constraint_filter_forms.py 2014-12-15 10:02:03 +0000
65@@ -244,7 +244,7 @@
66 def test_invalid_memory(self):
67 form = AcquireNodeForm(data={'mem': 'invalid'})
68 self.assertEquals(
69- (False, {'mem': ["Invalid memory: number of MB required."]}),
70+ (False, {'mem': ["Invalid memory: number of MiB required."]}),
71 (form.is_valid(), form.errors))
72
73 def test_networks_filters_by_name(self):
74@@ -639,7 +639,7 @@
75 self.assertEquals(
76 (False, {
77 'tags': ["No such tag(s): 'unknown'."],
78- 'mem': ["Invalid memory: number of MB required."],
79+ 'mem': ["Invalid memory: number of MiB required."],
80 }),
81 (form.is_valid(), form.errors))
82

Subscribers

People subscribed via source and target branches

to all changes: