Sometimes there is a situation where vCloud Director can no longer delete the organization, vdc or network after some actions. There is a reference in the VCD database
The solution is to find the required network in the DB and delete it.

Connect to the DB:
sudo -i -u postgres psql vcloud
We run SQL commands that will find the network and see if it can be deleted and then delete it.
select * from logical_network where name = 'DefaultName_mnbnv';
id | scope_type | scope_id | ip_scope_id|rnet_id |name | description | link_type | link_lnet_id | version_number |retain_nic_resources | syslog_server_ip1 | syslog_server_ip2 | is_managed_by_nsp | guest_vlan_allowed
-------------------------------------+------------+--------------------------------------+--------------------------------------+-------------------------------------
-+-------------------+-------------+-----------+--------------+----------------+----------------------+-------------------+-------------------+-------------------+----
----------------
b3dc37a8-6117-4b19-80a4-7bd8b50882ad | 2 | 91b11782-59f8-49f7-b82c-45f4dd8a1ec7 | 15ba8f5f-a3c0-4748-9294-a4b9ee117f4e | 98ab3174-1b0b-4a45-b8fe-13f427c2d1c6
| DefaultName_mnbnv | | 1 | | 2 | f | | | f | f
(1 row)
We take the found link_lnet_id = ‘b3dc37a8-6117-4b19-80a4-7bd8b50882ad’
select * from logical_network where link_lnet_id = 'b3dc37a8-6117-4b19-80a4-7bd8b50882ad';
id | scope_type | scope_id | ip_scope_id | rnet_id | name | description
| link_type | link_lnet_id | version_number | retain_nic_resources | syslog_server_ip1 | syslog_server_ip2 | is_managed_by_nsp | guest_vlan_all
owed
--------------------------------------+------------+--------------------------------------+--------------------------------------+---------+-------------+-------------
+-----------+--------------------------------------+----------------+----------------------+-------------------+-------------------+-------------------+---------------
-----
4727d977-a8cc-4296-8f2a-9bb9cc53080a | 3 | 1b7d9fb4-7d02-4004-82b8-7162e85aff58 | 15ba8f5f-a3c0-4748-9294-a4b9ee117f4e | | DefaultName |
| 0 | b3dc37a8-6117-4b19-80a4-7bd8b50882ad | 0 | f | | | f | f
(1 row)
We check if there is anything.
select * from vm_container where sg_id in (select scope_id from logical_network where link_lnet_id = 'b3dc37a8-6117-4b19-80a4-7bd8b50882ad');
sg_id | name | descr | user_id | sg_type | shared_count | is_enabled | date_created | honor_boot_order | vmfolder_moref | vmfolder_vc_id | auto_undeploy_ticks | auto_
undeploy_date | auto_delete_ticks | auto_delete_date | is_auto_undeploy_notified | is_auto_delete_notified | org_id | org_vdc_id | is_gold_master | fence_must_be | ver
sion_number | creation_status | transfer_session_id | is_manifest_required | uniquename | customize_on_instantiate | is_deployed | in_maintenance_mode | auto_nature
-------+------+-------+---------+---------+--------------+------------+--------------+------------------+----------------+----------------+---------------------+------
--------------+-------------------+------------------+---------------------------+-------------------------+--------+------------+----------------+---------------+----
------------+-----------------+---------------------+----------------------+------------+--------------------------+-------------+---------------------+-------------
(0 rows)
select * from network_interface where lnet_id in (select id from logical_network where link_lnet_id = 'b3dc37a8-6117-4b19-80a4-7bd8b50882ad');
nic_id | vm_id | netvm_id | nic_index | mac_address | ip_addressing_mode | ip_address_id | ext_address_id | address_id | link_address_id | net_id | lnet_id | net_hint
| is_connected | netmask | gateway | dns1 | dns2 | needs_customization | version_number | nic_type
--------+-------+----------+-----------+-------------+--------------------+---------------+----------------+------------+-----------------+--------+---------+---------
-+--------------+---------+---------+------+------+---------------------+----------------+----------
(0 rows)
select * from gateway_interface where logical_network_id in (select id from logical_network where link_lnet_id = 'b3dc37a8-6117-4b19-80a4-7bd8b50882ad')
id | gateway_id | logical_network_id | name | display_name | interface_index | interface_type | retain_nic_resources | is_default_route | is_rate_limit_set | ingress
| egress | version_number
----+------------+--------------------+------+--------------+-----------------+----------------+----------------------+------------------+-------------------+---------
+--------+----------------
(0 rows)
If there is nothing, then we delete it.
delete from logical_network where id = '4727d977-a8cc-4296-8f2a-9bb9cc53080a';
After that, we return to the VCD web interface and delete the organization’s network from there.
Leave a Reply