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')
This commit is contained in:
Rafal Wojtczuk 2010-08-31 15:53:24 +02:00
parent eb6755e93c
commit de2619fbed

View File

@ -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