cannot unlink subnet after commission

Bug #2036405 reported by Robert Varjasi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Triaged
High
Jacopo Rota

Bug Description

I try to use the API call op-unlink_subnet but its not working for the primary (PXE) interface. An unexpected link ID also appears which I cannot read directly but its in the database:

```
HQ-A root@maas-hq-a:/home/ubuntu# maas admin interface unlink-subnet yyb3ck 556 id=1
{"id": ["'1' is not a valid id. It should be one of: '5691', '5692'."]}

HQ-A root@maas-hq-a:/home/ubuntu# maas admin interface read yyb3ck|grep 5691
HQ-A root@maas-hq-a:/home/ubuntu#

```

Here the ID 5691 is not valid.

```
maasdb=# select * from maasserver_staticipaddress where id=5691;
  id | created | updated | ip | alloc_type | subnet_id | user_id | lease_time | temp_expires_on
------+-------------------------------+-------------------------------+----+------------+-----------+---------+------------+-----------------
 5691 | 2023-09-15 18:07:59.054702+02 | 2023-09-15 18:16:52.066979+02 | | 6 | 1 | | 0 |
(1 row)

maasdb=# select * from maasserver_staticipaddress where id=5692;
  id | created | updated | ip | alloc_type | subnet_id | user_id | lease_time | temp_expires_on
------+-------------------------------+-------------------------------+----+------------+-----------+---------+------------+-----------------
 5692 | 2023-09-15 18:07:59.270894+02 | 2023-09-15 18:07:59.270894+02 | | 0 | 1 | | 0 |
(1 row)

```

I suppose this link is a remnant of a commission which is preventing me to unlink and then reconfigure the link properly with my own settings.

If I unlink this "hidden" link too then unlink_subnet functions starts behaving normally.

Revision history for this message
Jacopo Rota (r00ta) wrote :

Hi Robert,

Could you include in the bug report the version of MAAS that you are using as well as the installation type (deb/snap)?

Could you add the steps to reproduce your issue as well?

Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

MAAS version is 3.2.9

Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

maas-hq-a:~$ dpkg -l maas|tail -1
ii maas 1:3.2.9-12055-g.c3d5597a7-0ubuntu1~20.04.1 all

Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

Its a DEB pkg.

Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

Reproduce the issue:

1.) commission a node
2.) try to unlink the primary (PXE) interface which will fail

Revision history for this message
Jacopo Rota (r00ta) wrote :

From my understanding there is no bug here. The correct usage of that function should be

```
ID_LINK=$(maas admin interface read <your_machine_id> <your_interface_id> | jq ".links[].id")
maas admin interface unlink-subnet <your_machine_id> <your_interface_id> id=$ID_LINK
```

and then your interface should be unlinked. Could you confirm?

Changed in maas:
assignee: nobody → Jacopo Rota (r00ta)
Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

Hi,

Unfortunately I cannot confirm that. Unlink should work one-by-one if there are more than one links attached to an interface but it is not working for me. Your solution is to read all links and then unlink also not a solution either. Please again read my posts carefully. I said there is a hidden link, which is a remnant and cannot readable by any API call. This is definitely a BUG I think.

Revision history for this message
Robert Varjasi (robert.varjasi) wrote (last edit ):
Download full text (4.3 KiB)

As you can see the ID 5699 is hidden:

HQ-A root@maas-hq-a:/home/ubuntu# maas admin interface unlink-subnet yyb3ck 556 id=1
{"id": ["'1' is not a valid id. It should be one of: '5699', '5700'."]}
HQ-A root@maas-hq-a:/home/ubuntu# maas admin interface read yyb3ck 556|jq '.links[].id'
5700

And If I try to unlink 5700 as a normal API client (Terraform for example) would do, Its failed:

HQ-A root@maas-hq-a:/home/ubuntu# maas admin interface unlink-subnet yyb3ck 556 id=5700
Success.
Machine-readable output follows:
{
    "tags": [],
    "firmware_version": null,
    "link_speed": 0,
    "sriov_max_vf": 0,
    "id": 556,
    "effective_mtu": 1500,
    "name": "ens4",
    "links": [
        {
            "id": 5705,
            "mode": "link_up",
            "subnet": {
                "name": "oam",
                "description": "",
                "vlan": {
                    "vid": 0,
                    "mtu": 1500,
                    "dhcp_on": true,
                    "external_dhcp": null,
                    "relay_vlan": null,
                    "fabric_id": 0,
                    "id": 5001,
                    "secondary_rack": null,
                    "name": "untagged",
                    "fabric": "fabric-0",
                    "primary_rack": "qxr7ms",
                    "space": "undefined",
                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                },
                "cidr": "192.168.104.0/24",
                "rdns_mode": 2,
                "gateway_ip": "192.168.104.254",
                "dns_servers": [
                    "192.168.104.11",
                    "192.168.104.12",
                    "192.168.104.7"
                ],
                "allow_dns": true,
                "allow_proxy": true,
                "active_discovery": false,
                "managed": true,
                "disabled_boot_architectures": [],
                "id": 1,
                "space": "undefined",
                "resource_uri": "/MAAS/api/2.0/subnets/1/"
            }
        }
    ],
    "parents": [],
    "link_connected": true,
    "vendor": "Red Hat, Inc.",
    "type": "physical",
    "discovered": [
        {
            "subnet": {
                "name": "oam",
                "description": "",
                "vlan": {
                    "vid": 0,
                    "mtu": 1500,
                    "dhcp_on": true,
                    "external_dhcp": null,
                    "relay_vlan": null,
                    "fabric_id": 0,
                    "id": 5001,
                    "secondary_rack": null,
                    "name": "untagged",
                    "fabric": "fabric-0",
                    "primary_rack": "qxr7ms",
                    "space": "undefined",
                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                },
                "cidr": "192.168.104.0/24",
                "rdns_mode": 2,
                "gateway_ip": "192.168.104.254",
                "dns_servers": [
                    "192.168.104.11",
                    "192.168.104.12",
                    "192.168.104.7"
                ],
                "allow_dns": true,
                "allo...

Read more...

Revision history for this message
Jacopo Rota (r00ta) wrote :

The link you see is of type `link_up` and you can actually ignore it as your interface was properly detached from the subnet already.

Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

Sorry but I cannot ignore this. The subnet is not properly detached. Only the IP Mode went from Auto to Unconfigured. The subnet is still attached to my interface.

Revision history for this message
Robert Varjasi (robert.varjasi) wrote (last edit ):

Just to clarify I know how MAAS should work and we are using it for years. This problem is a blocker for us because we wants to change the primary link IP mode to STATIC with an API client (automation) and we cannot do that because this weird behavior.

Revision history for this message
Jacopo Rota (r00ta) wrote :

Right, I see. Thanks for reporting this!

Changed in maas:
importance: Undecided → High
milestone: none → 3.5.0
status: New → Triaged
Revision history for this message
Robert Varjasi (robert.varjasi) wrote :

Thank you!

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.