From de2619fbedaf7f76aa64bb5d8f3d0c576ce18eee Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Tue, 31 Aug 2010 15:53:24 +0200 Subject: [PATCH] qmemman: wrap xenapi.memset within try/except It can fail e.g. when a domain is being shutdown with a pretty message like File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomainInfo.py", line 1322, in setMemoryTarget (target * 1024)) Error: (1, 'Operation not permitted') --- dom0/qmemman/qmemman.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dom0/qmemman/qmemman.py b/dom0/qmemman/qmemman.py index 55e75e73..915e61f3 100755 --- a/dom0/qmemman/qmemman.py +++ b/dom0/qmemman/qmemman.py @@ -105,8 +105,12 @@ class SystemState: def mem_set(self, id, val): uuid = self.domdict[id].uuid print 'mem-set domain', id, 'to', val - self.xend_session.session.xenapi.VM.set_memory_dynamic_max_live(uuid, val) - self.xend_session.session.xenapi.VM.set_memory_dynamic_min_live(uuid, val) + try: + self.xend_session.session.xenapi.VM.set_memory_dynamic_max_live(uuid, val) + self.xend_session.session.xenapi.VM.set_memory_dynamic_min_live(uuid, val) +#can happen in the middle of domain shutdown + except XenAPI.Failure: + pass def do_balloon(self, memsize): MAX_TRIES = 20