mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Enable lazy (on-demand) allocation of memory to a guest being restored; this
means that ballooned down domains only require as much memory as is currently being used (rather than their max) when being restored from save, or when being migrated. Signed-off-by: Steven Hand <steven@xensource.com>
This commit is contained in:
1 parent
c5d238206d
commit
236c16423b
2 files changed
+137
-62
No files matched your search
@@ -147,18 +147,20 @@ def restore(xd, fd, dominfo = None, paused = False):
|
||||
assert store_port
|
||||
assert console_port
|
||||
|
||||
nr_pfns = (dominfo.getMemoryTarget() + 3) / 4
|
||||
|
||||
try:
|
||||
l = read_exact(fd, sizeof_unsigned_long,
|
||||
"not a valid guest state file: pfn count read")
|
||||
nr_pfns = unpack("L", l)[0] # native sizeof long
|
||||
if nr_pfns > 16*1024*1024: # XXX
|
||||
max_pfn = unpack("L", l)[0] # native sizeof long
|
||||
if max_pfn > 16*1024*1024: # XXX
|
||||
raise XendError(
|
||||
"not a valid guest state file: pfn count out of range")
|
||||
|
||||
balloon.free(xc.pages_to_kib(nr_pfns))
|
||||
|
||||
cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
|
||||
fd, dominfo.getDomid(), nr_pfns,
|
||||
fd, dominfo.getDomid(), max_pfn,
|
||||
store_port, console_port])
|
||||
log.debug("[xc_restore]: %s", string.join(cmd))
|
||||
|
||||
|
||||