def test_aggregate_values_from_key_with_wrong_key(self): host_state = fakes.FakeHostState('fake', 'node', {'aggregates': _AGGREGATE_FIXTURES}) values = utils.aggregate_values_from_key(host_state, key_name='k3') self.assertEqual(set(), values)
def test_aggregate_values_from_key_with_wrong_key(self): host_state = fakes.FakeHostState( 'fake', 'node', {'aggregates': _AGGREGATE_FIXTURES}) values = utils.aggregate_values_from_key(host_state, key_name='k3') self.assertEqual(set(), values)
def host_passes(self, host_state, filter_properties): instance_type = filter_properties.get('instance_type') aggregate_vals = utils.aggregate_values_from_key( host_state, 'instance_type') if not aggregate_vals: return True return instance_type['name'] in aggregate_vals
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_max_io_ops_per_host(self, host_state, filter_properties): aggregate_vals = utils.aggregate_values_from_key( host_state, 'max_io_ops_per_host') try: value = utils.validate_num_values( aggregate_vals, CONF.max_io_ops_per_host, cast_to=int) except ValueError as e: LOG.warning(_LW("Could not decode max_io_ops_per_host: '%s'"), e) value = CONF.max_io_ops_per_host return value
def _get_max_io_ops_per_host(self, host_state, filter_properties): aggregate_vals = utils.aggregate_values_from_key( host_state, 'max_io_ops_per_host') try: value = utils.validate_num_values(aggregate_vals, CONF.max_io_ops_per_host, cast_to=int) except ValueError as e: LOG.warning(_LW("Could not decode max_io_ops_per_host: '%s'"), e) value = CONF.max_io_ops_per_host return value