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 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: Receive error message of migration

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Receive error message of migration from destination server
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Sep 2009 02:00:31 -0700
Delivery-date: Tue, 15 Sep 2009 02:01:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1253002847 -3600
# Node ID 045b2b8b522708093b91f883f1b7e7c1805f71e3
# Parent  848193b1ec26ccee37ffc7f953dce0ded04f90e0
xend: Receive error message of migration from destination server

The following error message was shown by xm migrate command.
In fact, I caused the command error by intention.  I prepared a
destination server where free memory was insufficient, and then
I tried to migrate a VM to the destination server.  As I had
expected, the command error occurred.  However the error message
was different from my expectation.  I would like to show an error
message from the destination server if an error occurred on the
destination server.

# xm migrate --live vm3 bx339
Error: (107, 'Transport endpoint is not connected')
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.

If a destination server sends an error message, this patch shows=20
the error message.  For example, the following error message is=20
shown if free memory of the destination server is insufficient.

# xm migrate --live vm3 bx339
Error: I need 262144 KiB, but dom0_min_mem is 716800 and shrinking
to=20
716800 KiB would leave only 50368 KiB free. (from bx339)
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py |   73 +++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 6 deletions(-)

diff -r 848193b1ec26 -r 045b2b8b5227 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue Sep 15 09:19:23 2009 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Tue Sep 15 09:20:47 2009 +0100
@@ -28,6 +28,7 @@ import socket
 import socket
 import tempfile
 import threading
+import re
 
 import xen.lowlevel.xc
 
@@ -1350,10 +1351,40 @@ class XendDomain:
                              args=(sock, p2cread)).start()
 
             try:
-                XendCheckpoint.save(p2cwrite, dominfo, True, live, dst,
-                                    node=node)
+                try:
+                    XendCheckpoint.save(p2cwrite, dominfo, True, live, dst,
+                                        node=node)
+                except Exception, ex:
+                    m_dsterr = None
+                    try:
+                        sock.settimeout(3.0)
+                        dsterr = sock.recv(1024)
+                        sock.settimeout(None)
+                        if dsterr:
+                            # See send_error@xxxxxxxxxxxx If an error occurred
+                            # in a destination side, an error message with the
+                            # following form is returned from the destination
+                            # side.
+                            m_dsterr = \
+                                
re.match(r"^\(err\s\(type\s(.+)\)\s\(value\s'(.+)'\)\)", dsterr)
+                    except:
+                        # Probably socket.timeout exception occurred.
+                        # Ignore the exception because it has nothing to do 
with
+                        # an exception of XendCheckpoint.save.
+                        pass
+
+                    if m_dsterr:
+                        raise XendError("%s (from %s)" % (m_dsterr.group(2), 
dst))
+                    raise
             finally:
-                sock.shutdown(2)
+                try:
+                    sock.shutdown(2)
+                except:
+                    # Probably the socket is already disconnected by sock.close
+                    # in the destination side.
+                    # Ignore the exception because it has nothing to do with
+                    # an exception of XendCheckpoint.save.
+                    pass
                 sock.close()
 
             os.close(p2cread)
@@ -1376,10 +1407,40 @@ class XendDomain:
                 raise XendError("can't connect: %s" % err)
 
             try:
-                XendCheckpoint.save(sock.fileno(), dominfo, True, live,
-                                    dst, node=node)
+                try:
+                    XendCheckpoint.save(sock.fileno(), dominfo, True, live,
+                                        dst, node=node)
+                except Exception, ex:
+                    m_dsterr = None
+                    try:
+                        sock.settimeout(3.0)
+                        dsterr = sock.recv(1024)
+                        sock.settimeout(None)
+                        if dsterr:
+                            # See send_error@xxxxxxxxxxxx If an error occurred
+                            # in a destination side, an error message with the
+                            # following form is returned from the destination
+                            # side.
+                            m_dsterr = \
+                                
re.match(r"^\(err\s\(type\s(.+)\)\s\(value\s'(.+)'\)\)", dsterr)
+                    except:
+                        # Probably socket.timeout exception occurred.
+                        # Ignore the exception because it has nothing to do 
with
+                        # an exception of XendCheckpoint.save.
+                        pass
+
+                    if m_dsterr:
+                        raise XendError("%s (from %s)" % (m_dsterr.group(2), 
dst))
+                    raise
             finally:
-                sock.shutdown(2)
+                try:
+                    sock.shutdown(2)
+                except:
+                    # Probably the socket is already disconnected by sock.close
+                    # in the destination side.
+                    # Ignore the exception because it has nothing to do with
+                    # an exception of XendCheckpoint.save.
+                    pass
                 sock.close()
 
     def domain_save(self, domid, dst, checkpoint=False):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Receive error message of migration from destination server, Xen patchbot-unstable <=