Fix xm mem-max command to restore previous setting if xc.domain_setmaxmem fails.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2008-02-26 15:02:26 +00:00
1 parent 44bdf09e2c
commit 1511fb1004
1 file changed
+2
+2
View File
@@ -906,6 +906,7 @@ class XendDomainInfo:
log.debug("Setting memory maximum of domain %s (%s) to %d MiB.",
self.info['name_label'], str(self.domid), limit)
maxmem_cur = self.get_memory_static_max()
MiB = 1024 * 1024
self._safe_set_memory('memory_static_max', limit * MiB)
@@ -914,6 +915,7 @@ class XendDomainInfo:
try:
return xc.domain_setmaxmem(self.domid, maxmem)
except Exception, ex:
self._safe_set_memory('memory_static_max', maxmem_cur)
raise XendError(str(ex))
xen.xend.XendDomain.instance().managed_config_save(self)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.