Merge "Skip populating container's state on tasks"
This commit is contained in:
commit
7992b9e6ff
|
@ -633,6 +633,11 @@ class DockerDriver(driver.ContainerDriver):
|
|||
container.runtime = hostconfig.get('Runtime')
|
||||
|
||||
def _populate_container_state(self, container, state):
|
||||
if container.task_state:
|
||||
# NOTE(hongbin): we don't want to populate container state
|
||||
# if another thread is doing task on this container.
|
||||
return
|
||||
|
||||
if not state:
|
||||
LOG.warning('Receive unexpected state from docker: %s', state)
|
||||
container.status = consts.UNKNOWN
|
||||
|
|
|
@ -553,7 +553,7 @@ class TestDockerDriver(base.DriverTestCase):
|
|||
self.mock_docker.inspect_container = mock.Mock(
|
||||
return_value={'State': 'created',
|
||||
'Config': {'Cmd': ['fake_command']}})
|
||||
mock_container = mock.MagicMock()
|
||||
mock_container = mock.MagicMock(task_state=None)
|
||||
mock_container.status = consts.CREATING
|
||||
self.driver.show(self.context, mock_container)
|
||||
self.mock_docker.inspect_container.assert_called_once_with(
|
||||
|
@ -598,8 +598,8 @@ class TestDockerDriver(base.DriverTestCase):
|
|||
'FinishedAt': '0001-01-01T00:00:00Z',
|
||||
}}
|
||||
)
|
||||
mock_container = mock.MagicMock()
|
||||
mock_container.status = 'existed'
|
||||
mock_container = mock.MagicMock(task_state=None)
|
||||
mock_container.status = 'Created'
|
||||
mock_container.Error = 'Container start error.'
|
||||
self.driver.show(self.context, mock_container)
|
||||
self.mock_docker.inspect_container.assert_called_once_with(
|
||||
|
@ -615,8 +615,8 @@ class TestDockerDriver(base.DriverTestCase):
|
|||
'FinishedAt': '0001-01-01T00:00:00Z',
|
||||
}}
|
||||
)
|
||||
mock_container = mock.MagicMock()
|
||||
mock_container.status = 'UNKNOWN'
|
||||
mock_container = mock.MagicMock(task_state=None)
|
||||
mock_container.status = 'Running'
|
||||
mock_container.Error = 'Container run error.'
|
||||
self.driver.show(self.context, mock_container)
|
||||
self.mock_docker.inspect_container.assert_called_once_with(
|
||||
|
|
Loading…
Reference in New Issue