[2.1] maas API 2.0 - link_subnet give error when linking subnet on a different VLAN

Bug #1668957 reported by Larry Michel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Incomplete
Medium
Mike Pontillo

Bug Description

If I try to link a subnet on a different fabric than the one that's set on an interface, then using POST /api/2.0/nodes/{system_id}/interfaces/{id}/ op=link_subnet just returns without the subnet being updated. The API call doesn't return any data. Since I don't see in the API documentation a way to provide the fabric as parameter, I am reporting this as a bug.

I think this is related to bug 1659151 where the fabric and the subnet is not updatable in one step even though the UI shows that it can be done.

Tags: oil
Larry Michel (lmic)
summary: - [2.1.3] link_subnet does not work when linking subnet on a different
- fabric
+ [2.1.3] maas API 2.0 - link_subnet does not work when linking subnet on
+ a different fabric
description: updated
Revision history for this message
Andres Rodriguez (andreserl) wrote : Re: [2.1.3] maas API 2.0 - link_subnet does not work when linking subnet on a different fabric

Can you please provide steps to reproduce what you are trying to achieve and how you are trying to do it?

Changed in maas:
status: New → Incomplete
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Also the UI does not allow you to do this in one step, it just seems that way, but its actually two steps. You should be getting an error by setting the interface to a subnet that is not on that VLAN. MAAS should not just transparently change the VLAN, unless the VLAN was previously not known. Otherwise it would allow you to easily make a mistake, as MAAS discovered that the interface was on that VLAN.

summary: - [2.1.3] maas API 2.0 - link_subnet does not work when linking subnet on
- a different fabric
+ [2.1] maas API 2.0 - link_subnet does not work when linking subnet on a
+ different fabric
Changed in maas:
milestone: none → 2.2.0
importance: Undecided → Medium
Revision history for this message
Larry Michel (lmic) wrote : Re: [2.1] maas API 2.0 - link_subnet does not work when linking subnet on a different fabric
Download full text (6.0 KiB)

@Andres,

I have one subnet on fabric-0 and one subnet on fabric-2. I am using the API to unlink and link the subnet with an input mode.

So, here's some raw data using the wrappers (recreation steps will follow):

>>> a.interface_unlink_subnet('4y3heq', '347', '246536')
{u'name': u'eth1', u'links': [{u'mode': u'link_up', u'id': 246549}], u'tags': [], u'vlan': {u'name': u'untagged', u'vid': 0, u'fabric_id': 2, u'dhcp_on': False, u'mtu': 9000, u'external_dhcp': None, u'fabric': u'fabric-2', u'primary_rack': None, u'id': 5005, u'secondary_rack': None, u'resource_uri': u'/MAAS/api/2.0/vlans/5005/'}, u'enabled': True, u'children': [], u'discovered': [], u'mac_address': u'00:22:99:e0:00:26', u'system_id': u'4y3heq', u'params': {}, u'effective_mtu': 9000, u'parents': [], u'type': u'physical', u'id': 347, u'resource_uri': u'/MAAS/api/2.0/nodes/4y3heq/interfaces/347/'}
>>> a.interface_link_subnet('4y3heq', '347', 'subnet-10.244.128.0/18', 'static')
{u'name': u'eth1', u'links': [{u'subnet': {u'dns_servers': [], u'name': u'subnet-10.244.128.0/18', u'space': u'data', u'vlan': {u'name': u'untagged', u'vid': 0, u'fabric_id': 2, u'dhcp_on': False, u'mtu': 9000, u'external_dhcp': None, u'fabric': u'fabric-2', u'primary_rack': None, u'id': 5005, u'secondary_rack': None, u'resource_uri': u'/MAAS/api/2.0/vlans/5005/'}, u'allow_proxy': True, u'rdns_mode': 2, u'gateway_ip': u'10.244.128.1', u'active_discovery': False, u'cidr': u'10.244.128.0/18', u'id': 13, u'resource_uri': u'/MAAS/api/2.0/subnets/13/'}, u'ip_address': u'10.244.133.105', u'mode': u'static', u'id': 246550}], u'tags': [], u'vlan': {u'name': u'untagged', u'vid': 0, u'fabric_id': 2, u'dhcp_on': False, u'mtu': 9000, u'external_dhcp': None, u'fabric': u'fabric-2', u'primary_rack': None, u'id': 5005, u'secondary_rack': None, u'resource_uri': u'/MAAS/api/2.0/vlans/5005/'}, u'enabled': True, u'children': [], u'discovered': [], u'mac_address': u'00:22:99:e0:00:26', u'system_id': u'4y3heq', u'params': {}, u'effective_mtu': 9000, u'parents': [], u'type': u'physical', u'id': 347, u'resource_uri': u'/MAAS/api/2.0/nodes/4y3heq/interfaces/347/'}

If I try the same with the subnet on the other fabric, then the API call silently returns with no error and also no data. Nothing is changed.

>>> a.interface_unlink_subnet('4y3heq', '347', '246550')
{u'name': u'eth1', u'links': [{u'mode': u'link_up', u'id': 246551}], u'tags': [], u'vlan': {u'name': u'untagged', u'vid': 0, u'fabric_id': 2, u'dhcp_on': False, u'mtu': 9000, u'external_dhcp': None, u'fabric': u'fabric-2', u'primary_rack': None, u'id': 5005, u'secondary_rack': None, u'resource_uri': u'/MAAS/api/2.0/vlans/5005/'}, u'enabled': True, u'children': [], u'discovered': [], u'mac_address': u'00:22:99:e0:00:26', u'system_id': u'4y3heq', u'params': {}, u'effective_mtu': 9000, u'parents': [], u'type': u'physical', u'id': 347, u'resource_uri': u'/MAAS/api/2.0/nodes/4y3heq/interfaces/347/'}
>>> a.interface_link_subnet('4y3heq', '347', '10.244.192.0/18', 'static')
>>>
>>>

Then, I go to the Web UI and change the fabric to fabric-0. Then, the link disappears completely.

>>> a.node_get_interface_and_link_id('4y3heq', 'eth1')
Traceback (most recent call last):
  File ...

Read more...

Larry Michel (lmic)
Changed in maas:
status: Incomplete → New
Revision history for this message
Blake Rouse (blake-rouse) wrote :

The fact that you are getting no error is the problem. The API should prevent you from linking to a subnet that does not belong to the VLAN that the interface is on. Using the API you should first change that interface to the correct VLAN, then link it to that subnet.

maas session interface update asdasd 1 vlan=5003

summary: - [2.1] maas API 2.0 - link_subnet does not work when linking subnet on a
- different fabric
+ [2.1] maas API 2.0 - link_subnet give error when linking subnet on a
+ different VLAN
Changed in maas:
milestone: 2.2.0 → 2.2.0rc2
Changed in maas:
assignee: nobody → Mike Pontillo (mpontillo)
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Have you tried adding force=true when linking the subnet?

Changed in maas:
status: New → Incomplete
Changed in maas:
milestone: 2.2.0rc2 → 2.2.0rc3
Revision history for this message
Mike Pontillo (mpontillo) wrote :

I believe this was fixed by adding the force=true parameter as part of bug #1659607.

Changed in maas:
milestone: 2.2.0rc3 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.