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
diff --git a/src/maasserver/static/js/angular/controllers/node_details_storage.js b/src/maasserver/static/js/angular/controllers/node_details_storage.js
index bffd989..0758f12 100644
--- a/src/maasserver/static/js/angular/controllers/node_details_storage.js
+++ b/src/maasserver/static/js/angular/controllers/node_details_storage.js
@@ -1,4 +1,4 @@
1/* Copyright 2015-2017 Canonical Ltd. This software is licensed under the1/* Copyright 2015-2018 Canonical Ltd. This software is licensed under the
2 * GNU Affero General Public License version 3 (see the file LICENSE).2 * GNU Affero General Public License version 3 (see the file LICENSE).
3 *3 *
4 * MAAS Node Storage Controller4 * MAAS Node Storage Controller
@@ -824,7 +824,7 @@ angular.module('MAAS').controller('NodeStorageController', [
824 return available;824 return available;
825 };825 };
826826
827 // Update the currect mode for the available section and the all827 // Update the current mode for the available section and the all
828 // selected value.828 // selected value.
829 $scope.updateAvailableSelection = function(force) {829 $scope.updateAvailableSelection = function(force) {
830 if(angular.isUndefined(force)) {830 if(angular.isUndefined(force)) {
@@ -1064,11 +1064,6 @@ angular.module('MAAS').controller('NodeStorageController', [
1064 var params = {1064 var params = {
1065 name: disk.name1065 name: disk.name
1066 };1066 };
1067 // Only take the disk's name if it is a parition as
1068 // these params are passed to update_disk.
1069 if(disk.type === "partition") {
1070 params.name = params.name.split('-')[0];
1071 }
10721067
1073 // Do nothing if not valid.1068 // Do nothing if not valid.
1074 if($scope.isNameInvalid(disk) ||1069 if($scope.isNameInvalid(disk) ||
@@ -1101,8 +1096,15 @@ angular.module('MAAS').controller('NodeStorageController', [
1101 }1096 }
11021097
1103 // Save the options.1098 // Save the options.
1104 MachinesManager.updateDisk(1099 if(disk.type === "partition") {
1105 $scope.node, disk.block_id, params);1100 MachinesManager.updateFilesystem(
1101 $scope.node, disk.block_id, disk.partition_id,
1102 params.fstype, params.mount_point,
1103 params.mount_options, params.tags);
1104 } else {
1105 MachinesManager.updateDisk(
1106 $scope.node, disk.block_id, params);
1107 }
11061108
1107 // Set the options on the object so no flicker occurs while waiting1109 // Set the options on the object so no flicker occurs while waiting
1108 // for the new object to be received.1110 // for the new object to be received.
@@ -1112,7 +1114,7 @@ angular.module('MAAS').controller('NodeStorageController', [
1112 disk.tags = disk.$options.tags;1114 disk.tags = disk.$options.tags;
1113 disk.$options = {};1115 disk.$options = {};
11141116
1115 // If the mount_point is set the we need to transition this to1117 // If the mount_point is set then we need to transition this to
1116 // the filesystem section.1118 // the filesystem section.
1117 if(angular.isString(disk.mount_point) && disk.mount_point !== "") {1119 if(angular.isString(disk.mount_point) && disk.mount_point !== "") {
1118 $scope.filesystems.push({1120 $scope.filesystems.push({
diff --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
index 3678749..6700c1f 100644
--- 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
@@ -3066,7 +3066,7 @@ describe("NodeStorageController", function() {
30663066
3067 it("calls updateDisk with new name for logical volume", function() {3067 it("calls updateDisk with new name for logical volume", function() {
3068 var controller = makeController();3068 var controller = makeController();
3069 var name = "vg0-lvnew"3069 var name = "vg0-lvnew";
3070 var disk = {3070 var disk = {
3071 name: name,3071 name: name,
3072 type: "virtual",3072 type: "virtual",
@@ -3089,26 +3089,26 @@ describe("NodeStorageController", function() {
3089 expect(MachinesManager.updateDisk).toHaveBeenCalled();3089 expect(MachinesManager.updateDisk).toHaveBeenCalled();
3090 });3090 });
30913091
3092 it("calls updateDisk with new name for parition", function() {3092 it("calls updateFilesystem for partition", function() {
3093 var controller = makeController();3093 var controller = makeController();
3094 var name = "vda-part1";3094 var name = makeName("name");
3095 var disk = {3095 var disk = {
3096 name: name,3096 name: "",
3097 type: "partition",3097 type: "partition",
3098 block_id: makeInteger(0, 100),
3099 partition_id: makeInteger(0, 100),
3100 $options: {3098 $options: {
3101 fstype: "",3099 mountPoint: ""
3102 mountPoint: "",
3103 mountOptions: ""
3104 },3100 },
3101 original: {
3102 name: name
3103 }
3105 };3104 };
3106 spyOn(MachinesManager, "updateDisk");3105 spyOn(MachinesManager, "updateFilesystem");
31073106
3108 $scope.availableConfirmEdit(disk);3107 $scope.availableConfirmEdit(disk);
3109 expect(disk.name).toBe(name);3108 expect(disk.name).toBe(name);
3110 expect(MachinesManager.updateDisk).toHaveBeenCalled();3109 expect(MachinesManager.updateFilesystem).toHaveBeenCalled();
3111 });3110 });
3111
3112 });3112 });
31133113
3114 describe("canCreateBcache", function() {3114 describe("canCreateBcache", function() {

Subscribers

People subscribed via source and target branches