[XEND] Check for invalid memory sizes.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
atse@norwich.uk.xensource.com committed 2006-09-22 15:36:11 +01:00
1 parent 1681108c98
commit 8554ba8909
1 file changed
+5
+5
View File
@@ -596,6 +596,8 @@ class XendDomainInfo:
if self.info['memory'] == 0:
if self.infoIsSet('mem_kb'):
self.info['memory'] = (self.info['mem_kb'] + 1023) / 1024
if self.info['memory'] <= 0:
raise VmError('Invalid memory size')
if self.info['maxmem'] < self.info['memory']:
self.info['maxmem'] = self.info['memory']
@@ -1001,6 +1003,9 @@ class XendDomainInfo:
"""Set the memory target of this domain.
@param target In MiB.
"""
if target <= 0:
raise XendError('Invalid memory size')
log.debug("Setting memory target of domain %s (%d) to %d MiB.",
self.info['name'], self.domid, target)
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.