ia64/xen-unstable

changeset 6585:84ab93e1ee05

Cleanup domain listing.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Sep 01 10:08:53 2005 +0000 (2005-09-01)
parents aaee260ce02c
children dd668f7527cb
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/event.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Sep 01 09:57:20 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Sep 01 10:08:53 2005 +0000
     1.3 @@ -75,8 +75,26 @@ class XendDomain:
     1.4  
     1.5          @return: domain objects
     1.6          """
     1.7 +        self.refresh()
     1.8          return self.domains.values()
     1.9 -    
    1.10 +
    1.11 +    def list_sorted(self):
    1.12 +        """Get list of domain objects, sorted by name.
    1.13 +
    1.14 +        @return: domain objects
    1.15 +        """
    1.16 +        doms = self.list()
    1.17 +        doms.sort(lambda x, y: cmp(x.name, y.name))
    1.18 +        return doms
    1.19 +
    1.20 +    def list_names(self):
    1.21 +        """Get list of domain names.
    1.22 +
    1.23 +        @return: domain names
    1.24 +        """
    1.25 +        doms = self.list_sorted()
    1.26 +        return map(lambda x: x.name, doms)
    1.27 +
    1.28      def onVirq(self, event, val):
    1.29          """Event handler for virq.
    1.30          """
    1.31 @@ -265,24 +283,6 @@ class XendDomain:
    1.32          else:
    1.33              self._delete_domain(id)
    1.34  
    1.35 -    def domain_ls(self):
    1.36 -        """Get list of domain names.
    1.37 -
    1.38 -        @return: domain names
    1.39 -        """
    1.40 -        self.refresh()
    1.41 -        doms = self.domains.values()
    1.42 -        doms.sort(lambda x, y: cmp(x.name, y.name))
    1.43 -        return map(lambda x: x.name, doms)
    1.44 -
    1.45 -    def domain_ls_ids(self):
    1.46 -        """Get list of domain ids.
    1.47 -
    1.48 -        @return: domain names
    1.49 -        """
    1.50 -        self.refresh()
    1.51 -        return self.domains.keys()
    1.52 -
    1.53      def domain_create(self, config):
    1.54          """Create a domain from a configuration.
    1.55  
     2.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Thu Sep 01 09:57:20 2005 +0000
     2.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Thu Sep 01 10:08:53 2005 +0000
     2.3 @@ -146,11 +146,10 @@ class SrvDomainDir(SrvDir):
     2.4          if not url.endswith('/'):
     2.5              url += '/'
     2.6          if use_sxp:
     2.7 -            domains = self.xd.domain_ls()
     2.8 +            domains = self.xd.list_names()
     2.9              sxp.show(domains, out=req)
    2.10          else:
    2.11 -            domains = self.xd.list()
    2.12 -            domains.sort(lambda x, y: cmp(x.name, y.name))
    2.13 +            domains = self.xd.list_sorted()
    2.14              req.write('<ul>')
    2.15              for d in domains:
    2.16                 req.write('<li><a href="%s%s"> Domain %s</a>'
     3.1 --- a/tools/python/xen/xend/server/event.py	Thu Sep 01 09:57:20 2005 +0000
     3.2 +++ b/tools/python/xen/xend/server/event.py	Thu Sep 01 10:08:53 2005 +0000
     3.3 @@ -186,7 +186,7 @@ class EventProtocol(protocol.Protocol):
     3.4  
     3.5      def op_domain_ls(self, name, v):
     3.6          xd = xroot.get_component("xen.xend.XendDomain")
     3.7 -        return xd.domain_ls()
     3.8 +        return xd.list_names()
     3.9  
    3.10      def op_domain_configure(self, name, v):
    3.11          domid = sxp.child_value(v, "dom")