Cloud Director does not have the capability to switch a Provider VDC’s secondary resource pool to primary via UI or API. As the Broadcom KB 325643 article explains; “The only way to change a resource pool so it is no longer tagged a primary is to merge Provider VDCs“. However, there is another option via a database change if you do not what to create a new Provider VDC.

High Level Steps…
Step 1 : Backup the Cloud Director Database
Step 2: Get the Provider VDC primary_rp_moref
Step 3: Set Old Primary Resource Pool to is_primary = false
Step 4: Set New Primary Resource Pool to is_primary = true
Step 5: Update the PVDC primary_rp_moref
Before You Start…
Take note of the Provider VDC Resource Pool names. For the example in this blog post I am going to make Resource Pool ‘tok05-w381-work03-c01-paygo‘ as the new primary taking over from tok05-w381-work03-c02-paygo‘.
Important Note: As with a Provider VDC Merge task all Org VDCs need to be elastic. This is explained in the KB referenced above. Ensure ‘Make Allocation pool Organization VDCs elastic‘ is set to Enabled and that no Reservation Pool Org VDCs exist in the Provider VDC.

Let’s Dive Straight In…
Step 1 : Backup the Cloud Director Database
/opt/vmware/appliance/bin/create-backup.sh
Step 2: Get the Provider VDC primary_rp_moref
1. Login to the VCD primary cell and login to the vcloud postgres database. Turn on expanded display .
Tip: ‘db‘ is a useful shortcut to enter the vcloud postgres database.
root@dir381d01 [ ~ ]# dbpsql.bin (14.11 (VMware Postgres 14.11.0-23473091 release))Type "help" for help.vcloud=# \xExpanded display is on.
2. Run the following SELECT command to get the Provider VDC provider_id and primary_rp_moref
vcloud=# SELECT prov_vdc.id AS provider_id,prov_vdc.name AS provider_name,prov_vdc.rp_moref AS primary_rp_moref,cluster_compute_resource_inv.name AS cluster_name,computehub_set_computehub.id AS rp_csc_id,resource_pool_inv.name AS rp_name,resource_pool_inv.moref AS rp_moref,computehub_set_computehub.is_primary FROM prov_vdc INNER JOIN prov_vdc_logical_resource ON prov_vdc.id = prov_vdc_logical_resource.prov_vdc_id INNER JOIN computehub_set_computehub ON prov_vdc_logical_resource.fo_id = computehub_set_computehub.computehub_set_id INNER JOIN vc_computehub ON computehub_set_computehub.computehub_id = vc_computehub.id INNER JOIN resource_pool_inv ON vc_computehub.rp_moref = resource_pool_inv.moref INNER JOIN cluster_compute_resource_inv ON resource_pool_inv.cr_moref = cluster_compute_resource_inv.moref WHERE prov_vdc.name = 'tok05-w381-work03--paygo';-[ RECORD 1 ]----+-------------------------------------provider_id | c4ed5e2c-64ec-447e-ae43-b6151a1d8e16provider_name | tok05-w381-work03--paygoprimary_rp_moref | resgroup-342663cluster_name | tok05-w381-work03-c02rp_csc_id | 90a6dc40-3fd7-4686-b05f-6719574c7e2frp_name | tok05-w381-work03-c02-paygorp_moref | resgroup-342663is_primary | t-[ RECORD 2 ]----+-------------------------------------provider_id | c4ed5e2c-64ec-447e-ae43-b6151a1d8e16provider_name | tok05-w381-work03--paygoprimary_rp_moref | resgroup-342663cluster_name | tok05-w381-work03-c01rp_csc_id | 79f4dd27-9de6-4a6c-b56a-6f8e257470c6rp_name | tok05-w381-work03-c01-paygorp_moref | resgroup-23116is_primary | fvcloud=#
Step 3: Set Old Primary Resource Pool to is_primary = false
1. Get the resource pool ‘tok05-w381-work03-c02-paygo‘ rp_moref value:
vcloud=# select name,moref from resource_pool_inv where name = 'tok05-w381-work03-c02-paygo'; name | moref-----------------------------+----------------- tok05-w381-work03-c02-paygo | resgroup-342663(1 row)
2. Get the rp_moref computehub_id value:
vcloud=# select * from vc_computehub where rp_moref ='resgroup-342663'; id | vc_id | rp_moref | service_rp_moref | is_enabled | datacenter_moref--------------------------------------+--------------------------------------+-----------------+------------------+------------+------------------ 72ccd482-2d75-4177-9371-ea4f95c157d1 | 2573a266-2246-4dc2-99db-2c667ecdb655 | resgroup-342663 | resgroup-342665 | t | datacenter-3(1 row)
3. Confirm the compute hub_id is_primary = true
vcloud=# select * from computehub_set_computehub where computehub_id ='72ccd482-2d75-4177-9371-ea4f95c157d1'; id | computehub_set_id | computehub_id | is_primary--------------------------------------+--------------------------------------+--------------------------------------+------------ 90a6dc40-3fd7-4686-b05f-6719574c7e2f | ddce2fd3-301d-448c-822c-39ba6f4cb434 | 72ccd482-2d75-4177-9371-ea4f95c157d1 | t(1 row)
4. Update the compute hub_id to is_primary = false
vcloud=# update computehub_set_computehub set is_primary = false where computehub_id='72ccd482-2d75-4177-9371-ea4f95c157d1';
5. Confirm the compute hub_id is_primary = false
vcloud=# select * from computehub_set_computehub where computehub_id ='72ccd482-2d75-4177-9371-ea4f95c157d1'; id | computehub_set_id | computehub_id | is_primary--------------------------------------+--------------------------------------+--------------------------------------+------------ 90a6dc40-3fd7-4686-b05f-6719574c7e2f | ddce2fd3-301d-448c-822c-39ba6f4cb434 | 72ccd482-2d75-4177-9371-ea4f95c157d1 | f(1 row)
Step 4: Set New Primary Resource Pool to is_primary = true
1. Get the resource pool ‘tok05-w381-work03-c01-paygo‘ rp_moref value:
vcloud=# select name,moref from resource_pool_inv where name = 'tok05-w381-work03-c01-paygo'; name | moref-----------------------------+---------------- tok05-w381-work03-c01-paygo | resgroup-23116(1 row)
2. Get the rp_moref computehub_id value:
vcloud=# select * from vc_computehub where rp_moref ='resgroup-23116'; id | vc_id | rp_moref | service_rp_moref | is_enabled | datacenter_moref--------------------------------------+--------------------------------------+----------------+------------------+------------+------------------ afe1b29f-18f1-4dfb-b941-58beae760783 | 2573a266-2246-4dc2-99db-2c667ecdb655 | resgroup-23116 | resgroup-23117 | t | datacenter-3(1 row)
3. Confirm the compute hub_id is_primary = false
vcloud=# select * from computehub_set_computehub where computehub_id ='afe1b29f-18f1-4dfb-b941-58beae760783'; id | computehub_set_id | computehub_id | is_primary--------------------------------------+--------------------------------------+--------------------------------------+------------ 79f4dd27-9de6-4a6c-b56a-6f8e257470c6 | ddce2fd3-301d-448c-822c-39ba6f4cb434 | afe1b29f-18f1-4dfb-b941-58beae760783 | f(1 row)
4. Update the compute hub_id to is_primary = true
vcloud=# update computehub_set_computehub set is_primary = true where computehub_id='afe1b29f-18f1-4dfb-b941-58beae760783';
5. Confirm the compute hub_id is_primary = true
vcloud=# select * from computehub_set_computehub where computehub_id ='afe1b29f-18f1-4dfb-b941-58beae760783'; id | computehub_set_id | computehub_id | is_primary--------------------------------------+--------------------------------------+--------------------------------------+------------ 79f4dd27-9de6-4a6c-b56a-6f8e257470c6 | ddce2fd3-301d-448c-822c-39ba6f4cb434 | afe1b29f-18f1-4dfb-b941-58beae760783 | t(1 row)
Step 5: Update the PVDC primary_rp_moref
1. From Step 2 we confirmed the current primary_rp_moref was resgroup-342663, we now want to update to the new primary_rp_moref of resgroup-23116. The id value is the provider_id obtained in Step 2.
UPDATE prov_vdc SET rp_moref = 'resgroup-23116' WHERE id = 'c4ed5e2c-64ec-447e-ae43-b6151a1d8e16';
2. Confirm the primary_rp_moref has been updated.
vcloud=# SELECT prov_vdc.id AS provider_id,prov_vdc.name AS provider_name,prov_vdc.rp_moref AS primary_rp_moref,cluster_compute_resource_inv.name AS cluster_name,computehub_set_computehub.id AS rp_csc_id,resource_pool_inv.name AS rp_name,resource_pool_inv.moref AS rp_moref,computehub_set_computehub.is_primary FROM prov_vdc INNER JOIN prov_vdc_logical_resource ON prov_vdc.id = prov_vdc_logical_resource.prov_vdc_id INNER JOIN computehub_set_computehub ON prov_vdc_logical_resource.fo_id = computehub_set_computehub.computehub_set_id INNER JOIN vc_computehub ON computehub_set_computehub.computehub_id = vc_computehub.id INNER JOIN resource_pool_inv ON vc_computehub.rp_moref = resource_pool_inv.moref INNER JOIN cluster_compute_resource_inv ON resource_pool_inv.cr_moref = cluster_compute_resource_inv.moref WHERE prov_vdc.name = 'tok05-w381-work03--paygo';-[ RECORD 1 ]----+-------------------------------------provider_id | c4ed5e2c-64ec-447e-ae43-b6151a1d8e16provider_name | tok05-w381-work03--paygoprimary_rp_moref | resgroup-23116cluster_name | tok05-w381-work03-c02rp_csc_id | 90a6dc40-3fd7-4686-b05f-6719574c7e2frp_name | tok05-w381-work03-c02-paygorp_moref | resgroup-342663is_primary | f-[ RECORD 2 ]----+-------------------------------------provider_id | c4ed5e2c-64ec-447e-ae43-b6151a1d8e16provider_name | tok05-w381-work03--paygoprimary_rp_moref | resgroup-23116cluster_name | tok05-w381-work03-c01rp_csc_id | 79f4dd27-9de6-4a6c-b56a-6f8e257470c6rp_name | tok05-w381-work03-c01-paygorp_moref | resgroup-23116is_primary | tvcloud=#
Once the database has been updated check Cloud Director UI and confirm the primary Resource Pool has changed.

The database change is quick but I did test the user experience for both transient states. That is, both resource pools not set to primary and both resource pools set to primary. I was able to deploy VMs successfully during both states.

Leave a comment