Comment 5 for bug 2049508

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

For the record, the cleanup workaround for MAAS <= 3.2 is

Run
```
sudo snap run --shell maas.supervisor -c "maas-region shell"
```

and then execute

```
from maasserver.enum import INTERFACE_TYPE, IPADDRESS_TYPE
from maasserver.models import Interface

interfaces = Interface.objects.filter(type=INTERFACE_TYPE.UNKNOWN,ip_addresses__ip__isnull=True,ip_addresses__alloc_type=IPADDRESS_TYPE.DISCOVERED,)
len_interfaces = len(interfaces)
for index, interface in enumerate(interfaces):
    print(f"\rDeleting interface {index}/{len_interfaces}", end="")
    interface.delete()

print("")
```

It will take several minutes/hours depending on the amount of zombie resources you have