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] Simplify backend flag parsing.

# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID fd19e760932d095b23d38e67eaec24dd02ba3aba
# Parent  75fe7890cf013178e376b88e00158c5b9c8c4324
Simplify backend flag parsing.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 75fe7890cf01 -r fd19e760932d tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Sep 15 18:39:17 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Sep 15 19:46:14 2005
@@ -87,6 +87,15 @@
 STATE_VM_OK         = "ok"
 STATE_VM_TERMINATED = "terminated"
 STATE_VM_SUSPENDED  = "suspended"
+
+"""Flag for a block device backend domain."""
+SIF_BLK_BE_DOMAIN = (1<<4)
+
+"""Flag for a net device backend domain."""
+SIF_NET_BE_DOMAIN = (1<<5)
+
+"""Flag for a TPM device backend domain."""
+SIF_TPM_BE_DOMAIN = (1<<7)
 
 
 def domain_exists(name):
@@ -243,10 +252,8 @@
         self.controllers = {}
         
         self.info = None
-        self.blkif_backend = False
-        self.netif_backend = False
+        self.backend_flags = 0
         self.netif_idx = 0
-        self.tpmif_backend = False
         
         #todo: state: running, suspended
         self.state = STATE_VM_OK
@@ -1014,13 +1021,13 @@
             v = sxp.child0(c)
             name = sxp.name(v)
             if name == 'blkif':
-                self.blkif_backend = True
+                self.backend_flags |= SIF_BLK_BE_DOMAIN
             elif name == 'netif':
-                self.netif_backend = True
+                self.backend_flags |= SIF_NET_BE_DOMAIN
             elif name == 'usbif':
-                self.usbif_backend = True
+                pass
             elif name == 'tpmif':
-                self.tpmif_backend = True
+                self.backend_flags |= SIF_TPM_BE_DOMAIN
             else:
                 raise VmError('invalid backend type:' + str(name))
 
diff -r 75fe7890cf01 -r fd19e760932d tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Sep 15 18:39:17 2005
+++ b/tools/python/xen/xend/image.py    Thu Sep 15 19:46:14 2005
@@ -26,15 +26,6 @@
 from xen.xend.xenstore.xstransact import xstransact
 
 from xen.xend.server import channel
-
-"""Flag for a block device backend domain."""
-SIF_BLK_BE_DOMAIN = (1<<4)
-
-"""Flag for a net device backend domain."""
-SIF_NET_BE_DOMAIN = (1<<5)
-
-"""Flag for a TPM device backend domain."""
-SIF_TPM_BE_DOMAIN = (1<<7)
 
 MAX_GUEST_CMDLINE = 1024
 
@@ -192,10 +183,7 @@
             return
 
         # Set params and call buildDomain().
-        self.flags = 0
-        if self.vm.netif_backend: self.flags |= SIF_NET_BE_DOMAIN
-        if self.vm.blkif_backend: self.flags |= SIF_BLK_BE_DOMAIN
-        if self.vm.tpmif_backend: self.flags |= SIF_TPM_BE_DOMAIN
+        self.flags = self.vm.backend_flags
 
         if not os.path.isfile(self.kernel):
             raise VmError('Kernel image does not exist: %s' % self.kernel)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Simplify backend flag parsing., Xen patchbot -unstable <=