Sometimes can't delete quantum networks by the command "nova delete ", it throws the exception "NetworkBusy" or "NetworkInUse

Bug #1013977 reported by Hua Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Invalid
Undecided
Unassigned

Bug Description

if we create some quantum networks, when using following command to delete the network:
    nova-manage network delete --uuid=1fbc7e90-8cc3-48e5-9c1b-8dc64e384b90

sometimes ( not all , sometimes it is ok ) we can see following exception:

2012-06-16 13:54:58 TRACE nova Traceback (most recent call last):
2012-06-16 13:54:58 TRACE nova File "/usr/bin/nova-manage", line 7, in <module>
2012-06-16 13:54:58 TRACE nova execfile(__file__)
2012-06-16 13:54:58 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 1750, in <module>
2012-06-16 13:54:58 TRACE nova main()
2012-06-16 13:54:58 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 1737, in main
2012-06-16 13:54:58 TRACE nova fn(*fn_args, **fn_kwargs)
2012-06-16 13:54:58 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 881, in delete
2012-06-16 13:54:58 TRACE nova fixed_range, uuid)
2012-06-16 13:54:58 TRACE nova File "/bak/openstack/nova/nova/network/quantum/manager.py", line 276, in delete_network
2012-06-16 13:54:58 TRACE nova raise exception.NetworkBusy(network=net_uuid)
2012-06-16 13:54:58 TRACE nova NetworkBusy: Network 1fbc7e90-8cc3-48e5-9c1b-8dc64e384b90 has active ports, cannot delete.
2012-06-16 13:54:58 TRACE nova
[hua@hua devstack]$ echo $?
1

when I use following scripts to set active ports to 'DOWN'

NETWORK_ID=1fbc7e90-8cc3-48e5-9c1b-8dc64e384b90
TENANT_ID=`nova-manage network list | grep $NETWORK_ID | awk '{print $8}'`
for PORT_ID in `quantum list_ports $TENANT_ID $NETWORK_ID | grep "Port:" | awk -F ': ' '{print $2}'`; do
    quantum update_port $TENANT_ID $NETWORK_ID $PORT_ID state='DOWN'
    quantum unplug_iface $TENANT_ID $NETWORK_ID $PORT_ID
    quantum delete_port $TENANT_ID $NETWORK_ID $PORT_ID
done

I execute "nova delete " command again, we can see the NetworkInUse exception.

2012-06-16 13:56:03 TRACE nova Traceback (most recent call last):
2012-06-16 13:56:03 TRACE nova File "/usr/bin/nova-manage", line 7, in <module>
2012-06-16 13:56:03 TRACE nova execfile(__file__)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 1750, in <module>
2012-06-16 13:56:03 TRACE nova main()
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 1737, in main
2012-06-16 13:56:03 TRACE nova fn(*fn_args, **fn_kwargs)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/bin/nova-manage", line 881, in delete
2012-06-16 13:56:03 TRACE nova fixed_range, uuid)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/network/quantum/manager.py", line 289, in delete_network
2012-06-16 13:56:03 TRACE nova self.ipam.delete_subnets_by_net_id(context, net_uuid, project_id)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/network/quantum/nova_ipam_lib.py", line 98, in delete_subnets_by_net_id
2012-06-16 13:56:03 TRACE nova require_disassociated=False)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/network/manager.py", line 261, in wrapped
2012-06-16 13:56:03 TRACE nova return func(self, context, *args, **kwargs)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/network/manager.py", line 1482, in delete_network
2012-06-16 13:56:03 TRACE nova self.db.network_delete_safe(context, network.id)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/db/api.py", line 779, in network_delete_safe
2012-06-16 13:56:03 TRACE nova return IMPL.network_delete_safe(context, network_id)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/db/sqlalchemy/api.py", line 113, in wrapper
2012-06-16 13:56:03 TRACE nova return f(*args, **kwargs)
2012-06-16 13:56:03 TRACE nova File "/bak/openstack/nova/nova/db/sqlalchemy/api.py", line 2014, in network_delete_safe
2012-06-16 13:56:03 TRACE nova raise exception.NetworkInUse(network_id=network_id)
2012-06-16 13:56:03 TRACE nova NetworkInUse: Network 4 is still in use.

but in this time, network has benn removed from quantum DB, but it still has this network in nova DB, so if we excute "nova delete " command again, it will throw NetworkNotFound exception:

2012-06-16 13:56:32 TRACE nova params=filter_ops)
2012-06-16 13:56:32 TRACE nova File "/bak/openstack/nova/nova/network/quantum/client.py", line 197, in do_request
2012-06-16 13:56:32 TRACE nova _("Quantum entity not found: %s"), data)
2012-06-16 13:56:32 TRACE nova QuantumNotFoundException: (u'Quantum entity not found: %s', '{"QuantumError": {"message": "Unable to find a network with the specified identifier.", "type": "NetworkNotFound", "detail": "Network 1fbc7e90-8cc3-48e5-9c1b-8dc64e384b90 could not be found"}}'

can someone delete networks successfully by the nova-manage command ?

Revision history for this message
Hua Zhang (zhhuabj) wrote :

this is not a bug, after " nova-manage network delete", we only need sleep a few seconds to wait quantum agent to finished the request. will close it

Changed in quantum:
status: New → Invalid
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.