vmware / vmware/pyvmomi

Getting information about system

Open
#275 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs verification
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm facing some problems again.
I have something like this (part of bigger class):

self.template = self._find_vm(self.si, name)  [instance of vim.VirtualMachine]
timeout = 60
l_timeout = 0
while l_timeout <= 0:
    guest_operations = self.template.guest.guestOperationsReady
    vmtools = self.template.guestHeartbeatStatus 
    if not guest_operations and vmtools == 'red':
        return True
    else:
        time.sleep(2)
return False

Problem is that self.template.guest.guestOperationsReady and guestHeartbeatStatus is not updated 'realtime'. I can see that machine is turned off (or restarting) and guestHeartbeatStatus is still green (also guestOperationsReady returns True)
Sometimes it takes 1second to return valid values, sometimes that values are bad even after 10sec

Is there any 'cache' that is responsible for this? Maybe if you take vim.VirtualMachine instance all properties are queried in a single request and cached continuously?

So far I can find only one way how to reload this properties. This way is to 'reload' full vim.VirtualMachine object and than it looks ok.

Question is if it this is a right way to do it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown accesses to guestOperationsReady and guestHeartbeatStatus, and inspect how pyVmomi retrieves and refreshes VirtualMachine properties. Determine whether the stale values are expected caching or require an explicit refresh, then document the supported way to obtain current values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.