1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

fix key checking in dict which could be causes KeyError

This commit is contained in:
catborise 2019-10-28 10:40:33 +03:00
parent 360f212583
commit f1dbc6a199

View file

@ -528,8 +528,8 @@ class wvmInstance(wvmConnect):
mem_usage = {}
if self.get_status() == 1:
mem_stats = self.instance.memoryStats()
rss = mem_stats['rss'] if mem_stats['rss'] else 0
total = mem_stats['actual'] if mem_stats['actual'] else 0
rss = mem_stats['rss'] if 'rss' in mem_stats else 0
total = mem_stats['actual'] if 'actual' in mem_stats else 0
available = total - rss
if available < 0: available = 0