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

[Xen-changelog] XendDomain.py:



ChangeSet 1.1550.1.1, 2005/05/25 14:24:35+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        XendDomain.py:
          Remove XendMigrate.
        .del-XendMigrate.py~3921a328f4db779:
          Delete: tools/python/xen/xend/XendMigrate.py
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 b/tools/python/xen/xend/XendDomain.py |    4 
 tools/python/xen/xend/XendMigrate.py  |  585 ----------------------------------
 2 files changed, 1 insertion(+), 588 deletions(-)


diff -Nru a/tools/python/xen/xend/XendDomain.py 
b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       2005-05-25 14:02:02 -04:00
+++ b/tools/python/xen/xend/XendDomain.py       2005-05-25 14:02:02 -04:00
@@ -19,7 +19,6 @@
 import XendCheckpoint
 import XendDB
 import XendDomainInfo
-import XendMigrate
 import EventServer; eserver = EventServer.instance()
 from XendError import XendError
 from XendLogging import log
@@ -511,8 +510,7 @@
         # Need a cancel too?
         # Don't forget to cancel restart for it.
         dominfo = self.domain_lookup(id)
-        xmigrate = XendMigrate.instance()
-        return xmigrate.migrate_begin(dominfo, dst, live=live, 
resource=resource)
+        return None
 
     def domain_save(self, id, dst, progress=False):
         """Start saving a domain to file.
diff -Nru a/tools/python/xen/xend/XendMigrate.py 
b/tools/python/xen/xend/XendMigrate.py
--- a/tools/python/xen/xend/XendMigrate.py      2005-05-25 14:02:02 -04:00
+++ /dev/null   Wed Dec 31 16:00:00 196900
@@ -1,585 +0,0 @@
-# Copyright (C) 2004 Mike Wray <mike.wray@xxxxxx>
-
-import traceback
-import threading
-
-import errno
-import sys
-import socket
-import time
-import types
-
-from xen.web import reactor
-from xen.web.protocol import Protocol, ClientFactory
-
-import scheduler
-import sxp
-import XendDB
-import EventServer; eserver = EventServer.instance()
-from XendError import XendError
-from XendLogging import log
-        
-"""The port for the migrate/save daemon xfrd."""
-XFRD_PORT = 8002
-
-"""The transfer protocol major version number."""
-XFR_PROTO_MAJOR = 1
-"""The transfer protocol minor version number."""
-XFR_PROTO_MINOR = 0
-
-class Xfrd(Protocol):
-    """Protocol handler for a connection to the migration/save daemon xfrd.
-    """
-
-    def __init__(self, xinfo):
-        self.parser = sxp.Parser()
-        self.xinfo = xinfo
-
-    def connectionMade(self, addr=None):
-        # Send hello.
-        self.request(['xfr.hello', XFR_PROTO_MAJOR, XFR_PROTO_MINOR])
-        # Send request.
-        self.xinfo.request(self)
-        # Run the transport mainLoop which reads from the peer.
-        self.transport.mainLoop()
-
-    def request(self, req):
-        sxp.show(req, out=self.transport)
-
-    def loseConnection(self):
-        self.transport.loseConnection()
-
-    def connectionLost(self, reason):
-        self.xinfo.connectionLost(reason)
-
-    def dataReceived(self, data):
-        self.parser.input(data)
-        if self.parser.ready():
-            val = self.parser.get_val()
-            self.xinfo.dispatch(self, val)
-        if self.parser.at_eof():
-            self.loseConnection()
-            
-class XfrdClientFactory(ClientFactory):
-    """Factory for clients of the migration/save daemon xfrd.
-    """
-
-    def __init__(self, xinfo):
-        #ClientFactory.__init__(self)
-        self.xinfo = xinfo
-        self.readyCond = threading.Condition()
-        self.ready = False
-        self.err = None
-
-    def start(self):
-        print 'XfrdClientFactory>start>'
-        reactor.connectTCP('localhost', XFRD_PORT, self)
-        try:
-            self.readyCond.acquire()
-            while not self.ready:
-                self.readyCond.wait()
-        finally:
-            self.readyCond.release()
-        print 'XfrdClientFactory>start>', 'err=', self.err
-        if self.err:
-            raise self.err
-        return 0
-
-    def notifyReady(self):
-        try:
-            self.readyCond.acquire()
-            self.ready = True
-            self.err = self.xinfo.error_summary()
-            self.readyCond.notify()
-        finally:
-            self.readyCond.release()
-            
-    def startedConnecting(self, connector):
-        pass
-
-    def buildProtocol(self, addr):
-        return Xfrd(self.xinfo)
-
-    def clientConnectionLost(self, connector, reason):
-        print "XfrdClientFactory>clientConnectionLost>", reason
-        self.notifyReady()
-
-    def clientConnectionFailed(self, connector, reason):
-        print "XfrdClientFactory>clientConnectionFailed>", reason
-        self.xinfo.error(reason)
-        self.notifyReady()
-
-class SuspendHandler:
-
-    def __init__(self, xinfo, vmid, timeout):
-        self.xinfo = xinfo
-        self.vmid = vmid
-        self.timeout = timeout
-        self.readyCond = threading.Condition()
-        self.ready = False
-        self.err = None
-
-    def start(self):
-        self.subscribe(on=True)
-        timer = scheduler.later(self.timeout, self.onTimeout)
-        try:
-            self.readyCond.acquire()
-            while not self.ready:
-                self.readyCond.wait()
-        finally:
-            self.readyCond.release()
-            self.subscribe(on=False)
-            timer.cancel()
-        if self.err:
-            raise XendError(self.err)
-
-    def notifyReady(self, err=None):
-        try:
-            self.readyCond.acquire()
-            if not self.ready:
-                self.ready = True
-                self.err = err
-                self.readyCond.notify()
-        finally:
-            self.readyCond.release()
-
-    def subscribe(self, on=True):
-        # Subscribe to 'suspended' events so we can tell when the
-        # suspend completes. Subscribe to 'died' events so we can tell if
-        # the domain died.
-        if on:
-            action = eserver.subscribe
-        else:
-            action = eserver.unsubscribe
-        action('xend.domain.suspended', self.onSuspended)
-        action('xend.domain.died', self.onDied)
-
-    def onSuspended(self, e, v):
-        if v[1] != self.vmid: return
-        print 'SuspendHandler>onSuspended>', e, v
-        self.notifyReady()
-                
-    def onDied(self, e, v):
-        if v[1] != self.vmid: return
-        print 'SuspendHandler>onDied>', e, v
-        self.notifyReady('Domain %s died while suspending' % self.vmid)
-
-    def onTimeout(self):
-         print 'SuspendHandler>onTimeout>'
-         self.notifyReady('Domain %s suspend timed out' % self.vmid)
-
-class XfrdInfo:
-    """Abstract class for info about a session with xfrd.
-    Has subclasses for save and migrate.
-    """
-
-    """Suspend timeout (seconds).
-    We set a timeout because suspending a domain can hang."""
-    timeout = 30
-
-    def __init__(self):
-        from xen.xend import XendDomain
-        self.xd = XendDomain.instance()
-        self.suspended = {}
-        self.paused = {}
-        self.state = 'init'
-        # List of errors encountered.
-        self.errors = []
-            
-    def vmconfig(self):
-        dominfo = self.xd.domain_get(self.src_dom)
-        if dominfo:
-            val = sxp.to_string(dominfo.sxpr())
-        else:
-            val = None
-        return val
-
-    def add_error(self, err):
-        """Add an error to the error list.
-        Returns the error added.
-        """
-        if err not in self.errors:
-            self.errors.append(err)
-        return err
-
-    def error_summary(self, msg=None):
-        """Get a XendError summarising the errors (if any).
-        """
-        if not self.errors:
-            return None
-        if msg is None:
-            msg = "errors"
-        if self.errors:
-            errmsg = msg + ': ' + ', '.join(map(str, self.errors))
-        else:
-            errmsg = msg
-        return XendError(errmsg)
-
-    def get_errors(self):
-        """Get the list of errors.
-        """
-        return self.errors
-
-    def error(self, err):
-        print 'XfrdInfo>error>', err
-        self.state = 'error'

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


 


Rackspace

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