bitkeeper revision 1.1159.1.118 (41370c33N7_5pjKepga6V4ZmyTSNnQ)

Add support for maxmem in xm create and config.
This commit is contained in:
mjw@wray-m-3.hpl.hp.com committed 2004-09-02 12:04:03 +00:00
1 parent d10482f82b
commit 6e017f7ed5
3 files changed
+34 -1

No files matched your search

+27 -1
View File
@@ -831,6 +831,14 @@ class XendDomainInfo:
self.config.remove(['device', dev_config])
dev.destroy()
def configure_memory(self):
"""Configure vm memory limit.
"""
maxmem = sxp.get_child_value(self.config, "maxmem")
if maxmem is None:
maxmem = self.memory
xc.domain_setmaxmem(self.dom, maxmem_kb = maxmem * 1024)
def configure_console(self):
"""Configure the vm console port.
"""
@@ -1140,11 +1148,28 @@ def vm_field_ignore(vm, config, val, index):
@param vm: virtual machine
@param config: vm config
@param val: vfr field
@param val: config field
@param index: field index
"""
pass
def vm_field_maxmem(vm, config, val, index):
"""Configure vm memory limit.
@param vm: virtual machine
@param config: vm config
@param val: config field
@param index: field index
"""
maxmem = sxp.child0(val)
if maxmem is None:
maxmem = vm.memory
try:
maxmem = int(maxmem)
except:
raise VmError("invalid maxmem: " + str(maxmem))
xc.domain_setmaxmem(vm.dom, maxmem_kb = maxmem * 1024)
# Register image handlers.
add_image_handler('linux', vm_image_linux)
add_image_handler('netbsd', vm_image_netbsd)
@@ -1165,3 +1190,4 @@ add_config_handler('device', vm_field_ignore)
add_config_handler('backend', vm_field_ignore)
# Register other config handlers.
add_config_handler('maxmem', vm_field_maxmem)
+6
View File
@@ -99,6 +99,10 @@ gopts.var('memory', val='MEMORY',
fn=set_int, default=128,
use="Domain memory in MB.")
gopts.var('maxmem', val='MEMORY',
fn=set_int, default=None,
use="Maximum domain memory in MB.")
gopts.var('cpu', val='CPU',
fn=set_int, default=None,
use="CPU to run the domain on.")
@@ -310,6 +314,8 @@ def make_config(vals):
config = ['vm',
['name', vals.name ],
['memory', vals.memory ]]
if vals.maxmem:
config.append(['maxmem', vals.maxmem])
if vals.cpu is not None:
config.append(['cpu', vals.cpu])
if vals.cpu_weight is not None:
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.