summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os_traits/compute/__init__.py18
-rw-r--r--os_traits/compute/net.py21
-rw-r--r--os_traits/compute/volume.py25
-rw-r--r--os_traits/tests/test_os_traits.py10
4 files changed, 74 insertions, 0 deletions
diff --git a/os_traits/compute/__init__.py b/os_traits/compute/__init__.py
new file mode 100644
index 0000000..8a3f3f3
--- /dev/null
+++ b/os_traits/compute/__init__.py
@@ -0,0 +1,18 @@
1# -*- coding: utf-8 -*-
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15TRAITS = [
16 # The virt driver supports associating a tag with a device *at boot time*
17 'DEVICE_TAGGING',
18]
diff --git a/os_traits/compute/net.py b/os_traits/compute/net.py
new file mode 100644
index 0000000..ac7fbfb
--- /dev/null
+++ b/os_traits/compute/net.py
@@ -0,0 +1,21 @@
1# -*- coding: utf-8 -*-
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15TRAITS = [
16 # The virt driver supports attaching a network interface after boot
17 'ATTACH_INTERFACE',
18 # The virt driver supports attaching a network interface after boot and
19 # specifying a device tag for the interface
20 'ATTACH_INTERFACE_WITH_TAG',
21]
diff --git a/os_traits/compute/volume.py b/os_traits/compute/volume.py
new file mode 100644
index 0000000..5316902
--- /dev/null
+++ b/os_traits/compute/volume.py
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15TRAITS = [
16 # The virt driver supports attaching a volume after boot
17 'ATTACH',
18 # The virt driver supports attaching a volume after boot and specifying a
19 # device tag for the volume
20 'ATTACH_WITH_TAG',
21 # The virt driver supports extending a volume after boot
22 'EXTEND',
23 # The virt driver supports volumes that can be attached to multiple guests
24 'MULTI_ATTACH',
25]
diff --git a/os_traits/tests/test_os_traits.py b/os_traits/tests/test_os_traits.py
index 668df55..6b83caf 100644
--- a/os_traits/tests/test_os_traits.py
+++ b/os_traits/tests/test_os_traits.py
@@ -47,6 +47,16 @@ class TestSymbols(base.TestCase):
47 self.assertNotIn('CUSTOM_NAMESPACE', traits) 47 self.assertNotIn('CUSTOM_NAMESPACE', traits)
48 self.assertNotIn('os_traits', traits) 48 self.assertNotIn('os_traits', traits)
49 49
50 def test_dunderinit_and_nondunderinit(self):
51 """Make sure we can have both dunderinit'd traits and submodules
52 co-exist in the same namespace.
53 """
54 traits = ot.get_traits('COMPUTE')
55 self.assertIn("COMPUTE_DEVICE_TAGGING", traits)
56 self.assertIn(ot.COMPUTE_DEVICE_TAGGING, traits)
57 self.assertIn("COMPUTE_VOLUME_EXTEND", traits)
58 self.assertIn(ot.COMPUTE_NET_ATTACH_INTERFACE, traits)
59
50 def test_get_traits_filter_by_suffix(self): 60 def test_get_traits_filter_by_suffix(self):
51 traits = ot.get_traits(suffix='SSE42') 61 traits = ot.get_traits(suffix='SSE42')
52 self.assertIn("HW_CPU_X86_SSE42", traits) 62 self.assertIn("HW_CPU_X86_SSE42", traits)