Allow duplicated container name by default

In before, the default config disallow duplicated name within
tenant. This is a bad default because zun auto-generate container
name if it is not specified. It is possible that the same name
is generated twice which causes failure. This makes our API
unpredictable which is not a good practice. Therefore, we changed
the default to allow duplicated name.

Change-Id: Ic0f4d1279c0822aceac9e1983dc500afe9834a59
This commit is contained in:
Hongbin Lu 2017-11-20 03:04:13 +00:00
parent d63ba1629f
commit d028804117
2 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,7 @@ service_opts = [
db_opts = [
cfg.StrOpt(
'unique_container_name_scope',
default='project',
default='',
choices=['', 'project', 'global'],
help="""
Sets the scope of the check for unique container names.

View File

@ -200,6 +200,8 @@ class DbContainerTestCase(base.DbTestCase):
self.assertEqual(new_image, res.image)
def test_update_container_with_the_same_name(self):
CONF.set_override("unique_container_name_scope", "project",
group="compute")
container1 = utils.create_test_container(
name='container-one',
uuid=uuidutils.generate_uuid(),
@ -412,6 +414,8 @@ class EtcdDbContainerTestCase(base.DbTestCase):
@mock.patch.object(etcd_client, 'update')
def test_update_container_with_the_same_name(self, mock_update,
mock_write, mock_read):
CONF.set_override("unique_container_name_scope", "project",
group="compute")
mock_read.side_effect = etcd.EtcdKeyNotFound
container1 = utils.create_test_container(
name='container-one',