ia64/xen-unstable

changeset 16884:367902a19412

Fix 'on_*=rename-restart' domain configuration option.

When setting e.g. 'on_crash=rename-restart' option in domain config
and crashing guest OS running in the domain, the new domain is
restarted with same name as renamed domain.

jfehlig4: # xm li
Name ID Mem VCPUs State Time(s)
Domain-0 0 1233 4 r----- 937.9
Domain-e64b12a0-0493-44d7-afde-55c776513426 21 384 1 ---c- 14.3
Domain-e64b12a0-0493-44d7-afde-55c776513426 22 384 1 r----- 7.3

This patch copies the domain info prior to setting new name and uuid
in the crashed domain info and uses the copied domain info to
construct the restarted domain.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 25 13:29:07 2008 +0000 (2008-01-25)
parents 666573856c59
children dc6264577b59
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jan 25 13:28:25 2008 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Jan 25 13:29:07 2008 +0000
     1.3 @@ -1393,9 +1393,10 @@ class XendDomainInfo:
     1.4  
     1.5          self._writeVm('xend/previous_restart_time', str(now))
     1.6  
     1.7 +        new_dom_info = self.info
     1.8          try:
     1.9              if rename:
    1.10 -                self._preserveForRestart()
    1.11 +                new_dom_info = self._preserveForRestart()
    1.12              else:
    1.13                  self._unwatchVm()
    1.14                  self.destroyDomain()
    1.15 @@ -1409,7 +1410,7 @@ class XendDomainInfo:
    1.16              new_dom = None
    1.17              try:
    1.18                  new_dom = XendDomain.instance().domain_create_from_dict(
    1.19 -                    self.info)
    1.20 +                    new_dom_info)
    1.21                  new_dom.waitForDevices()
    1.22                  new_dom.unpause()
    1.23                  rst_cnt = self._readVm('xend/restart_count')
    1.24 @@ -1440,11 +1441,15 @@ class XendDomainInfo:
    1.25                   new_name, new_uuid)
    1.26          self._unwatchVm()
    1.27          self._releaseDevices()
    1.28 +        new_dom_info = self.info.copy()
    1.29 +        new_dom_info['name_label'] = self.info['name_label']
    1.30 +        new_dom_info['uuid'] = self.info['uuid']
    1.31          self.info['name_label'] = new_name
    1.32          self.info['uuid'] = new_uuid
    1.33          self.vmpath = XS_VMROOT + new_uuid
    1.34          self._storeVmDetails()
    1.35          self._preserve()
    1.36 +        return new_dom_info
    1.37  
    1.38  
    1.39      def _preserve(self):