ia64/xen-unstable

changeset 6905:fd19e760932d

Simplify backend flag parsing.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Sep 15 19:46:14 2005 +0000 (2005-09-15)
parents 75fe7890cf01
children 0f851f965df9
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 15 18:39:17 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 15 19:46:14 2005 +0000
     1.3 @@ -88,6 +88,15 @@ STATE_VM_OK         = "ok"
     1.4  STATE_VM_TERMINATED = "terminated"
     1.5  STATE_VM_SUSPENDED  = "suspended"
     1.6  
     1.7 +"""Flag for a block device backend domain."""
     1.8 +SIF_BLK_BE_DOMAIN = (1<<4)
     1.9 +
    1.10 +"""Flag for a net device backend domain."""
    1.11 +SIF_NET_BE_DOMAIN = (1<<5)
    1.12 +
    1.13 +"""Flag for a TPM device backend domain."""
    1.14 +SIF_TPM_BE_DOMAIN = (1<<7)
    1.15 +
    1.16  
    1.17  def domain_exists(name):
    1.18      # See comment in XendDomain constructor.
    1.19 @@ -243,10 +252,8 @@ class XendDomainInfo:
    1.20          self.controllers = {}
    1.21          
    1.22          self.info = None
    1.23 -        self.blkif_backend = False
    1.24 -        self.netif_backend = False
    1.25 +        self.backend_flags = 0
    1.26          self.netif_idx = 0
    1.27 -        self.tpmif_backend = False
    1.28          
    1.29          #todo: state: running, suspended
    1.30          self.state = STATE_VM_OK
    1.31 @@ -1014,13 +1021,13 @@ class XendDomainInfo:
    1.32              v = sxp.child0(c)
    1.33              name = sxp.name(v)
    1.34              if name == 'blkif':
    1.35 -                self.blkif_backend = True
    1.36 +                self.backend_flags |= SIF_BLK_BE_DOMAIN
    1.37              elif name == 'netif':
    1.38 -                self.netif_backend = True
    1.39 +                self.backend_flags |= SIF_NET_BE_DOMAIN
    1.40              elif name == 'usbif':
    1.41 -                self.usbif_backend = True
    1.42 +                pass
    1.43              elif name == 'tpmif':
    1.44 -                self.tpmif_backend = True
    1.45 +                self.backend_flags |= SIF_TPM_BE_DOMAIN
    1.46              else:
    1.47                  raise VmError('invalid backend type:' + str(name))
    1.48  
     2.1 --- a/tools/python/xen/xend/image.py	Thu Sep 15 18:39:17 2005 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Thu Sep 15 19:46:14 2005 +0000
     2.3 @@ -27,15 +27,6 @@ from xen.xend.xenstore.xstransact import
     2.4  
     2.5  from xen.xend.server import channel
     2.6  
     2.7 -"""Flag for a block device backend domain."""
     2.8 -SIF_BLK_BE_DOMAIN = (1<<4)
     2.9 -
    2.10 -"""Flag for a net device backend domain."""
    2.11 -SIF_NET_BE_DOMAIN = (1<<5)
    2.12 -
    2.13 -"""Flag for a TPM device backend domain."""
    2.14 -SIF_TPM_BE_DOMAIN = (1<<7)
    2.15 -
    2.16  MAX_GUEST_CMDLINE = 1024
    2.17  
    2.18  class ImageHandler:
    2.19 @@ -192,10 +183,7 @@ class ImageHandler:
    2.20              return
    2.21  
    2.22          # Set params and call buildDomain().
    2.23 -        self.flags = 0
    2.24 -        if self.vm.netif_backend: self.flags |= SIF_NET_BE_DOMAIN
    2.25 -        if self.vm.blkif_backend: self.flags |= SIF_BLK_BE_DOMAIN
    2.26 -        if self.vm.tpmif_backend: self.flags |= SIF_TPM_BE_DOMAIN
    2.27 +        self.flags = self.vm.backend_flags
    2.28  
    2.29          if not os.path.isfile(self.kernel):
    2.30              raise VmError('Kernel image does not exist: %s' % self.kernel)