Merge ~steverydz/maas:fix-static-ip-and-subnet-assignment into maas:master

Proposed by Steve Rydz
Status: Rejected
Rejected by: Blake Rouse
Proposed branch: ~steverydz/maas:fix-static-ip-and-subnet-assignment
Merge into: maas:master
Diff against target: 102 lines (+17/-7)
2 files modified
src/maasserver/static/js/angular/controllers/node_details_networking.js (+7/-3)
src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js (+10/-4)
Reviewer Review Type Date Requested Status
Blake Rouse (community) Disapprove
Mike Pontillo (community) Needs Information
MAAS Lander Approve
Review via email: mp+360659@code.launchpad.net

Commit message

LP: #1806099 - Make sure static IP is assigned when static mode rather than auto assigned

LP: #1806112 - Send subnet ID when creating a bridge or a bond in machine interfaces

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

UNIT TESTS
-b fix-static-ip-and-subnet-assignment lp:~steverydz/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 53d1296654513b3d3bc73e9356a18d4fee488365

review: Approve
Revision history for this message
Mike Pontillo (mpontillo) wrote :

I think the code in this branch is fine, but I think we should discuss the larger picture. Your previous merge proposal stated that back-end changes would be required to get this to work. But I think the reason that setting the IP mode and subnet doesn't work is because it was designed that way for a good reason, and we should discuss further before we change that.

That is, if I am creating a bridge, it should inherit the IP assignment from the interface I created it on. Similarly, if I create a bond, it should inherit the IP assignments from its parent. (The only difference: AUTO and DHCP assignments should be combined, and if a combination of AUTO, DHCP, and Static appear on bond parents, we should prefer static, auto, and DHCP in that order.)

Right now it's not doing that it all. In fact, instead MAAS tends to *remove* all the IP addresses rather than even trying to make a good guess.

***

With that, here are some important questions about the UX that we need to answer:

Should the user be allowed to configure the IP mode at bond or bridge creation time?

If the answer is "yes", what subset of the configuration of the currently-existing interfaces should be shown by default, so that the UI is consistent with the back-end? (We can use the algorithm I described above, but what about edge cases such as multiple static IP address assignments?)

If the answer is "no", we just need to remove IP assignment from the "add" screen and make sure that when bonds or bridges are added, MAAS does something that is predictable and unsurprising. Then we could just replace the IP assignment editing boxes that appear upon bond or bridge creation with some text that states what MAAS will do with existing IP assignments.

(Additionally, when a bond or bridge is deleted, we should probably take any IP assignments and place them on the first parent interface.)

***

I tested this with the API as well; given a machine with system_id 'ta3rxy' and two NICs (IDs 6 and 8), the minimum to create a bond is something like the following:

    maas admin interfaces create-bond ta3rxy parents=6 parents=10 name=bond0

(It fails without the `name=bond0` part.)

The documentation states that leaving out the VLAN results in "disconnected", but that turns out to not be true. In MAAS 2.5, leaving the VLAN out results in the bond being connected to the same VLAN as its parent.

Just as is the case with the UI, creating the bond results in no IP addresses being transferred to the new bond.

Similarly, this is the minimum command to create a bridge:

    maas admin interfaces create-bridge ta3rxy parents=6 name=br0

As with bonds, no IP address assignments are transferred to the new bridge.

review: Needs Information
Revision history for this message
Martin Storey (cassiocassio) wrote :
Revision history for this message
Blake Rouse (blake-rouse) wrote :
review: Disapprove

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

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_networking.js b/src/maasserver/static/js/angular/controllers/node_details_networking.js
index b4c2eac..06dd9fa 100644
--- a/src/maasserver/static/js/angular/controllers/node_details_networking.js
+++ b/src/maasserver/static/js/angular/controllers/node_details_networking.js
@@ -33,6 +33,7 @@ angular.module('MAAS').filter('filterByUnusedForInterface', function() {
33});33});
3434
3535
36
36// Filter that is specific to the NodeNetworkingController. Filters the37// Filter that is specific to the NodeNetworkingController. Filters the
37// list of interfaces to not include the current parent interfaces being38// list of interfaces to not include the current parent interfaces being
38// bonded together.39// bonded together.
@@ -1525,7 +1526,8 @@ angular.module('MAAS').controller('NodeNetworkingController', [
1525 vlan: vlan_id,1526 vlan: vlan_id,
1526 bond_mode: $scope.newBondInterface.bond_mode,1527 bond_mode: $scope.newBondInterface.bond_mode,
1527 bond_lacp_rate: $scope.newBondInterface.lacpRate,1528 bond_lacp_rate: $scope.newBondInterface.lacpRate,
1528 bond_xmit_hash_policy: $scope.newBondInterface.xmitHashPolicy1529 bond_xmit_hash_policy: $scope.newBondInterface.xmitHashPolicy,
1530 subnet: $scope.newBondInterface.subnet.id
1529 };1531 };
1530 $scope.$parent.nodesManager.createBondInterface(1532 $scope.$parent.nodesManager.createBondInterface(
1531 $scope.node, params).then(null, function(error) {1533 $scope.node, params).then(null, function(error) {
@@ -1668,7 +1670,8 @@ angular.module('MAAS').controller('NodeNetworkingController', [
1668 vlan: vlan.id,1670 vlan: vlan.id,
1669 fabric: fabric.id,1671 fabric: fabric.id,
1670 bridge_stp: $scope.newBridgeInterface.bridge_stp,1672 bridge_stp: $scope.newBridgeInterface.bridge_stp,
1671 bridge_fd: $scope.newBridgeInterface.bridge_fd1673 bridge_fd: $scope.newBridgeInterface.bridge_fd,
1674 subnet: $scope.newBridgeInterface.subnet.id
1672 };1675 };
1673 $scope.$parent.nodesManager.createBridgeInterface(1676 $scope.$parent.nodesManager.createBridgeInterface(
1674 $scope.node, params).then(null, function(error) {1677 $scope.node, params).then(null, function(error) {
@@ -1757,7 +1760,8 @@ angular.module('MAAS').controller('NodeNetworkingController', [
1757 function(tag) { return tag.text; }),1760 function(tag) { return tag.text; }),
1758 mac_address: $scope.newInterface.mac_address,1761 mac_address: $scope.newInterface.mac_address,
1759 vlan: $scope.newInterface.vlan.id,1762 vlan: $scope.newInterface.vlan.id,
1760 mode: $scope.newInterface.mode1763 mode: $scope.newInterface.mode,
1764 ip_address: $scope.newInterface.ip_address
1761 };1765 };
1762 }1766 }
1763 if(angular.isObject($scope.newInterface.subnet)) {1767 if(angular.isObject($scope.newInterface.subnet)) {
diff --git a/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js b/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
index 85d1678..fd4be12 100644
--- a/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
+++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
@@ -3754,7 +3754,8 @@ describe("NodeNetworkingController", function() {
3754 vlan: vlan.id,3754 vlan: vlan.id,
3755 bond_mode: "active-backup",3755 bond_mode: "active-backup",
3756 bond_lacp_rate: "fast",3756 bond_lacp_rate: "fast",
3757 bond_xmit_hash_policy: "layer2"3757 bond_xmit_hash_policy: "layer2",
3758 subnet: undefined
3758 });3759 });
3759 expect($scope.interfaces).toEqual([]);3760 expect($scope.interfaces).toEqual([]);
3760 expect($scope.newBondInterface).toEqual({});3761 expect($scope.newBondInterface).toEqual({});
@@ -3802,7 +3803,8 @@ describe("NodeNetworkingController", function() {
3802 vlan: null,3803 vlan: null,
3803 bond_mode: "active-backup",3804 bond_mode: "active-backup",
3804 bond_lacp_rate: "fast",3805 bond_lacp_rate: "fast",
3805 bond_xmit_hash_policy: "layer2"3806 bond_xmit_hash_policy: "layer2",
3807 subnet: undefined
3806 });3808 });
3807 expect($scope.interfaces).toEqual([]);3809 expect($scope.interfaces).toEqual([]);
3808 expect($scope.newBondInterface).toEqual({});3810 expect($scope.newBondInterface).toEqual({});
@@ -4033,6 +4035,7 @@ describe("NodeNetworkingController", function() {
4033 vlan: vlan,4035 vlan: vlan,
4034 fabric: fabric4036 fabric: fabric
4035 };4037 };
4038
4036 $scope.interfaces = [nic1];4039 $scope.interfaces = [nic1];
4037 $scope.interfaceLinksMap = {};4040 $scope.interfaceLinksMap = {};
4038 $scope.interfaceLinksMap[nic1.id] = {};4041 $scope.interfaceLinksMap[nic1.id] = {};
@@ -4045,6 +4048,7 @@ describe("NodeNetworkingController", function() {
4045 spyOn($scope, "cannotAddBridge").and.returnValue(false);4048 spyOn($scope, "cannotAddBridge").and.returnValue(false);
4046 $scope.newBridgeInterface.name = "br0";4049 $scope.newBridgeInterface.name = "br0";
4047 $scope.newBridgeInterface.mac_address = "00:11:22:33:44:55";4050 $scope.newBridgeInterface.mac_address = "00:11:22:33:44:55";
4051 $scope.newBridgeInterface.subnet = {};
4048 $scope.addBridge();4052 $scope.addBridge();
40494053
4050 expect(MachinesManager.createBridgeInterface).toHaveBeenCalledWith(4054 expect(MachinesManager.createBridgeInterface).toHaveBeenCalledWith(
@@ -4056,7 +4060,8 @@ describe("NodeNetworkingController", function() {
4056 vlan: vlan.id,4060 vlan: vlan.id,
4057 fabric: fabric.id,4061 fabric: fabric.id,
4058 bridge_stp: false,4062 bridge_stp: false,
4059 bridge_fd: 154063 bridge_fd: 15,
4064 subnet: undefined
4060 });4065 });
4061 expect($scope.interfaces).toEqual([]);4066 expect($scope.interfaces).toEqual([]);
4062 expect($scope.newBridgeInterface).toEqual({});4067 expect($scope.newBridgeInterface).toEqual({});
@@ -4296,7 +4301,8 @@ describe("NodeNetworkingController", function() {
4296 tags: [],4301 tags: [],
4297 vlan: vlan.id,4302 vlan: vlan.id,
4298 subnet: subnet.id,4303 subnet: subnet.id,
4299 mode: "auto"4304 mode: "auto",
4305 ip_address: undefined
4300 });4306 });
4301 expect($scope.newInterface).toEqual({});4307 expect($scope.newInterface).toEqual({});
4302 expect($scope.selectedMode).toBeNull();4308 expect($scope.selectedMode).toBeNull();

Subscribers

People subscribed via source and target branches