Skip to content

Commit

Permalink
[cluster launcher] [vSphere] Do not fetch runtime-info of vm from cac…
Browse files Browse the repository at this point in the history
…hed_nodes (ray-project#40655)

Power-on-off status is runtime info of VM, should not fetch it from cached-nodes, which is probably dirty data.
It should query by pyvmomi_sdk every time.

Signed-off-by: Chen Hui <[email protected]>
  • Loading branch information
huchen2021 authored Oct 25, 2023
1 parent 45c7410 commit 7f98a20
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/ray/autoscaler/_private/vsphere/node_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ def non_terminated_nodes(self, tag_filters):
return nodes

def is_running(self, node_id):
node = self._get_cached_node(node_id)
return node.power_state in {HardPower.State.POWERED_ON}
vm = self.pyvmomi_sdk_provider.get_pyvmomi_obj(
[vim.VirtualMachine], obj_id=node_id
)
return vm.runtime.powerState != vim.VirtualMachinePowerState.poweredOn

def is_terminated(self, node_id):
node = self._get_cached_node(node_id)
return node.power_state not in {HardPower.State.POWERED_ON}
vm = self.pyvmomi_sdk_provider.get_pyvmomi_obj(
[vim.VirtualMachine], obj_id=node_id
)
return vm.runtime.powerState != vim.VirtualMachinePowerState.poweredOn

def node_tags(self, node_id):
with self.tag_cache_lock:
Expand Down

0 comments on commit 7f98a20

Please sign in to comment.