vCD External Network: can’t UPDATE/DELETE a subnet (IPAM Ip Scope)

If you are familiar with vCD, you might be aware that when an External network is defined you have to specify the subnet details in a form like the following:

The Problem

You can define many subnets for one given External network, however it’s not possible to edit the Gateway nor the Network Mask. You can update DNS, DNS suffix and Static IP pool range however it’s not possible to Delete a subnet (not in use!) once it has been added.
Honestly I find this limitation to be very annoying; end of the day we’re talking about CRUD and nothing complicated.

My first thought was : it must be missing in the GUI, surely the APIs would allow me to Update/Delete a subnet definition! Oh I was wrong: even from the API you can’t Update/Delete a subnet defined in an External Network. You would have to remove the External Network but if it’s in use it’s not always possible, at least not so easily.
If you try a PUT to https://{{vcdServer}}/api/admin/extension/externalnet/<uuid>/  using:

  • as Body what you get from GET https://{{vcdServer}}/api/admin/extension/externalnet/<uuid> minus the <vcloud:IpScope></vcloud:IpScope> section you want to remove
  • as Content-Type = application/vnd.vmware.admin.vmwexternalnet+xml

you’ll get the following error “stackTrace=”com.vmware.vcloud.api.presentation.service.BadRequestException: Existing subnets cannot be deleted.”    meh 😐

Workaround

The only way to get around this problem is to manually alter the vCD Database. Needless to say this is fully unsupported so at your own risk!
I could easily find how to UPDATE a subnet definition (aka IP Scope in DB/APIs term) but due to many db foreign keys linked to other tables a DELETE operation isn’t as easy (SQL is not my bread&butter let’s be honest).
The following diagram shows the relational model for IP_SCOPE, as you can see there are a lot of foreign keys linked dependencies.

Update a Subnet

In the following steps I will update 172.30.20.126 to 172.30.20.254 and the subnet mask from 255.255.255.128 to 255.255.255.0

PLEASE NOTE: the IP Scope must not be in use therefore make sure it is not Enabled.

  1. Connect to the vCD DB (I have an OracleXE db so I’m using Oracle SQL Developer)
  2. Find the subnet you want to UPDATE in table IP_SCOPE

  3. Edit Gateway and Netmask, commit the changes on the table

  4. Back to vCD to verify it has been changed (yay!)

I really would like to see the UPDATE/DELETE implemented for External Networks sooner rather than later; a bit odd to have it still missing on vCD 8.20 SP 😐

PS If I figure out how to do DELETE an IP Scope with all its relationships I will update the post.

Curiosity

Static IP pool are stored on table IP_RANGE but IP addresses are expressed in decimal format 

You can’t read the range very easily; to calculate the decimal address from a dotted string, perform the following calculation:
(First octet * 256³) + (Second octet * 256²) + (Third octet * 256) + (Fourth octet)

Be sociable, share!Tweet about this on TwitterShare on LinkedInShare on FacebookShare on Google+Email this to someone

Leave a Comment

Your email address will not be published.