diff -Naur xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py xen-unstable-shadowfix.hg/tools/xm-test/lib/XmTestLib/XenDomain.py --- xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py 2006-08-31 14:05:58.000000000 -0500 +++ xen-unstable-shadowfix.hg/tools/xm-test/lib/XmTestLib/XenDomain.py 2006-08-31 14:38:45.000000000 -0500 @@ -74,6 +74,7 @@ } HVMDefaults = {"memory" : 64, "vcpus" : 1, + "shadow_memory": 8, "acpi" : 0, "apic" : 0, "disk" : ["file:%s/disk.img,ioemu:%s,w!" % @@ -169,6 +170,18 @@ else: self.opts = self.defaultOpts + def computeShadowMem(self): + """Shadow Memory checking/assignment (for HVM domains only). + 8MB by default. Minimum requirements for it is 2KB per every + 1MB of RAM assigned to guest domain, plus a few more MB per vcpu. + 8MB showld be enough but if vcpus is > 3, give 2MB more per vcpu.""" + + vcpus = self.getOpt("vcpus") + mem = self.getOpt("shadow_memory") + newmem = int(mem) + int(vcpus) * 2 + + return newmem + class DomainError(Exception): def __init__(self, msg, extra="", errorcode=0): self.msg = msg @@ -329,7 +342,6 @@ return dev print "Device %s not found for domain %s" % (id, self.getName()) - class XmTestDomain(XenDomain): def __init__(self, name=None, extraConfig=None, baseConfig=configDefaults): @@ -343,6 +355,10 @@ if extraConfig: config.setOpts(extraConfig) + # if HVM enabled then check shadow memory + if ( ENABLE_HVM_SUPPORT ) and ( int(config.getOpt("vcpus")) > 3): + config.setOpt("shadow_memory",config.computeShadowMem()) + if name: config.setOpt("name", name) elif not config.getOpt("name"):