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] Switch vcpu hotplugging to use xstransact.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Switch vcpu hotplugging to use xstransact.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Sep 2005 17:50:16 +0000
Delivery-date: Tue, 13 Sep 2005 17:49:17 +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-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 26cf3cfd3bedcc958baaa3366cb804efd2b3e457
# Parent  f562c0f1d2226ece0593eaa9e373a54b116ae0d0
Switch vcpu hotplugging to use xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r f562c0f1d222 -r 26cf3cfd3bed tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Sep 13 16:57:45 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Sep 13 17:31:13 2005
@@ -262,7 +262,6 @@
         self.restart_count = 0
         
         self.vcpus = 1
-        self.vcpusdb = {}
         self.bootloader = None
         self.device_model_pid = 0
 
@@ -657,15 +656,11 @@
         except:
             raise VmError('invalid vcpus value')
 
-    def exportVCPUSToDB(self, vcpus):
-        for v in range(0,vcpus):
-            path = "/cpu/%d"%(v)
-            if not self.vcpusdb.has_key(path):
-                self.vcpusdb[path] = self.db.addChild(path)
-            db = self.vcpusdb[path]
-            log.debug("writing key availability=online to path %s in 
store"%(path))
-            db['availability'] = "online"
-            db.saveDB(save=True)
+    def configure_vcpus(self, vcpus):
+        d = {}
+        for v in range(0, vcpus):
+            d["cpu/%d/availability" % v] = "online"
+        xstransact.Write(self.path, d)
 
     def init_image(self):
         """Create boot image handler for the domain.
@@ -685,7 +680,7 @@
             IntroduceDomain(self.id, self.store_mfn, self.store_channel.port1,
                             self.path)
         # get the configured value of vcpus and update store
-        self.exportVCPUSToDB(self.vcpus)
+        self.configure_vcpus(self.vcpus)
 
     def delete(self):
         """Delete the vm's db.
@@ -1051,20 +1046,14 @@
     def vcpu_hotplug(self, vcpu, state):
         """Disable or enable VCPU in domain.
         """
-        db = ""
-        try:
-            db = self.vcpusdb['/cpu/%d'%(vcpu)]
-        except:
-            log.error("Invalid VCPU")
+        if vcpu > self.vcpus:
+            log.error("Invalid VCPU %d" % vcpu)
             return
-
-        if self.store_channel:
-            if int(state) == 0:
-                db['availability'] = "offline"
-            else:
-                db['availability'] = "online"
-
-        db.saveDB(save=True)
+        if int(state) == 0:
+            availability = "offline"
+        else:
+            availability = "online"
+        xstransact.Write(self.path, "cpu/%d/availability" % vcpu, availability)
 
     def shutdown(self, reason):
         if not reason in shutdown_reasons.values():
@@ -1107,7 +1096,7 @@
                 else:
                     raise
             # get run-time value of vcpus and update store
-            self.exportVCPUSToDB(dom_get(self.id)['vcpus'])
+            self.configure_vcpus(dom_get(self.id)['vcpus'])
 
 
 def vm_field_ignore(_, _1, _2, _3):

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Switch vcpu hotplugging to use xstransact., Xen patchbot -unstable <=