[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: destroy:
Body: Body:
- $.host.deploy()
- If: $.getAttr(container, null) != null - If: $.getAttr(container, null) != null
Then: Then:
- $container: $.getContainer() - $container: $.getContainer()

View File

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

View File

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

View File

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

View File

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