WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix the handling of the transient flag.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix the handling of the transient flag.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Mar 2007 14:10:17 -0700
Delivery-date: Thu, 22 Mar 2007 14:09:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174588820 0
# Node ID 1fc6efdab399f6e421c1f8980edf83c7f857b543
# Parent  abd9ae4f1f17f392d350fbc3e6dd1855cd9ad9aa
Fix the handling of the transient flag.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py     |   56 ++++++++++++++++++++++++--------
 tools/python/xen/xend/XendDomainInfo.py |   22 +++++-------
 2 files changed, 52 insertions(+), 26 deletions(-)

diff -r abd9ae4f1f17 -r 1fc6efdab399 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Mar 22 18:37:37 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Thu Mar 22 18:40:20 2007 +0000
@@ -34,7 +34,7 @@ import xen.lowlevel.xc
 
 from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
 from xen.xend.PrettyPrint import prettyprint
-from xen.xend.XendConfig import XendConfig
+from xen.xend import XendConfig
 from xen.xend.XendError import XendError, XendInvalidDomain, VmError
 from xen.xend.XendError import VMBadState
 from xen.xend.XendLogging import log
@@ -191,6 +191,10 @@ class XendDomain:
                         self._managed_domain_register(new_dom)
                     else:
                         self._managed_domain_register(running_dom)
+                        for key in XendConfig.XENAPI_CFG_TYPES.keys():
+                            if key not in XendConfig.LEGACY_XENSTORE_VM_PARAMS 
and \
+                                   key in dom:
+                                running_dom.info[key] = dom[key]
                 except Exception:
                     log.exception("Failed to create reference to managed "
                                   "domain: %s" % dom_name)
@@ -316,7 +320,7 @@ class XendDomain:
         for dom_uuid in dom_uuids:
             try:
                 cfg_file = self._managed_config_path(dom_uuid)
-                cfg = XendConfig(filename = cfg_file)
+                cfg = XendConfig.XendConfig(filename = cfg_file)
                 if cfg.get('uuid') != dom_uuid:
                     # something is wrong with the SXP
                     log.error("UUID mismatch in stored configuration: %s" %
@@ -414,7 +418,7 @@ class XendDomain:
         running_domids = [d['domid'] for d in running if d['dying'] != 1]
         for domid, dom in self.domains.items():
             if domid not in running_domids and domid != DOM0_ID:
-                self.remove_domain(dom, domid)
+                self._remove_domain(dom, domid)
 
 
     def add_domain(self, info):
@@ -433,6 +437,16 @@ class XendDomain:
             self._managed_domain_register(info)
 
     def remove_domain(self, info, domid = None):
+        """Remove the domain from the list of running domains, taking the
+        domains_lock first.
+        """
+        self.domains_lock.acquire()
+        try:
+            self._remove_domain(info, domid)
+        finally:
+            self.domains_lock.release()
+
+    def _remove_domain(self, info, domid = None):
         """Remove the domain from the list of running domains
         
         @requires: Expects to be protected by the domains_lock.
@@ -683,7 +697,7 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             try:
-                xeninfo = XendConfig(xapi = xenapi_vm)
+                xeninfo = XendConfig.XendConfig(xapi = xenapi_vm)
                 dominfo = XendDomainInfo.createDormant(xeninfo)
                 log.debug("Creating new managed domain: %s: %s" %
                           (dominfo.getName(), dominfo.get_uuid()))
@@ -906,7 +920,7 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             try:
-                domconfig = XendConfig(sxp_obj = config)
+                domconfig = XendConfig.XendConfig(sxp_obj = config)
                 dominfo = XendDomainInfo.createDormant(domconfig)
                 log.debug("Creating new managed domain: %s" %
                           dominfo.getName())
@@ -971,18 +985,34 @@ class XendDomain:
                     raise VMBadState("Domain is still running",
                                      POWER_STATE_NAMES[DOM_STATE_HALTED],
                                      POWER_STATE_NAMES[dominfo.state])
-
-                log.info("Domain %s (%s) deleted." %
-                         (dominfo.getName(), dominfo.info.get('uuid')))
-
-                self._managed_domain_unregister(dominfo)
-                self.remove_domain(dominfo)
-                XendDevices.destroy_device_state(dominfo)
+                
+                self._domain_delete_by_info(dominfo)
             except Exception, ex:
                 raise XendError(str(ex))
         finally:
             self.domains_lock.release()
-        
+
+
+    def domain_delete_by_dominfo(self, dominfo):
+        """Only for use by XendDomainInfo.
+        """
+        self.domains_lock.acquire()
+        try:
+            self._domain_delete_by_info(dominfo)
+        finally:
+            self.domains_lock.release()
+
+
+    def _domain_delete_by_info(self, dominfo):
+        """Expects to be protected by domains_lock.
+        """
+        log.info("Domain %s (%s) deleted." %
+                 (dominfo.getName(), dominfo.info.get('uuid')))
+                
+        self._managed_domain_unregister(dominfo)
+        self._remove_domain(dominfo)
+        XendDevices.destroy_device_state(dominfo)
+
 
     def domain_configure(self, config):
         """Configure an existing domain.
diff -r abd9ae4f1f17 -r 1fc6efdab399 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Mar 22 18:37:37 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Mar 22 18:40:20 2007 +0000
@@ -660,7 +660,6 @@ class XendDomainInfo:
         vm_config = dict(zip(augment_entries, vm_config))
         
         for arg in augment_entries:
-            xapicfg = arg
             val = vm_config[arg]
             if val != None:
                 if arg in XendConfig.LEGACY_CFG_TO_XENAPI_CFG:
@@ -1651,6 +1650,12 @@ class XendDomainInfo:
 
         self._cleanup_phantom_devs(paths)
 
+        if "transient" in self.info["other_config"] \
+           and bool(self.info["other_config"]["transient"]):
+            from xen.xend import XendDomain
+            XendDomain.instance().domain_delete_by_dominfo(self)
+
+
     def destroyDomain(self):
         log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
 
@@ -1662,25 +1667,16 @@ class XendDomainInfo:
                 self.domid = None
                 for state in DOM_STATES_OLD:
                     self.info[state] = 0
+                self._stateSet(DOM_STATE_HALTED)
         except:
             log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.")
 
         from xen.xend import XendDomain
-
-        if "transient" in self.info["other_config"]\
-           and bool(self.info["other_config"]["transient"]):
-            xendDomainInstance = XendDomain.instance()
-            
-            xendDomainInstance.domains_lock.acquire()
-            xendDomainInstance._refresh(refresh_shutdown = False)
-            xendDomainInstance.domains_lock.release()
-            
-            xendDomainInstance.domain_delete(self.info["name_label"])
-        else:
-            XendDomain.instance().remove_domain(self)
+        XendDomain.instance().remove_domain(self)
 
         self.cleanupDomain()
         self._cleanup_phantom_devs(paths)
+
 
     def resumeDomain(self):
         log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid))

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix the handling of the transient flag., Xen patchbot-unstable <=