WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

Re: [Xen-devel] [PATCH]: Xend: Balloon an additional 8MB for QEMU device

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH]: Xend: Balloon an additional 8MB for QEMU device model
From: Chris Lalancette <clalance@xxxxxxxxxx>
Date: 2007年8月27日 14:45:54 -0400
Delivery-date: 2007年8月27日 11:46:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <46CF21AE.9030206@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <46CF21AE.9030206@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.5 (X11/20070719)
Chris Lalancette wrote:
> All,
> Attached is a patch to make Xend balloon down an additional 8MB (for the
> Cirrus logic video device) when doing a restore or migrate. Without this, you
> can run into the following situation:
All,
 Attached is an updated version of the patch. Dan Berrange correctly points
out that this logic already exists in xend, when an HVM domain is being created;
the logic just wasn't being used in the restore path. This patch basically
takes the logic from the creation path and pulls it into the restore path, so
things work properly.
Again, this patch is against 3.1.0, but should apply fairly easily to unstable.
Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
--- xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py.orig 2007年08月27日 
13:37:53.000000000 -0400
+++ xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py 2007年08月27日 
14:14:19.000000000 -0400
@@ -18,6 +18,7 @@ import xen.util.auxbin
 import xen.lowlevel.xc
 
 import balloon
+import image
 from XendError import XendError, VmError
 from XendLogging import log
 from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2
@@ -168,8 +169,6 @@ def restore(xd, fd, paused=False):
 assert store_port
 assert console_port
 
- nr_pfns = (dominfo.getMemoryTarget() + 3) / 4 
-
 # if hvm, pass mem size to calculate the store_mfn
 is_hvm = dominfo.is_hvm()
 if is_hvm:
@@ -183,18 +182,32 @@ def restore(xd, fd, paused=False):
 pae = 0
 
 try:
- shadow = dominfo.info['shadow_memory']
+ restore_image = image.create(dominfo, dominfo.info['image'],
+ dominfo.info['device'])
+ memory = restore_image.getRequiredAvailableMemory(
+ dominfo.info['memory'] * 1024)
+ maxmem = restore_image.getRequiredAvailableMemory(
+ dominfo.info['maxmem'] * 1024)
+ shadow = restore_image.getRequiredShadowMemory(
+ dominfo.info['shadow_memory'] * 1024,
+ dominfo.info['maxmem'] * 1024)
+
 log.debug("restore:shadow=0x%x, _static_max=0x%x, _static_min=0x%x, ",
 dominfo.info['shadow_memory'],
 dominfo.info['maxmem'],
 dominfo.info['memory'])
 
- balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024)
+ # Round shadow up to a multiple of a MiB, as shadow_mem_control
+ # takes MiB and we must not round down and end up under-providing.
+ shadow = ((shadow + 1023) / 1024) * 1024
 
- shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow)
- dominfo.info['shadow_memory'] = shadow_cur
+ # set memory limit
+ xc.domain_setmaxmem(dominfo.getDomid(), maxmem)
 
- xc.domain_setmaxmem(dominfo.getDomid(), dominfo.getMemoryMaximum())
+ balloon.free(memory + shadow)
+
+ shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow / 1024)
+ dominfo.info['shadow_memory'] = shadow_cur
 
 cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
 fd, dominfo.getDomid(),
@@ -206,7 +219,7 @@ def restore(xd, fd, paused=False):
 forkHelper(cmd, fd, handler.handler, True)
 
 # We don't want to pass this fd to any other children -- we 
- # might need to recover ths disk space that backs it.
+ # might need to recover the disk space that backs it.
 try:
 flags = fcntl.fcntl(fd, fcntl.F_GETFD)
 flags |= fcntl.FD_CLOEXEC
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: Re: [Xen-devel] PCI Passthru: fn0 exported but not fn1 , Keir Fraser
Next by Date: [Xen-devel] [PATCH][QEMU] Allow more IDE power management , Ben Guthro
Previous by Thread: [Xen-devel] [PATCH]: Xend: Balloon an additional 8MB for QEMU device model , Chris Lalancette
Next by Thread: [Xen-devel] XenSource SDK Appliance Ethernet Not Working , Jim Burnes
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /