コード例 #1
0
    def test_different_host(self, _mock_novaclient):
        _mock_novaclient.return_value = fakes.FakeNovaClient()
        filt_cls = self.class_map['InstanceLocalityFilter']()
        host = fakes.FakeHostState('host1', {})
        uuid = nova.novaclient().servers.create('host2')

        filter_properties = {
            'context': self.context,
            'scheduler_hints': {
                'local_to_instance': uuid
            }
        }
        self.assertFalse(filt_cls.host_passes(host, filter_properties))
コード例 #2
0
    def test_nova_no_extended_server_attributes(self, _mock_novaclient):
        _mock_novaclient.return_value = fakes.FakeNovaClient(
            ext_srv_attr=False)
        filt_cls = self.class_map['InstanceLocalityFilter']()
        host = fakes.FakeHostState('host1', {})
        uuid = nova.novaclient().servers.create('host1')

        filter_properties = {
            'context': self.context,
            'scheduler_hints': {
                'local_to_instance': uuid
            }
        }
        self.assertRaises(exception.CinderException, filt_cls.host_passes,
                          host, filter_properties)