Disable image validation

In before, Zun validate the container's image before lauching
the container. The goal is to have a pre-flight check before
doing an expensive operation.

However, this feature has several disadvantages:
* It blocks the zun api server on validating the image
* It relies on API call to external image registry (i.e. DockerHub),
  so it is not reliable.

This commit changes the default configuration to disable image
validation by default.

Change-Id: I67ad3fd69bc7680fb565bfc138bc0d8b77157649
This commit is contained in:
Hongbin Lu
2019-05-04 20:57:25 +00:00
parent 4b8311aa16
commit b00bba2483
2 changed files with 4 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ api_service_opts = [
default="api-paste.ini",
help="Configuration file for WSGI definition of API."),
cfg.BoolOpt('enable_image_validation',
default=True,
default=False,
help="Enable image validation.")
]

View File

@@ -45,6 +45,7 @@ class TestAPI(base.TestCase):
mock_image_search,
mock_container_create,
mock_record_action_start):
CONF.set_override('enable_image_validation', True, group="api")
container = self.container
container.status = consts.CREATING
image_meta = mock.MagicMock()
@@ -66,6 +67,7 @@ class TestAPI(base.TestCase):
def test_container_create_with_private_registry_image(
self, mock_schedule_container, mock_image_search,
mock_container_create, mock_record_action_start):
CONF.set_override('enable_image_validation', True, group="api")
container = self.container
container.image = 'myregistry.io/test-image'
container.image_driver = 'docker'
@@ -100,6 +102,7 @@ class TestAPI(base.TestCase):
def test_searching_image_exception(self, mock_save,
mock_schedule_container,
mock_image_search):
CONF.set_override('enable_image_validation', True, group="api")
container = self.container
container.status = consts.CREATING
mock_schedule_container.return_value = {'host': u'Centos',