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] XendDomain.py:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] XendDomain.py:
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 18 May 2005 17:47:18 +0000
Delivery-date: Wed, 18 May 2005 18:02:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1452.1.1, 2005/05/18 18:47:18+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        XendDomain.py:
          Simplify domain restart code.
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 XendDomain.py |   35 +++++++----------------------------
 1 files changed, 7 insertions(+), 28 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-18 14:02:58 -04:00
+++ b/tools/python/xen/xend/XendDomain.py       2005-05-18 14:02:58 -04:00
@@ -80,10 +80,6 @@
     domain_by_id = {}
     domain_by_name = {}
     
-    """Table of domains to restart, indexed by domain id."""
-    restarts_by_id = {}
-    restarts_by_name = {}
-
     """Table of pending domain shutdowns, indexed by domain id."""
     shutdowns_by_id = {}
 
@@ -181,8 +177,6 @@
         dominfo = XendDomainInfo.vm_recreate(savedinfo, info)
         self.domain_by_id[dominfo.id] = dominfo
         self.domain_by_name[dominfo.name] = dominfo
-        if dominfo.restart_pending():
-            self.domain_restart_add(dominfo)
         return dominfo
 
     def _add_domain(self, info, notify=True):
@@ -526,38 +520,25 @@
             return
         restart = (force and reason == 'reboot') or 
dominfo.restart_needed(reason)
         if restart:
+            log.info('Scheduling restart for domain: name=%s id=%s',
+                     dominfo.name, dominfo.id)
+            eserver.inject("xend.domain.restart",
+                           [dominfo.name, dominfo.id, "schedule"])
             dominfo.restarting()
-            self.domain_restart_add(dominfo)
         else:
-            self.domain_restart_cancel(dominfo.id)
-
-    def domain_restart_add(self, dominfo):
-        self.restarts_by_name[dominfo.name] = dominfo
-        self.restarts_by_id[dominfo.id] = dominfo
-        log.info('Scheduling restart for domain: name=%s id=%s', dominfo.name, 
dominfo.id)
-        eserver.inject("xend.domain.restart",
-                       [dominfo.name, dominfo.id, "schedule"])
-            
-    def domain_restart_cancel(self, id):
-        """Cancel any restart scheduled for a domain.
-
-        @param id: domain id
-        """
-        dominfo = self.restarts_by_id.get(id) or self.restarts_by_name.get(id)
-        if dominfo:
             log.info('Cancelling restart for domain: name=%s id=%s',
                      dominfo.name, dominfo.id)
             eserver.inject("xend.domain.restart",
                            [dominfo.name, dominfo.id, "cancel"])
             dominfo.restart_cancel()
-            del self.restarts_by_id[dominfo.id]
-            del self.restarts_by_name[dominfo.name]
 
     def domain_restarts(self):
         """Execute any scheduled domain restarts for domains that have gone.
         """
         doms = self.xen_domains()
-        for dominfo in self.restarts_by_id.values():
+        for dominfo in self.domain_by_id.values():
+            if not dominfo.restart_pending():
+                continue
             print 'domain_restarts>', dominfo.name, dominfo.id
             info = doms.get(dominfo.id)
             if info:
@@ -565,8 +546,6 @@
                 print 'domain_restarts> still runnning: ', dominfo.name
                 continue
             # Remove it from the restarts.
-            del self.restarts_by_id[dominfo.id]
-            del self.restarts_by_name[dominfo.name]
             print 'domain_restarts> restarting: ', dominfo.name
             self.domain_restart(dominfo)
 

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

<Prev in Thread] Current Thread [Next in Thread>