it is not possible to delete an vDC as long as as org Networks do exist. That makes sense, but is problematic if the network is shared between vDCs.
If the network is beeing deleted it gets deleted in all vDCs, and as long as the network is there the vDC can't be deleted.
We use that sharing a lot, since our customers vm's need access to the same network, although they are in different vDCs
Any ideas to get around this ? One idea would be to create a oNetwork for each vDC, but each oNetwork itself connects to the same external Network.
You should be able to delete a network so long as it's not in use.
Shared or not, that doesn't matter.
However, if you do share it, then VMs in other Org vDCs could have NIC Cards assigned to it. This is either in My Cloud or in your Catalog(s).
I thought I had a DB query to show vApps/VMs assigned to a given org network, which is to show that the Network is actually in use and that the error is genuine.
You are right - i can delete the network if it is not in use. But that is not the point - maybe i was not clear enough.
I want to delete a vdc not the network. and to delete it all vdc networks have to be removed. If it is a shared network it might be used in aother vdc as you indicated, and therefore cant't/shouldn't be deleted. So instead of deleting the vDC we have to disable it, until the network is not used any longer in other vdcs.
In the meantime we solved it by creating separate Org VDc Networks, which are connected to the same external network. Thats the most flexible solution. Since we create the network configuration with vCenter Orchestrator that task is invisible for the user creating the network.
Really, that is the point. The network was created under the ownership of an Organization vDC. It belongs to it and is shared from it. For an Org vDC to be deleted, you have to remove all content inside of it first.
This is just how the product works.
You figured out a workaround, which is what I would typically suggest. If you have many Org vDCs in an Organization, don't share. Make an Network per Org vDC which is not shared. You can follow this path, but it does have some additional configuration overhead. It does prevent some scenarios like you did experience.
I ran into this issue in my own environment recently. In my case, I was trying to remove a provider VDC, which has a single org VDC inside it. The vApps had been moved to an org VDC under another pVDC, but vCloud wouldn't let me remove the pVDC.
The organization network was shared between both VDCs, but there wasn't any way to "unshare" it from a VDC.
I ended up having to reconfigure all the vApps, and delete all their network configurations, in order to remove that organization network.
I think this is what the OP was experiencing - this inability to unshare the organization network.
I've fixed this in vCD 5.x+ using MS-SQL with the following query, if you are familiar with T-SQL this should help guide you in the right direction. Take a backup before modifications and keep in mind this is not provided as a supported solution from VMware. As such, I can't be held responsible for any issues this causes, I have the luxury of a non-production environment.
--OLD OrgvDC you are prevented from deleting
DECLARE @oldOrgvDCname AS varchar
SET @oldorgvdcname = 'Cloud ServiceFabric Development'
--A New OrgvDC within the same datacenter (Shared Networks)
DECLARE @newOrgvDCname AS varchar
SET @newOrgvDCname = 'CSF-Demonstration-OrgvDC01'
-- Replace the Logical Resource Mapping
SET vdc_id = (Select id from org_prov_vdc Where name = @newOrgvDCname)
WHERE lr_type = 'NETWORK' AND vdc_id = (Select id from org_prov_vdc Where name = @oldorgvdcname)
-- From here you should be able to delete the empty OrgvDC.