Remove namespace check in creating traits

Remove code of checking custom namespace in trait objects.
The check logic will be implemented in api layer. This allows
command line tools can use trait object code to sync os-traits library.

Change-Id: Ia33ab4c6e7f7ca7d3ab04c854b65bd50460e31a4
Partially-Implements: blueprint resource-provider-traits
This commit is contained in:
leizhang 2017-03-29 09:16:01 +08:00
parent 4535e390f8
commit 5619caa741
2 changed files with 0 additions and 10 deletions

View File

@ -1493,11 +1493,6 @@ class Trait(base.NovaObject):
raise exception.ObjectActionError(action='create',
reason='name is required')
if not self.name.startswith(self.CUSTOM_NAMESPACE):
raise exception.ObjectActionError(
action='create',
reason='name must start with %s' % self.CUSTOM_NAMESPACE)
updates = self.obj_get_changes()
try:

View File

@ -1562,11 +1562,6 @@ class ResourceProviderTraitsTestCase(ResourceProviderBaseCase):
t = objects.Trait(self.context)
self.assertRaises(exception.ObjectActionError, t.create)
def test_trait_create_without_custom_prefix(self):
t = objects.Trait(self.context)
t.name = 'TRAIT_A'
self.assertRaises(exception.ObjectActionError, t.create)
def test_trait_create_duplicated_trait(self):
trait = objects.Trait(self.context)
trait.name = 'CUSTOM_TRAIT_A'