Skip to content

Conversation

@KronwarsCZ
Copy link

Added a new example to list all VM names that use a specified Datastore as a VirtualDisk or VirtualCdrom

@prziborowski
Copy link
Contributor

I have no comment about the example's functionality, but a somewhat related question.
Datastore has a vm property that is a list of VirtualMachine that should be associated with the datastore. Did you find any discrepancy where it doesn't list them?
Or is your use-case (and this example) specifically for VMs that have disks/cdroms attached to that datastore, and the vmx file/snapshots are not important?

@KronwarsCZ
Copy link
Author

On my old ESXi 6.5 server, I had an issue with a broken NFS datastore mount. The problem occurred because the NFS mount was pointing to a non-existent folder on my NAS after someone changed the folder name directly on the NAS. As a result, I couldn't retrieve any information about the datastore from ESXi, nor could I change its properties or list the VMs that were using it.

This example helped me work around this issue. It allowed me to identify which VMs were associated with the broken datastore, so I could delete it from those VMs. After doing that, I was able to completely remove the datastore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants