Merge "Add compute capabilities traits"

This commit is contained in:
Zuul 2018-04-24 19:11:56 +00:00 committed by Gerrit Code Review
commit 8888c52877
4 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
TRAITS = [
# The virt driver supports associating a tag with a device *at boot time*
'DEVICE_TAGGING',
]

21
os_traits/compute/net.py Normal file
View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
TRAITS = [
# The virt driver supports attaching a network interface after boot
'ATTACH_INTERFACE',
# The virt driver supports attaching a network interface after boot and
# specifying a device tag for the interface
'ATTACH_INTERFACE_WITH_TAG',
]

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
TRAITS = [
# The virt driver supports attaching a volume after boot
'ATTACH',
# The virt driver supports attaching a volume after boot and specifying a
# device tag for the volume
'ATTACH_WITH_TAG',
# The virt driver supports extending a volume after boot
'EXTEND',
# The virt driver supports volumes that can be attached to multiple guests
'MULTI_ATTACH',
]

View File

@ -47,6 +47,16 @@ class TestSymbols(base.TestCase):
self.assertNotIn('CUSTOM_NAMESPACE', traits)
self.assertNotIn('os_traits', traits)
def test_dunderinit_and_nondunderinit(self):
"""Make sure we can have both dunderinit'd traits and submodules
co-exist in the same namespace.
"""
traits = ot.get_traits('COMPUTE')
self.assertIn("COMPUTE_DEVICE_TAGGING", traits)
self.assertIn(ot.COMPUTE_DEVICE_TAGGING, traits)
self.assertIn("COMPUTE_VOLUME_EXTEND", traits)
self.assertIn(ot.COMPUTE_NET_ATTACH_INTERFACE, traits)
def test_get_traits_filter_by_suffix(self):
traits = ot.get_traits(suffix='SSE42')
self.assertIn("HW_CPU_X86_SSE42", traits)