[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Re: Do not wait for memory teardown when live migrate



----- "Paolo Bonzini" <pbonzini@xxxxxxxxxx> wrote:
> >                       raise XendError("%s (from %s)" %
> (m_dsterr.group(2), dst))
> >                   raise
> >           finally:
> > +          if not live:
> >               try:
> >                   sock.shutdown(2)
> >               except:
> 
> Non-standard indentation?

Yeah, sorry for lazyness...This is correctly indented version.
> 

diff -r 3c4c3d48a835 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Thu Aug 26 11:16:56 2010 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py   Tue Oct 12 10:08:32 2010 +0200
@@ -65,7 +65,7 @@
     return
 
 
-def save(fd, dominfo, network, live, dst, checkpoint=False, node=-1):
+def save(fd, dominfo, network, live, dst, checkpoint=False, node=-1,sock=None):
     from xen.xend import XendDomain
 
     try:
@@ -162,6 +162,13 @@
         if checkpoint:
             dominfo.resumeDomain()
         else:
+            if live and sock != None:
+                try:
+                    sock.shutdown(2)
+                except:
+                    pass
+                sock.close()
+
             dominfo.destroy()
             dominfo.testDeviceComplete()
         try:
diff -r 3c4c3d48a835 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Aug 26 11:16:56 2010 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Tue Oct 12 10:08:32 2010 +0200
@@ -1412,7 +1412,7 @@
         try:
             try:
                 XendCheckpoint.save(p2cwrite, dominfo, True, live, dst,
-                                    node=node)
+                                    node=node,sock=sock)
             except Exception, ex:
                 m_dsterr = None
                 try:
@@ -1436,15 +1436,16 @@
                     raise XendError("%s (from %s)" % (m_dsterr.group(2), dst))
                 raise
         finally:
-            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()
+            if not live:
+                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)
         os.close(p2cwrite)
@@ -1469,7 +1470,7 @@
         try:
             try:
                 XendCheckpoint.save(sock.fileno(), dominfo, True, live,
-                                    dst, node=node)
+                                    dst, node=node,sock=sock)
             except Exception, ex:
                 m_dsterr = None
                 try:
@@ -1493,15 +1494,16 @@
                     raise XendError("%s (from %s)" % (m_dsterr.group(2), dst))
                 raise
         finally:
-            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()
+            if not live:
+                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):
         """Start saving a domain to file.
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.