From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH 9 of 9] tools: notify restore to hangup during migration --abort_if_busy Date: Thu, 28 Mar 2013 15:43:36 +0100 Message-ID: <756d175cefa9885112b6.1364481816@probook.site> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Olaf Hering # Date 1364481743 -3600 # Node ID 756d175cefa9885112b6d1337d1e855a223d94a9 # Parent 4bf71e887b838dd643399b8b8a65406d5f8eb94f tools: notify restore to hangup during migration --abort_if_busy If a guest is too busy to finish migration, the remote side is not notified and as a result an imcomplete, paused guest will remain on the remote side. Add a new flag to notify the receiver about the aborted migration so that both sides can cleanup properly. Signed-off-by: Olaf Hering diff -r 4bf71e887b83 -r 756d175cefa9 tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -983,6 +983,10 @@ static int pagebuf_get_one(xc_interface DPRINTF("read generation id buffer address"); return pagebuf_get_one(xch, ctx, buf, fd, dom); + case XC_SAVE_ID_BUSY_ABORT: + ERROR("Source host requested cancelation, guest is busy."); + errno = EBUSY; + return -1; default: if ( (count > MAX_BATCH_SIZE) || (count < 0) ) { ERROR("Max batch size exceeded (%d). Giving up.", count); diff -r 4bf71e887b83 -r 756d175cefa9 tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1537,9 +1537,11 @@ int xc_domain_save(xc_interface *xch, in { if ( !min_reached && abort_if_busy ) { + unsigned int cmd = XC_SAVE_ID_BUSY_ABORT; ERROR("Live migration aborted, as requested. (guest too busy?)" " total_sent %lu iter %d, max_iters %u max_factor %u", total_sent, iter, max_iters, max_factor); + wrexact(io_fd, &cmd, sizeof(cmd)); print_stats(xch, dom, sent_this_iter, &time_stats, &shadow_stats, 1); rc = 1; goto out; diff -r 4bf71e887b83 -r 756d175cefa9 tools/libxc/xg_save_restore.h --- a/tools/libxc/xg_save_restore.h +++ b/tools/libxc/xg_save_restore.h @@ -259,6 +259,7 @@ #define XC_SAVE_ID_HVM_ACCESS_RING_PFN -16 #define XC_SAVE_ID_HVM_SHARING_RING_PFN -17 #define XC_SAVE_ID_TOOLSTACK -18 /* Optional toolstack specific info */ +#define XC_SAVE_ID_BUSY_ABORT -19 /* Source requested cancelation */ /* ** We process save/restore/migrate in batches of pages; the below