What if you Accidentally deleted the VSM, and now are left with the DVS still showing in vCenter
Nexus 1000v & Any version of vCenter
Conditions / Environment
The DVS must be gracefully removed from the VSM before deleting it. w.
Deploy a temporary VSM
Restore the startup config (or at least restore the previous switchname)
You can use the command “vmware vc extension-key <extension-id>” to have a new CP connect to the existing DVS.
The extension id here in this command should be the same one that is tied down to the DVS. You can find the key using the one of two ways:
In vCenter navigate to the Networking View
Select the DVS in the Left navigation pane.
Click on the Summary tab on the right.
The Extension key is listed under Annotations
Go to the VC’s mob by pointing your browser to it [ https://<VC_IP_ADDR>/mob%5D
Go to rootFolder ‘group-d1’
Find your datacenter from ‘childEntity’ containing Datacenter-IDs [When you click on a datacenter, you will find a name associated with it]
From your datacenter, go to networkFolder [Eg: group-n6]
From the network folder select the child entity [Eg:group-n373]
In the ‘childEntity’ click on your dvs [eg: dvs-7]
Under the DVS “config” attribute, you can find the extension key in use
Assign the extension key id to the VSM using “vmware vc extension-key <extension-id>”.
Once you key in this extension key, verify the new extension key on the CP using “show vmware vc extension-key”.
Save and reboot the VSM.
Delete the extension key present on the VC using MOB. (Unregister extension API):
Goto the extension manager [https://<VC_IP_ADDR>/mob/?moid=ExtensionManager]
Click on Unregister extension [https://<VC_IP_ADDR>/mob/?moid=ExtensionManager&method=unregisterExtension]
Paste “Cisco_Nexus_1000V_<DVS TO RECOVER’s KEY>” (your extension key attached to the DVS) and click on “Invoke Method”
8. Now you are ready to re-register the extension. If you are getting the .xml file through the browser, make sure you refresh the browser before downloading the XML file
9. Re-register the extension plugin
10. Setup the SVS connection properties (VC IP, Port, Datacenter name etc)
11. ‘Connect’ for your svs connection
12. Last but not least, gracefully remove the DVS using “no vmware dvs” from the SVS context on the VSM.
Once you verify the DVS removes from vCenter, you can delete the temporary VSM safely.
Happy Learning 😉