code: def check_and_update_frozen_vm_configs_in_provider_section(
      config, head_node_config, worker_node_configs
  ):
      provider_config = config["provider"]
  
      vsphere_config = provider_config["vsphere_config"]
  
      # If only 'name' is specified, the code will try to fetch a frozen VM
      # with that name and bring up all the nodes from it.
  
      # If 'name' and 'library_item' are specified, the code will create a
      # frozen VM with that name and bring up all the nodes from it.
  
      # If 'resource_pool' is specified, the code will try to fetch one VM
      # out of a group of VMs present in the resource_pool specified.
  
      # If 'name', 'library_item' 'resource_pool' and 'cluster' are specified,
      # the code will create VMs on each host of the cluster that's specified.
      # Each frozen VM name will start with value in the 'name' field. All the
      # frozen VMs will be moved into the 'resource_pool' specified.
  
      validate_frozen_vm_configs(vsphere_config["frozen_vm"])
  
      head_node_config["frozen_vm"] = vsphere_config["frozen_vm"]
  
      for worker_node_config in worker_node_configs:
          worker_node_config["frozen_vm"] = {}
  
          # Copy the fields from head node config to worker node config.
          # We don't copy the library_item field into the worker node config as it'll
          # trigger creation of frozen VM(s) again when the code executes on the head
          # node.
          # The copied fields will later be used when the code executes on the head
          # node. The fields will determine the frozen VMs to be used for creating
          # worker nodes.
          worker_frozen_vm_cfg = worker_node_config["frozen_vm"]
          if "name" in head_node_config["frozen_vm"]:
              worker_frozen_vm_cfg["name"] = head_node_config[
                  "frozen_vm"
              ]["name"]
  
          if "resource_pool" in head_node_config["frozen_vm"]:
              worker_frozen_vm_cfg["resource_pool"] = head_node_config[
                  "frozen_vm"
              ]["resource_pool"]
  
file_path: ray/python/ray/autoscaler/_private/vsphere/config.py
imports: import copy
  import logging
  import os
  from ray.autoscaler._private.event_system import CreateClusterEvent, global_event_system
  from ray.autoscaler._private.util import check_legacy_fields
label_desc: Use image node_id 4 for calling a global function with example usage: check_and_update_frozen_vm_configs_in_provider_section(config, head_node_config, worker_node_configs) without return types