# HG changeset patch
# User Miroslav Rezanina <mrezanin@xxxxxxxxxx>
# Date 1288262432 -3600
# Node ID 31b8844fab99e0e3358e983b9a7b6617148045b3
# Parent 28a16074681582f1209c9077f870ccf44927133e
Do not wait for memory teardown when live migrate
When trying to live migrate guest with great memory (e.g. 20 GB),
there's delay caused by destroying source copy of domain. To speed up
this process we can close socket before starting guest destroy, as
source guest is not running anymore.
Signed-off-by: Miroslav Rezanina <mrezanin@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/python/xen/xend/XendCheckpoint.py | 9 ++++++
tools/python/xen/xend/XendDomain.py | 42 ++++++++++++++++----------------
2 files changed, 30 insertions(+), 21 deletions(-)
diff -r 28a160746815 -r 31b8844fab99 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Wed Oct 27 12:24:28 2010 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py Thu Oct 28 11:40:32 2010 +0100
@@ -65,7 +65,7 @@ def insert_after(list, pred, value):
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 @@ def save(fd, dominfo, network, live, dst
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 28a160746815 -r 31b8844fab99 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Oct 27 12:24:28 2010 +0100
+++ b/tools/python/xen/xend/XendDomain.py Thu Oct 28 11:40:32 2010 +0100
@@ -1412,7 +1412,7 @@ class XendDomain:
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 @@ class XendDomain:
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 @@ class XendDomain:
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 @@ class XendDomain:
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.
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|