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

Proposed by Newell Jensen
Status: Merged
Approved by: Newell Jensen
Approved revision: 1a10396ac1c68d15a9d09d3926e3dbf648c80aac
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~newell-jensen/maas:2.3-lp1760715
Merge into: maas:2.3
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
Newell Jensen (community) Approve
Review via email: mp+345323@code.launchpad.net

Commit message

Backport of 3674eeafd563de2d4688a39b75a26af4ee1d3807

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
Newell Jensen (newell-jensen) wrote :

Self approved backport

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 bffd989..0758f12 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@@ -824,7 +824,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@@ -1064,11 +1064,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@@ -1101,8 +1096,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@@ -1112,7 +1114,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 3678749..6700c1f 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@@ -3066,7 +3066,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@@ -3089,26 +3089,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