To work around this issue, use one of these options:
Option 1: Rename the VM Namespace object using objtool from ESXi CLI:
- Unregister virtual machine from the vCenter Server.
- Connect to ESXi host via SSH and navigate to the vSAN datastore:
For Example: $ cd /vmfs/volumes/vsan:526a4992690a4ca5-3bc96c7f056d7fd1 - List the contents of the datastore and take note of Namespace UUID of the virtual machine.
$ ls -l
lrwxr-xr-x 1 root root 36 <DATE><time> TestVM -> cf9b6e55-422c-23ba-c7da-b8ca3af6a80e
</time>Note: In the above example, the Namespace uuid is cf9b6e55-422c-23ba-c7da-b8ca3af6a80e. - Run the below command to create a new folder with the Namespace UUID.
For the above example, run:
$ /usr/lib/vmware/osfs/bin/objtool setAttr -u cf9b6e55-422c-23ba-c7da-b8ca3af6a80e -n "NewTestVM"
Object set attribute succeeded - The old virtual machine folder (TestVM) would now be renamed to NewTestVM
Note:
Replace the Namespace UUID with the one in your setup.
There might be a delay of few minutes in reflecting this change. To refresh immediately restart the vSAN OSFSD service from SSH by running the command /etc/init.d/osfsd restart - Register the virtual machine from the new folder using Datastore Browser.
Option 2: Rename VM folder using Datastore Browser
- Power-Off the virtual machine.
- Un-register the virtual machine from vCenter Server Inventory.
- Create a new directory on the vSAN Datastore with the name virtual machine has to be renamed.
- Move or copy the virtual machine files to the new directory using the Datastore browser.
- Re-register the virtual machine using the VMX file in the new virtual machine folder.
Option 3: Rename VM folder using Storage vMotion
Note: This option can be used if no downtime is available for the virtual machine.