Skip to content

Commit

Permalink
Merge "Add compute capabilities traits"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Apr 24, 2018
2 parents 16e87f2 + 56531c2 commit 8888c52
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
18 changes: 18 additions & 0 deletions os_traits/compute/__init__.py
@@ -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 changes: 21 additions & 0 deletions os_traits/compute/net.py
@@ -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',
]
25 changes: 25 additions & 0 deletions os_traits/compute/volume.py
@@ -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',
]
10 changes: 10 additions & 0 deletions os_traits/tests/test_os_traits.py
Expand Up @@ -47,6 +47,16 @@ def test_get_traits_filter_by_prefix(self):
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)
Expand Down

0 comments on commit 8888c52

Please sign in to comment.