def _weigh_object(self, host_state, weight_properties):
        value = 0.0

        # NOTE(sbauza): Keying a dict of Metrics per metric name given that we
        # have a MonitorMetricList object
        metrics_dict = {m.name: m for m in host_state.metrics or []}
        for (name, ratio) in self.setting:
            try:
                value += metrics_dict[name].value * ratio
            except __HOLE__:
                if CONF.metrics.required:
                    raise exception.ComputeHostMetricNotFound(
                            host=host_state.host,
                            node=host_state.nodename,
                            name=name)
                else:
                    # We treat the unavailable metric as the most negative
                    # factor, i.e. set the value to make this obj would be
                    # at the end of the ordered weighed obj list
                    # Do nothing if ratio or weight_multiplier is 0.
                    if ratio * self.weight_multiplier() != 0:
                        return CONF.metrics.weight_of_unavailable

        return value
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/scheduler/weights/metrics.py/MetricsWeigher._weigh_object