ia64/xen-unstable

changeset 15981:265950e3df69

xend: Fix VIF MAC address being lost across localhost migration.
VIF details in /vm/<uuid> directory in xenstore get deleted by old
domain dying.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Tue Sep 25 15:35:17 2007 +0100 (2007-09-25)
parents f60b9feb5d75
children ce3916c3e47d
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 25 10:40:38 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 25 15:35:17 2007 +0100
     1.3 @@ -174,7 +174,8 @@ def recreate(info, priv):
     1.4      except XendError:
     1.5          pass # our best shot at 'goto' in python :)
     1.6  
     1.7 -    vm = XendDomainInfo(xeninfo, domid, dompath, augment = True, priv = priv)
     1.8 +    vm = XendDomainInfo(xeninfo, domid, dompath, augment = True, priv = priv,
     1.9 +                        vmpath = vmpath)
    1.10      
    1.11      if needs_reinitialising:
    1.12          vm._recreateDom()
    1.13 @@ -321,7 +322,7 @@ class XendDomainInfo:
    1.14      """
    1.15      
    1.16      def __init__(self, info, domid = None, dompath = None, augment = False,
    1.17 -                 priv = False, resume = False):
    1.18 +                 priv = False, resume = False, vmpath = None):
    1.19          """Constructor for a domain
    1.20  
    1.21          @param   info: parsed configuration
    1.22 @@ -348,7 +349,20 @@ class XendDomainInfo:
    1.23          #if not self._infoIsSet('uuid'):
    1.24          #    self.info['uuid'] = uuid.toString(uuid.create())
    1.25  
    1.26 -        self.vmpath  = XS_VMROOT + self.info['uuid']
    1.27 +        # Find a unique /vm/<uuid>/<integer> path if not specified.
    1.28 +        # This avoids conflict between pre-/post-migrate domains when doing
    1.29 +        # localhost relocation.
    1.30 +        self.vmpath = vmpath
    1.31 +        i = 0
    1.32 +        while self.vmpath == None:
    1.33 +            self.vmpath = XS_VMROOT + self.info['uuid'] + '/' + str(i)
    1.34 +            try:
    1.35 +                if self._readVm("uuid"):
    1.36 +                    self.vmpath = None
    1.37 +                    i = i + 1
    1.38 +            except:
    1.39 +                pass
    1.40 +
    1.41          self.dompath = dompath
    1.42  
    1.43          self.image = None