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 @@ +# -*- 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', +] 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 @@ +# -*- 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', +] 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 @@ +# -*- 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', +] 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): 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)