ia64/xen-unstable

changeset 7082:41735ccc5ee3

Added sxprs, for xm block-list.
author emellor@ewan
date Tue Sep 27 22:03:55 2005 +0100 (2005-09-27)
parents 7c5d9879967d
children 679e93b5c6cd
files tools/python/xen/xend/server/DevController.py
line diff
     1.1 --- a/tools/python/xen/xend/server/DevController.py	Tue Sep 27 22:02:57 2005 +0100
     1.2 +++ b/tools/python/xen/xend/server/DevController.py	Tue Sep 27 22:03:55 2005 +0100
     1.3 @@ -81,6 +81,22 @@ class DevController:
     1.4          xstransact.Remove(backpath)
     1.5  
     1.6  
     1.7 +    def sxprs(self):
     1.8 +        """@return an s-expression describing all the devices of this
     1.9 +        controller's device-class.
    1.10 +        """
    1.11 +        path = self.frontendRoot()
    1.12 +        while True:
    1.13 +            t = xstransact(path)
    1.14 +            try:
    1.15 +                listing = t.list_recursive()
    1.16 +                if t.commit():
    1.17 +                    return listing
    1.18 +            except:
    1.19 +                t.abort()
    1.20 +                raise
    1.21 +
    1.22 +
    1.23      def sxpr(self, devid):
    1.24          """@return an s-expression describing the specified device.
    1.25          """
    1.26 @@ -126,8 +142,8 @@ class DevController:
    1.27          compulsory to use it; subclasses may prefer to allocate IDs based upon
    1.28          the device configuration instead.
    1.29          """
    1.30 +        path = self.frontendMiscPath()
    1.31          while True:
    1.32 -            path = self.frontendMiscPath()
    1.33              t = xstransact(path)
    1.34              try:
    1.35                  result = t.read("nextDeviceID")
    1.36 @@ -196,8 +212,11 @@ class DevController:
    1.37  
    1.38  
    1.39      def frontendPath(self, devid):
    1.40 -        return "%s/device/%s/%d" % (self.vm.getPath(), self.deviceClass,
    1.41 -                                    devid)
    1.42 +        return "%s/%d" % (self.frontendRoot(), devid)
    1.43 +
    1.44 +
    1.45 +    def frontendRoot(self):
    1.46 +        return "%s/device/%s" % (self.vm.getPath(), self.deviceClass)
    1.47  
    1.48  
    1.49      def frontendMiscPath(self):