Fix swarm monitor exception

In docker 1.8 (atomic-6) image, docker inspect returns Memory information
in 'HostConfig section', this patch will adopt that changes.

Depend on: I009d8034335f54063a51b8d1395ddc6891a12346
Change-Id: I63ee2393c106d59286f49f88c85c6cba0a57ae15
Closes-Bug: #1504715
This commit is contained in:
Eli Qiao 2015-10-10 11:24:43 +08:00 committed by Hongbin Lu
parent bc0c1a4644
commit c818df26c0
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ class SwarmMonitor(MonitorBase):
mem_total += node['MemTotal']
mem_reserved = 0
for container in self.data['containers']:
mem_reserved += container['Config']['Memory']
mem_reserved += container['HostConfig']['Memory']
if mem_total == 0:
return 0

View File

@ -120,7 +120,7 @@ class MonitorsTestCase(base.TestCase):
'containers': [
{
'Name': 'container',
'Config': {
'HostConfig': {
'Memory': 10,
},
},