VMware Cloud Community
tomas_strand
Enthusiast
Enthusiast
Jump to solution

PK_VPX_DVPORT_MEMBERSHIP duplicate key (KB2092070)

I have just had the pleasure of running into this bug when replacing a ESXi host in our vsphere cluster.

VMware KB: Failures or crashes when trying to make changes to vDS membership after upgrade from vCen...

There is no fix but a workaround. And thats all fine... except there is no description for a workaround if you are running VCSA...

Have anyone else had this problem with VCSA? and maybe now if there's a fix... workaround.. anything.

Thanks

/Tomas

Tags (3)
1 Solution

Accepted Solutions
tomas_strand
Enthusiast
Enthusiast
Jump to solution

To answer my own question.

enable SSH access to your VCSA.

login in as root

Stop vxpd service

service vmware-vpxd stop

A good thing is also to take a backup of your database.

VMware KB: Backing up and restoring the vCenter Server Appliance vPostgres database

Connect to postgresql

/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

Run:

select id,name,port_counter FROM VPX_DVS;

That gives you an output of the distributed switches

VCDB=# select id,name,port_counter FROM VPX_DVS;

id |         name          | port_counter

----+-----------------------+--------------

47 | blabla-dvs-storage01 |            2

32 | blabla-dvs-mics01    |          266

50 | blabla-dvs-storage02 |            0


Next run select om the ID's of the switches

select * from VPX_DVPORT_MEMBERSHIP WHERE DVS_ID=<switchID>;

Take a note of the highest number you can find in the DVPORT_KEY column

Do the same for the rest of the dvswitches ID's.

Update the port_counter table with the correct value.

UPDATE VPX_DVS SET port_counter=<insert the highest number you got earlier+1. ex. If you got 18 then 19 would be the correct value here) WHERE id=<switchID>;

To the same for the rest of the distributed switches.

quit postgresql

/q

Start vxpd service.

service vmware-vpxd start








View solution in original post

0 Kudos
1 Reply
tomas_strand
Enthusiast
Enthusiast
Jump to solution

To answer my own question.

enable SSH access to your VCSA.

login in as root

Stop vxpd service

service vmware-vpxd stop

A good thing is also to take a backup of your database.

VMware KB: Backing up and restoring the vCenter Server Appliance vPostgres database

Connect to postgresql

/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

Run:

select id,name,port_counter FROM VPX_DVS;

That gives you an output of the distributed switches

VCDB=# select id,name,port_counter FROM VPX_DVS;

id |         name          | port_counter

----+-----------------------+--------------

47 | blabla-dvs-storage01 |            2

32 | blabla-dvs-mics01    |          266

50 | blabla-dvs-storage02 |            0


Next run select om the ID's of the switches

select * from VPX_DVPORT_MEMBERSHIP WHERE DVS_ID=<switchID>;

Take a note of the highest number you can find in the DVPORT_KEY column

Do the same for the rest of the dvswitches ID's.

Update the port_counter table with the correct value.

UPDATE VPX_DVS SET port_counter=<insert the highest number you got earlier+1. ex. If you got 18 then 19 would be the correct value here) WHERE id=<switchID>;

To the same for the rest of the distributed switches.

quit postgresql

/q

Start vxpd service.

service vmware-vpxd start








0 Kudos