[Docker] Do not try to delete container on destroyed host

When Environment get deleted both Docker/k8s host and
Docker applications get deleted. So it is possible that host
will try to delete container from an Instance that was already
destroyed. Attempt to send commands to such instance
will hang until timeout because there is no more agent
exist on the other side.

Change-Id: Ia6e8064ae50c24ce595ed08e446ed45b96b4a330
Closes-Bug: #1504623
Depends-On: I298f3f079a153ef87ed7213b7f1432c9e5e4b4b6
This commit is contained in:
Stan Lagun 2015-10-10 01:41:09 +03:00 committed by Serg Melikyan
parent 4026fd9c9f
commit 0549313491
5 changed files with 17 additions and 9 deletions

View File

@ -61,7 +61,6 @@ Methods:
destroy:
Body:
- $.host.deploy()
- If: $.getAttr(container, null) != null
Then:
- $container: $.getContainer()

View File

@ -273,7 +273,7 @@ Methods:
- name:
Contract: $.string().notNull()
Body:
- If: $name in $.containers
- If: $name in $.containers and $.instance.isDeployed()
Then:
- $._environment.reporter.report($this, 'Deleting container {0}'.format($name))
- $._removeApplicationEndpoints($name)

View File

@ -63,12 +63,15 @@ Properties:
Default: []
Usage: Out
Methods:
initialize:
Body:
- $._environment: $.find(std:Environment).require()
isAvailable:
Body:
- Return: $.masterNode.isAvailable()
deploy:
Body:

View File

@ -70,3 +70,7 @@ Methods:
- $ip: coalesce($.instance.floatingIpAddress, $.getIp())
- $._environment.reporter.report($this, $msg.format($ip))
isAvailable:
Body:
Return: $.instance.isDeployed()

View File

@ -215,12 +215,14 @@ Methods:
- name:
Contract: $.string().notNull()
Body:
- $._loadCurrentPodDefinition()
- $._deleteContainer($name)
- $.kubernetesCluster.deleteServices(
applicationName => $name,
podId => $._getPodName())
- $.deploy()
- If: $.kubernetesCluster.isAvailable()
Then:
- $._loadCurrentPodDefinition()
- $._deleteContainer($name)
- $.kubernetesCluster.deleteServices(
applicationName => $name,
podId => $._getPodName())
- $.deploy()
_generateVolumeName: