ia64/xen-unstable

changeset 5241:d1bcd03773bf

bitkeeper revision 1.1618 (429c9b21TCCZatsEzYuIU4HRcrJtyA)

XendDomain.py:
Allow migration to localhost.
g/c XendDomain.domain_exists().
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue May 31 17:13:05 2005 +0000 (2005-05-31)
parents e2a8619ab691
children fbb531d2ff13
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Tue May 31 15:56:16 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue May 31 17:13:05 2005 +0000
     1.3 @@ -8,6 +8,7 @@
     1.4  import errno
     1.5  import os
     1.6  import scheduler
     1.7 +import string
     1.8  import sys
     1.9  import traceback
    1.10  import time
    1.11 @@ -357,9 +358,6 @@ class XendDomain:
    1.12          except Exception, ex:
    1.13              log.exception("Error creating domain info: id=%s", name)
    1.14  
    1.15 -    def domain_exists(self, name):
    1.16 -        return self.domain_lookup(name) != None
    1.17 -
    1.18      def domain_unpause(self, id):
    1.19          """Unpause domain execution.
    1.20  
    1.21 @@ -514,7 +512,17 @@ class XendDomain:
    1.22          port = xroot.get_xend_relocation_port()
    1.23          sock = relocate.setupRelocation(dst, port)
    1.24  
    1.25 -        XendCheckpoint.save(self, sock.fileno(), dominfo)
    1.26 +        # temporarily rename domain for localhost migration
    1.27 +        if dst == "localhost":
    1.28 +            dominfo.name = "tmp-" + dominfo.name
    1.29 +
    1.30 +        try:
    1.31 +            XendCheckpoint.save(self, sock.fileno(), dominfo)
    1.32 +        except:
    1.33 +            if dst == "localhost":
    1.34 +                dominfo.name = string.replace(dominfo.name, "tmp-", "", 1)
    1.35 +            raise
    1.36 +        
    1.37          return None
    1.38  
    1.39      def domain_save(self, id, dst, progress=False):