Merge lp:~mpontillo/maas/dhcp-with-aliases--bug-1600267--2.0 into lp:maas/2.0

Proposed by Mike Pontillo
Status: Merged
Approved by: Mike Pontillo
Approved revision: no longer in the source branch.
Merged at revision: 5153
Proposed branch: lp:~mpontillo/maas/dhcp-with-aliases--bug-1600267--2.0
Merge into: lp:maas/2.0
Diff against target: 87 lines (+16/-11)
2 files modified
src/maasserver/static/js/angular/controllers/node_details_networking.js (+8/-7)
src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js (+8/-4)
To merge this branch: bzr merge lp:~mpontillo/maas/dhcp-with-aliases--bug-1600267--2.0
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+299738@code.launchpad.net

Commit message

Backport revision 5166 from trunk to fix adding aliases to interfaces where DHCP is enabled.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Self-approved backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/static/js/angular/controllers/node_details_networking.js'
--- src/maasserver/static/js/angular/controllers/node_details_networking.js 2016-06-14 06:27:57 +0000
+++ src/maasserver/static/js/angular/controllers/node_details_networking.js 2016-07-11 20:34:38 +0000
@@ -98,15 +98,17 @@
98 }98 }
99 });99 });
100 } else {100 } else {
101 // Don't add LINK_UP or DHCP if more than one link exists or101 // Don't add LINK_UP if more than one link exists or
102 // if the interface is an alias.102 // if the interface is an alias.
103 var allowLinkUpAndDHCP = (103 var allowLinkUp = (
104 (angular.isObject(nic.links) && nic.links.length > 1) ||104 (angular.isObject(nic.links) && nic.links.length > 1) ||
105 (nic.type === "alias"));105 (nic.type === "alias"));
106 angular.forEach(modes, function(mode) {106 angular.forEach(modes, function(mode) {
107 if(allowLinkUpAndDHCP && (107 if(allowLinkUp && mode.mode === "link_up") {
108 mode.mode === "link_up" ||108 return;
109 mode.mode === "dhcp")) {109 }
110 // Can't run DHCP twice on one NIC.
111 if(nic.type === "alias" && mode.mode === "dhcp") {
110 return;112 return;
111 }113 }
112 filtered.push(mode);114 filtered.push(mode);
@@ -882,8 +884,7 @@
882 } else if(nic.type === INTERFACE_TYPE.ALIAS) {884 } else if(nic.type === INTERFACE_TYPE.ALIAS) {
883 return false;885 return false;
884 } else if(nic.links.length === 0 ||886 } else if(nic.links.length === 0 ||
885 nic.links[0].mode === LINK_MODE.LINK_UP ||887 nic.links[0].mode === LINK_MODE.LINK_UP) {
886 nic.links[0].mode === LINK_MODE.DHCP) {
887 return false;888 return false;
888 } else {889 } else {
889 return true;890 return true;
890891
=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js'
--- src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2016-06-14 06:27:57 +0000
+++ src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2016-07-11 20:34:38 +0000
@@ -266,7 +266,7 @@
266 ]);266 ]);
267 });267 });
268268
269 it("auto and static modes if more than one link", function() {269 it("auto, static, and dhcp modes if more than one link", function() {
270 var nic = {270 var nic = {
271 subnet : {},271 subnet : {},
272 links: [{}, {}]272 links: [{}, {}]
@@ -279,6 +279,10 @@
279 {279 {
280 "mode": "static",280 "mode": "static",
281 "text": "Static assign"281 "text": "Static assign"
282 },
283 {
284 "mode": "dhcp",
285 "text": "DHCP"
282 }286 }
283 ]);287 ]);
284 });288 });
@@ -1261,7 +1265,7 @@
1261 it("updates newInterface.parent object", function() {1265 it("updates newInterface.parent object", function() {
1262 var controller = makeController();1266 var controller = makeController();
1263 var newInterface = {1267 var newInterface = {
1264 type: "vlan"1268 type: "alias"
1265 };1269 };
1266 setupNewInterface(controller, newInterface);1270 setupNewInterface(controller, newInterface);
1267 var parent = newInterface.parent;1271 var parent = newInterface.parent;
@@ -2435,7 +2439,7 @@
2435 expect($scope.canAddAlias(nic)).toBe(false);2439 expect($scope.canAddAlias(nic)).toBe(false);
2436 });2440 });
24372441
2438 it("returns false if nic has dhcp", function() {2442 it("returns true if nic has dhcp", function() {
2439 var controller = makeController();2443 var controller = makeController();
2440 var nic = {2444 var nic = {
2441 type: "physical",2445 type: "physical",
@@ -2443,7 +2447,7 @@
2443 mode: "dhcp"2447 mode: "dhcp"
2444 }]2448 }]
2445 };2449 };
2446 expect($scope.canAddAlias(nic)).toBe(false);2450 expect($scope.canAddAlias(nic)).toBe(true);
2447 });2451 });
24482452
2449 it("returns true if nic has static", function() {2453 it("returns true if nic has static", function() {

Subscribers

People subscribed via source and target branches

to all changes: