ia64/xen-unstable

changeset 13511:683bc79cf579

Tidy up the restore path following HVM save/restore patches.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Jan 19 10:12:39 2007 +0000 (2007-01-19)
parents 5633bb2abeaf
children 2ef07c610729
files tools/python/xen/xend/XendCheckpoint.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Thu Jan 18 18:19:54 2007 -0800
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Fri Jan 19 10:12:39 2007 +0000
     1.3 @@ -175,29 +175,24 @@ def restore(xd, fd, dominfo = None, paus
     1.4      nr_pfns = (dominfo.getMemoryTarget() + 3) / 4 
     1.5  
     1.6      # if hvm, pass mem size to calculate the store_mfn
     1.7 -    hvm  = 0
     1.8 -    apic = 0
     1.9 -    pae  = 0
    1.10      image_cfg = dominfo.info.get('image', {})
    1.11 -    hvm  = image_cfg.has_key('hvm')
    1.12 -    if hvm:
    1.13 -        # the 'memory' in config has been removed
    1.14 +    is_hvm  = image_cfg.has_key('hvm')
    1.15 +    if is_hvm:
    1.16          hvm  = dominfo.info['memory_static_min']
    1.17          apic = dominfo.info['image']['hvm'].get('apic', 0)
    1.18          pae  = dominfo.info['image']['hvm'].get('pae',  0)
    1.19          log.info("restore hvm domain %d, mem=%d, apic=%d, pae=%d",
    1.20                   dominfo.domid, hvm, apic, pae)
    1.21 +    else:
    1.22 +        hvm  = 0
    1.23 +        apic = 0
    1.24 +        pae  = 0
    1.25  
    1.26      try:
    1.27 -        if hvm:
    1.28 -            l = read_exact(fd, sizeof_unsigned_int,
    1.29 -                           "not a valid hvm guest state file: pfn count read")
    1.30 -            nr_pfns = unpack("I", l)[0]    # native sizeof int
    1.31 -        else: 
    1.32 -            l = read_exact(fd, sizeof_unsigned_long,
    1.33 -                           "not a valid guest state file: pfn count read")
    1.34 +        l = read_exact(fd, sizeof_unsigned_long,
    1.35 +                       "not a valid guest state file: pfn count read")
    1.36 +        max_pfn = unpack("L", l)[0]    # native sizeof long
    1.37  
    1.38 -        max_pfn = unpack("L", l)[0]    # native sizeof long
    1.39          if max_pfn > 16*1024*1024:     # XXX 
    1.40              raise XendError(
    1.41                  "not a valid guest state file: pfn count out of range")
    1.42 @@ -208,7 +203,6 @@ def restore(xd, fd, dominfo = None, paus
    1.43                    dominfo.info['memory_static_max'],
    1.44                    dominfo.info['memory_static_min'], nr_pfns)
    1.45  
    1.46 -
    1.47          balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024)
    1.48  
    1.49          shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow)
    1.50 @@ -231,7 +225,7 @@ def restore(xd, fd, dominfo = None, paus
    1.51              dominfo.unpause()
    1.52  
    1.53           # get qemu state and create a tmp file for dm restore
    1.54 -        if hvm:
    1.55 +        if is_hvm:
    1.56              qemu_signature = read_exact(fd, len(QEMU_SIGNATURE),
    1.57                                          "invalid device model signature read")
    1.58              if qemu_signature != QEMU_SIGNATURE: