def _get_cpu_allocation_ratio(self, host_state, filter_properties): aggregate_vals = utils.aggregate_values_from_key( host_state, 'cpu_allocation_ratio') try: ratio = utils.validate_num_values( aggregate_vals, CONF.cpu_allocation_ratio, cast_to=float) except ValueError as e: LOG.warning(_LW("Could not decode cpu_allocation_ratio: '%s'"), e) ratio = CONF.cpu_allocation_ratio return ratio
def _get_disk_allocation_ratio(self, host_state, filter_properties): aggregate_vals = utils.aggregate_values_from_key( host_state, 'disk_allocation_ratio') try: ratio = utils.validate_num_values( aggregate_vals, CONF.disk_allocation_ratio, cast_to=float) except ValueError as e: LOG.warning(_LW("Could not decode disk_allocation_ratio: '%s'"), e) ratio = CONF.disk_allocation_ratio return ratio
def _get_max_instances_per_host(self, host_state, filter_properties): aggregate_vals = utils.aggregate_values_from_key( host_state, 'max_instances_per_host') try: value = utils.validate_num_values( aggregate_vals, CONF.max_instances_per_host, cast_to=int) except ValueError as e: LOG.warning(_LW("Could not decode max_instances_per_host: '%s'"), e) value = CONF.max_instances_per_host return value