vMotion and VM power-on operations are encountering a "ManagedObjectNotFound" error, indicating that the datastore "datastore-xxxx" cannot be located by the system
search cancel

vMotion and VM power-on operations are encountering a "ManagedObjectNotFound" error, indicating that the datastore "datastore-xxxx" cannot be located by the system

book

Article ID: 371925

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

The "ManagedObjectNotFound" error encountered during vMotion and VM power-on compatibility checks is a consequence of the removal of datastore "datastore-xxxx". This datastore is no longer present in the VCDB, as evidenced by the absence of entries in the vpxentity, vpxdatastore, vpxvmdsspace, and vpxds_assignment tables.

Environment

VMware vCenter Server 8.x

Cause

The "ManagedObjectNotFound" error encountered during vMotion and VM power-on tasks can arise from an improper or incomplete removal of a datastore. If the host's local swap datastore location was set to this removed datastore, the system will be unable to locate it during these operations. The error is caused by the datastore's absence from the vCenter Server database due to the incomplete removal process.

Here are the steps on how to get the HostLocalSwapDir value for an ESXi host:

Finding the ESXi Host's swap directory using vCenter Server UI:

1. Log in to the vCenter Server and navigate to the ESXi host you want to check.

2. Open the Host Configuration:

Click on the "Manage" tab.
Select "Settings".
Click on "Advanced System Settings".

3. Find the "HostLocalSwapDir" Setting:

In the "Advanced System Settings" window, navigate to the "Memory and Swap" section.
You should find the HostLocalSwapDir setting listed there.

4. View the Value: The value next to the setting will display the path to the local swap datastore for the host.

Alternative Method (Using SSH):

1. Connect to the ESXi Host via SSH: Use an SSH client like PuTTY to connect to the ESXi host using the root credentials.
2. Execute the following command:  

esxcfg-advcfg -g /UserVars/HostLocalSwapDir

 

The output will display the path to the local swap datastore.

 

Resolution

To resolve this issue, please follow the steps outlined below


1. Connect to the ESXi Host via SSH: Use an SSH client like PuTTY to connect to the ESXi host using the root credentials.

2. Execute the following command:     

vsish

3. Navigate to the Configuration Directory:

cd /config/Mem/strOpts/ 

4. Check the Host Local Swap Datastore:

cat HostLocalSwapDir

Note, The output will display the path to the local swap datastore. If this path points to the removed datastore (e.g., /vmfs/volumes/xxxxxxx-xxxxx-xxxxx-xxxxxxxxxxx), confirm that the removed datastore is the source of the error.

5. Unsetting the Local Swap Datastore:

 set HostLocalSwapDir ""

This command will remove the configuration reference to the local swap datastore.

6. Restart the Hostd Service: 

/etc/init.d/hostd restart 

 

This step ensures that the changes made to the configuration are applied and the hostd service is aware of the removed local swap datastore.

7. To verify the Change collect Host Configuration Data: 

vim-cmd hostsvc/hostconfig > /tmp/tmpfile 

This will save the host's configuration data to a file named "tmpfile" in Directory "/tmp".

Open the "tmpfile" and search for the "localSwapDatastore" setting. It should now be set to "" indicating the local swap datastore has been successfully removed from the hostd cache.