'Update information about a host from a ComputeNode object.'

def _update_from_compute_node(self, compute):

    if (('free_disk_gb' not in compute) or (compute.free_disk_gb is None)):
        LOG.debug('Ignoring    compute    node    %s    as    its    usage    has    not    been    updated    yet.', compute.uuid)
        return
    if (self.updated and compute.updated_at and (self.updated > compute.updated_at)):
        return
    all_ram_mb = compute.memory_mb
    self.uuid = compute.uuid
    free_gb = compute.free_disk_gb
    least_gb = compute.disk_available_least
    if (least_gb is not None):
        if (least_gb > free_gb):
            LOG.warning(_LW('Host    %(hostname)s    has    more    disk    space    than    database    expected    (%(physical)s    GB    >    %(database)s    GB)'), {'physical': least_gb, 'database': free_gb, 'hostname': compute.hypervisor_hostname})
        free_gb = min(least_gb, free_gb)
    free_disk_mb = (free_gb * 1024)
    self.disk_mb_used = (compute.local_gb_used * 1024)
    self.free_ram_mb = compute.free_ram_mb
    self.total_usable_ram_mb = all_ram_mb
    self.total_usable_disk_gb = compute.local_gb
    self.free_disk_mb = free_disk_mb
    self.vcpus_total = compute.vcpus
    self.vcpus_used = compute.vcpus_used
    self.updated = compute.updated_at
    self.numa_topology = compute.numa_topology
    self.pci_stats = pci_stats.PciDeviceStats(compute.pci_device_pools)
    self.host_ip = compute.host_ip
    self.hypervisor_type = compute.hypervisor_type
    self.hypervisor_version = compute.hypervisor_version
    self.hypervisor_hostname = compute.hypervisor_hostname
    self.cpu_info = compute.cpu_info
    if compute.supported_hv_specs:
        self.supported_instances = [spec.to_list() for spec in compute.supported_hv_specs]
    else:
        self.supported_instances = []
    self.stats = (compute.stats or {})
    self.num_instances = int(self.stats.get('num_instances', 0))
    self.num_io_ops = int(self.stats.get('io_workload', 0))
    self.metrics = objects.MonitorMetricList.from_json(compute.metrics)
    self.cpu_allocation_ratio = compute.cpu_allocation_ratio
    self.ram_allocation_ratio = compute.ram_allocation_ratio
    self.disk_allocation_ratio = compute.disk_allocation_ratio
