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
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 0f4d120..4816e7a 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
@@ -826,7 +826,7 @@ angular.module('MAAS').controller('NodeStorageController', [
826 return available;826 return available;
827 };827 };
828828
829 // Update the currect mode for the available section and the all829 // Update the current mode for the available section and the all
830 // selected value.830 // selected value.
831 $scope.updateAvailableSelection = function(force) {831 $scope.updateAvailableSelection = function(force) {
832 if(angular.isUndefined(force)) {832 if(angular.isUndefined(force)) {
@@ -1066,11 +1066,6 @@ angular.module('MAAS').controller('NodeStorageController', [
1066 var params = {1066 var params = {
1067 name: disk.name1067 name: disk.name
1068 };1068 };
1069 // Only take the disk's name if it is a parition as
1070 // these params are passed to update_disk.
1071 if(disk.type === "partition") {
1072 params.name = params.name.split('-')[0];
1073 }
10741069
1075 // Do nothing if not valid.1070 // Do nothing if not valid.
1076 if($scope.isNameInvalid(disk) ||1071 if($scope.isNameInvalid(disk) ||
@@ -1103,8 +1098,15 @@ angular.module('MAAS').controller('NodeStorageController', [
1103 }1098 }
11041099
1105 // Save the options.1100 // Save the options.
1106 MachinesManager.updateDisk(1101 if(disk.type === "partition") {
1107 $scope.node, disk.block_id, params);1102 MachinesManager.updateFilesystem(
1103 $scope.node, disk.block_id, disk.partition_id,
1104 params.fstype, params.mount_point,
1105 params.mount_options, params.tags);
1106 } else {
1107 MachinesManager.updateDisk(
1108 $scope.node, disk.block_id, params);
1109 }
11081110
1109 // Set the options on the object so no flicker occurs while waiting1111 // Set the options on the object so no flicker occurs while waiting
1110 // for the new object to be received.1112 // for the new object to be received.
@@ -1114,7 +1116,7 @@ angular.module('MAAS').controller('NodeStorageController', [
1114 disk.tags = disk.$options.tags;1116 disk.tags = disk.$options.tags;
1115 disk.$options = {};1117 disk.$options = {};
11161118
1117 // If the mount_point is set the we need to transition this to1119 // If the mount_point is set then we need to transition this to
1118 // the filesystem section.1120 // the filesystem section.
1119 if(angular.isString(disk.mount_point) && disk.mount_point !== "") {1121 if(angular.isString(disk.mount_point) && disk.mount_point !== "") {
1120 $scope.filesystems.push({1122 $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 dd13a80..39c8eb0 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
@@ -3075,7 +3075,7 @@ describe("NodeStorageController", function() {
30753075
3076 it("calls updateDisk with new name for logical volume", function() {3076 it("calls updateDisk with new name for logical volume", function() {
3077 var controller = makeController();3077 var controller = makeController();
3078 var name = "vg0-lvnew"3078 var name = "vg0-lvnew";
3079 var disk = {3079 var disk = {
3080 name: name,3080 name: name,
3081 type: "virtual",3081 type: "virtual",
@@ -3098,26 +3098,26 @@ describe("NodeStorageController", function() {
3098 expect(MachinesManager.updateDisk).toHaveBeenCalled();3098 expect(MachinesManager.updateDisk).toHaveBeenCalled();
3099 });3099 });
31003100
3101 it("calls updateDisk with new name for parition", function() {3101 it("calls updateFilesystem for partition", function() {
3102 var controller = makeController();3102 var controller = makeController();
3103 var name = "vda-part1";3103 var name = makeName("name");
3104 var disk = {3104 var disk = {
3105 name: name,3105 name: "",
3106 type: "partition",3106 type: "partition",
3107 block_id: makeInteger(0, 100),
3108 partition_id: makeInteger(0, 100),
3109 $options: {3107 $options: {
3110 fstype: "",3108 mountPoint: ""
3111 mountPoint: "",
3112 mountOptions: ""
3113 },3109 },
3110 original: {
3111 name: name
3112 }
3114 };3113 };
3115 spyOn(MachinesManager, "updateDisk");3114 spyOn(MachinesManager, "updateFilesystem");
31163115
3117 $scope.availableConfirmEdit(disk);3116 $scope.availableConfirmEdit(disk);
3118 expect(disk.name).toBe(name);3117 expect(disk.name).toBe(name);
3119 expect(MachinesManager.updateDisk).toHaveBeenCalled();3118 expect(MachinesManager.updateFilesystem).toHaveBeenCalled();
3120 });3119 });
3120
3121 });3121 });
31223122
3123 describe("canCreateBcache", function() {3123 describe("canCreateBcache", function() {

Subscribers

People subscribed via source and target branches