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] [XEND] Save device updates to VM configur

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Save device updates to VM configuration via Xen API
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:08:50 +0000
Delivery-date: Thu, 02 Nov 2006 21:42:18 -0800
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 Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID f5912c42fbc3ac99242c75e3a1c3273e2722d1af
# Parent  c21f4949a746812ce83414baa729d31bb5705062
[XEND] Save device updates to VM configuration via Xen API

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |    2 ++
 tools/python/xen/xend/XendDomain.py     |   15 ++++++++++-----
 tools/python/xen/xend/XendDomainInfo.py |    2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff -r c21f4949a746 -r f5912c42fbc3 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Oct 06 16:40:39 2006 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Fri Oct 06 17:34:49 2006 +0100
@@ -963,6 +963,7 @@ class XendAPI:
             dom = xendom.get_vm_by_uuid(vbd_struct['VM'])
             try:
                 vbd_ref = dom.create_vbd(vbd_struct)
+                xendom.managed_config_save(dom)
                 return xen_api_success(vbd_ref)
             except XendError:
                 return xen_api_error(XEND_ERROR_TODO)
@@ -1029,6 +1030,7 @@ class XendAPI:
             dom = xendom.get_vm_by_uuid(vif_struct['VM'])
             try:
                 vif_ref = dom.create_vif(vif_struct)
+                xendom.managed_config_save(dom)                
                 return xen_api_success(vif_ref)
             except XendError:
                 return xen_api_error(XEND_ERROR_TODO)
diff -r c21f4949a746 -r f5912c42fbc3 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Oct 06 16:40:39 2006 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Fri Oct 06 17:34:49 2006 +0100
@@ -143,7 +143,7 @@ class XendDomain:
             running = self._running_domains()
             managed = self._managed_domains()
 
-            # add all active domains, replacing managed ones
+            # add all active domains
             for dom in running:
                 if dom['domid'] != DOM0_ID:
                     try:
@@ -160,12 +160,14 @@ class XendDomain:
                 dom_name = dom.get('name', 'Domain-%s' % dom_uuid)
                 
                 try:
-                    # instantiate domain if not started.
-                    if not self.domain_lookup_nr(dom_name):
+                    running_dom = self.domain_lookup_nr(dom_name)
+                    if not running_dom:
+                        # instantiate domain if not started.
                         new_dom = XendDomainInfo.createDormant(dom)
                         self._add_domain(new_dom)
-                    # keep track of maanged domains
-                    self._managed_domain_register(new_dom)
+                        self._managed_domain_register(new_dom)
+                    else:
+                        self._managed_domain_register(running_dom)
                 except Exception:
                     log.exception("Failed to create reference to managed "
                                   "domain: %s" % dom_name)
@@ -237,6 +239,9 @@ class XendDomain:
         @raise XendError: fails to save configuration.
         @rtype: None
         """
+        if not self.is_domain_managed(dominfo):
+            return # refuse to save configuration this domain isn't managed
+        
         if dominfo:
             domains_dir = self._managed_path()
             dom_uuid = dominfo.get_uuid()            
diff -r c21f4949a746 -r f5912c42fbc3 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 06 16:40:39 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 06 17:34:49 2006 +0100
@@ -265,7 +265,7 @@ def createDormant(xeninfo):
     
     log.debug("XendDomainInfo.createDormant(%s)", xeninfo)
     
-    # Remove domid and uuid do not make sense for non-running domains.
+    # domid does not make sense for non-running domains.
     xeninfo.pop('domid', None)
     vm = XendDomainInfo(XendConfig(cfg = xeninfo))
     return vm    

_______________________________________________
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] [XEND] Save device updates to VM configuration via Xen API, Xen patchbot-unstable <=