VK Cloud logo

Cannot delete a subnet

An error occurs when deleting a subnet:

Unable to complete operation on subnet: One or more ports have an IP allocation from this subnet. 1 of 1 subnets failed to delete

All available ports in the subnet are deleted, but there are ports that cannot be deleted.

The problem occurs when a virtual machine has been deleted, but its port remains and is still considered connected to this VM. Therefore, an error occurs when trying to delete a subnet with such a port.

Solution

  1. Detach the port from the deleted VM by attaching it to a non-existent resource:

    openstack port set --device-owner <ARBITRARY_TEXT> <PORT_NAME_OR_ID>

    Here:

    • <ARBITRARY_TEXT> is any name or identifier of a non-existent resource.
    • <PORT_NAME_OR_ID> is the name or identifier of the port left from the deleted VM. To view the subnet ports, run: openstack port list --network <NETWORK_NAME_OR_ID>.
  2. Try to delete the subnet:

    openstack subnet delete <SUBNET_ID>

    Here <SUBNET_ID> is the LINK_NOT_DEFINED(../../../../networks/vnet/instructions/net) to delete.

  3. If the problem persists, contact technical support.

Was this article helpful?