[2.1.3] Can't link subnet with link_up from maas API as in WebUI- Cannot configure interface to link up (with no IP address) while other links are already configured.

Bug #1659607 reported by Larry Michel
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Mike Pontillo
2.1
Fix Released
High
Mike Pontillo

Bug Description

I am trying to use API to update link from auto to link_up and back from link_up to auto based on the network requirement for the service deployed with Juju (see bug 1659360) and the API is not allowing me to do that. If I try a POST without first unlinking then it creates aliases for every calls eth1.1,.. eth1.x. If I unlink then try to link with mode set to link_up then it fails. I tried from the MAAS CLI to get a better error and this is what it says:

ubuntu@maas2-integration:~$ maas root interface link-subnet 4y4cra 90398 subnet="10.244.128.0/18" mode=LINK_UP
{"mode": ["Cannot configure interface to link up (with no IP address) while other links are already configured."]}

The problem with this seems to be that even when subnet is unlinked, there's a default link_up link that's spawned after the last link is unlinked:

so for example:

{
    "links": [
        {
            "subnet": {
                "name": "subnet-10.244.128.0/18",
                "gateway_ip": "10.244.128.1",
                "cidr": "10.244.128.0/18",
                "rdns_mode": 2,
                "vlan": {
                    "mtu": 1500,
                    "dhcp_on": false,
                    "secondary_rack": null,
                    "fabric": "fabric-2",
                    "vid": 0,
                    "fabric_id": 2,
                    "resource_uri": "/MAAS/api/2.0/vlans/5005/",
                    "external_dhcp": null,
                    "primary_rack": null,
                    "name": "untagged",
                    "id": 5005
                },
                "id": 13,
                "resource_uri": "/MAAS/api/2.0/subnets/13/",
                "allow_proxy": true,
                "dns_servers": [],
                "space": "data",
                "active_discovery": false
            },
            "mode": "auto",
            "id": 198502
        }
    ],
    "enabled": true,
    "resource_uri": "/MAAS/api/2.0/nodes/4y4cra/interfaces/90398/",
    "children": [],
    "name": "eth1",
    "mac_address": "00:22:99:e0:05:36",
    "vlan": {
        "mtu": 1500,
        "dhcp_on": false,
        "secondary_rack": null,
        "fabric": "fabric-2",
        "vid": 0,
        "fabric_id": 2,
        "resource_uri": "/MAAS/api/2.0/vlans/5005/",
        "external_dhcp": null,
        "primary_rack": null,
        "name": "untagged",
        "id": 5005
    },
    "id": 90398,
    "type": "physical",
    "tags": [],
    "system_id": "4y4cra",
    "parents": [],
    "params": {},
    "discovered": null,
    "effective_mtu": 1500
}

Then I run,

ubuntu@maas2-integration:~$ maas root interface unlink-subnet 4y4cra 90398 id=198502
Success.
Machine-readable output follows:
{
    "links": [
        {
            "mode": "link_up",
            "id": 198686
        }
    ],
    "enabled": true,
    "resource_uri": "/MAAS/api/2.0/nodes/4y4cra/interfaces/90398/",
    "children": [],
    "name": "eth1",
    "mac_address": "00:22:99:e0:05:36",
    "vlan": {
        "mtu": 1500,
        "dhcp_on": false,
        "secondary_rack": null,
        "fabric": "fabric-2",
        "vid": 0,
        "fabric_id": 2,
        "resource_uri": "/MAAS/api/2.0/vlans/5005/",
        "external_dhcp": null,
        "primary_rack": null,
        "name": "untagged",
        "id": 5005
    },
    "id": 90398,
    "type": "physical",
    "tags": [],
    "system_id": "4y4cra",
    "parents": [],
    "params": {},
    "discovered": null,
    "effective_mtu": 1500
}

It creates link 198686.

ubuntu@maas2-integration:~$ dpkg -l '*maas*'|cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============================-==============================-============-=================================================
ii maas 2.1.3+bzr5573-0ubuntu1~16.04.1 all "Metal as a Service" is a physical cloud and IPAM
ii maas-cli 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS client and command-line interface
un maas-cluster-controller <none> <none> (no description available)
ii maas-common 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS server common files
ii maas-dhcp 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS DHCP server
ii maas-dns 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS DNS server
ii maas-proxy 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS Caching Proxy
ii maas-rack-controller 2.1.3+bzr5573-0ubuntu1~16.04.1 all Rack Controller for MAAS
ii maas-region-api 2.1.3+bzr5573-0ubuntu1~16.04.1 all Region controller API service for MAAS
ii maas-region-controller 2.1.3+bzr5573-0ubuntu1~16.04.1 all Region Controller for MAAS
un maas-region-controller-min <none> <none> (no description available)
un python-django-maas <none> <none> (no description available)
un python-maas-client <none> <none> (no description available)
un python-maas-provisioningserver <none> <none> (no description available)
ii python3-django-maas 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS server Django web framework (Python 3)
ii python3-maas-client 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS python API client (Python 3)
ii python3-maas-provisioningserver 2.1.3+bzr5573-0ubuntu1~16.04.1 all MAAS server provisioning libraries (Python 3)

Related branches

Revision history for this message
Larry Michel (lmic) wrote :
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Can you clarify the expected behavior? (You want to see no LINK_UP, which implies no VLAN either?) Have you tried explicitly removing the VLAN?

Revision history for this message
Larry Michel (lmic) wrote :

@mpontillo, attaching what it looks like from the WebUI. I am tying to do the equivalent of selecting Unconfigured with that subnet on eth2 using the API. On the WebUI, it's set as untagged so there shouldn't be any VLAN IIUC. But, I can try removing the one that's shown when the unlink command exited.

Changed in maas:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Mike Pontillo (mpontillo)
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Thanks for the clarification; I think I understand the requirement now.

I plan to propose a branch which does two things:

(1) Allow subnet to be changed for a mode=LINK_UP even if another LINK_UP already exists.
(2) Add a "force=True" option to the `link-subnet` API to:
 - Allow selection of an arbitrary subnet, even if MAAS does not believe it to be on the VLAN that interface was discovered on. (This will implicitly change the VLAN.)
 - Allow mode=LINK_UP to be set on the interface even if links already exist (those links will be deleted).

Changed in maas:
status: Triaged → Fix Committed
tags: added: cdo-qa-blocker
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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