Merge ~newell-jensen/maas:lp1760715 into maas:master

Proposed by Newell Jensen
Status: Merged
Approved by: Newell Jensen
Approved revision: 077fd818420e134f572025cdbc399f16183a6e50
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~newell-jensen/maas:lp1760715
Merge into: maas:master
Diff against target: 109 lines (+24/-22)
2 files modified
src/maasserver/static/js/angular/controllers/node_details_storage.js (+12/-10)
src/maasserver/static/js/angular/controllers/tests/test_node_details_storage.js (+12/-12)
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
MAAS Lander Approve
Review via email: mp+345271@code.launchpad.net

Commit message

LP: #1760715 -- Fixes how partitions are being updated by calling updateFilesystem instead of updateDisk.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp1760715 lp:~newell-jensen/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 077fd818420e134f572025cdbc399f16183a6e50

review: Approve
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/controllers/node_details_storage.js b/src/maasserver/static/js/angular/controllers/node_details_storage.js
2index 0f4d120..4816e7a 100644
3--- a/src/maasserver/static/js/angular/controllers/node_details_storage.js
4+++ b/src/maasserver/static/js/angular/controllers/node_details_storage.js
5@@ -1,4 +1,4 @@
6-/* Copyright 2015-2017 Canonical Ltd. This software is licensed under the
7+/* Copyright 2015-2018 Canonical Ltd. This software is licensed under the
8 * GNU Affero General Public License version 3 (see the file LICENSE).
9 *
10 * MAAS Node Storage Controller
11@@ -826,7 +826,7 @@ angular.module('MAAS').controller('NodeStorageController', [
12 return available;
13 };
14
15- // Update the currect mode for the available section and the all
16+ // Update the current mode for the available section and the all
17 // selected value.
18 $scope.updateAvailableSelection = function(force) {
19 if(angular.isUndefined(force)) {
20@@ -1066,11 +1066,6 @@ angular.module('MAAS').controller('NodeStorageController', [
21 var params = {
22 name: disk.name
23 };
24- // Only take the disk's name if it is a parition as
25- // these params are passed to update_disk.
26- if(disk.type === "partition") {
27- params.name = params.name.split('-')[0];
28- }
29
30 // Do nothing if not valid.
31 if($scope.isNameInvalid(disk) ||
32@@ -1103,8 +1098,15 @@ angular.module('MAAS').controller('NodeStorageController', [
33 }
34
35 // Save the options.
36- MachinesManager.updateDisk(
37- $scope.node, disk.block_id, params);
38+ if(disk.type === "partition") {
39+ MachinesManager.updateFilesystem(
40+ $scope.node, disk.block_id, disk.partition_id,
41+ params.fstype, params.mount_point,
42+ params.mount_options, params.tags);
43+ } else {
44+ MachinesManager.updateDisk(
45+ $scope.node, disk.block_id, params);
46+ }
47
48 // Set the options on the object so no flicker occurs while waiting
49 // for the new object to be received.
50@@ -1114,7 +1116,7 @@ angular.module('MAAS').controller('NodeStorageController', [
51 disk.tags = disk.$options.tags;
52 disk.$options = {};
53
54- // If the mount_point is set the we need to transition this to
55+ // If the mount_point is set then we need to transition this to
56 // the filesystem section.
57 if(angular.isString(disk.mount_point) && disk.mount_point !== "") {
58 $scope.filesystems.push({
59diff --git a/src/maasserver/static/js/angular/controllers/tests/test_node_details_storage.js b/src/maasserver/static/js/angular/controllers/tests/test_node_details_storage.js
60index dd13a80..39c8eb0 100644
61--- a/src/maasserver/static/js/angular/controllers/tests/test_node_details_storage.js
62+++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details_storage.js
63@@ -3075,7 +3075,7 @@ describe("NodeStorageController", function() {
64
65 it("calls updateDisk with new name for logical volume", function() {
66 var controller = makeController();
67- var name = "vg0-lvnew"
68+ var name = "vg0-lvnew";
69 var disk = {
70 name: name,
71 type: "virtual",
72@@ -3098,26 +3098,26 @@ describe("NodeStorageController", function() {
73 expect(MachinesManager.updateDisk).toHaveBeenCalled();
74 });
75
76- it("calls updateDisk with new name for parition", function() {
77+ it("calls updateFilesystem for partition", function() {
78 var controller = makeController();
79- var name = "vda-part1";
80+ var name = makeName("name");
81 var disk = {
82- name: name,
83+ name: "",
84 type: "partition",
85- block_id: makeInteger(0, 100),
86- partition_id: makeInteger(0, 100),
87 $options: {
88- fstype: "",
89- mountPoint: "",
90- mountOptions: ""
91+ mountPoint: ""
92 },
93+ original: {
94+ name: name
95+ }
96 };
97- spyOn(MachinesManager, "updateDisk");
98+ spyOn(MachinesManager, "updateFilesystem");
99
100 $scope.availableConfirmEdit(disk);
101 expect(disk.name).toBe(name);
102- expect(MachinesManager.updateDisk).toHaveBeenCalled();
103- });
104+ expect(MachinesManager.updateFilesystem).toHaveBeenCalled();
105+ });
106+
107 });
108
109 describe("canCreateBcache", function() {

Subscribers

People subscribed via source and target branches