ia64/xen-unstable

changeset 1989:84b9fcf01e7f

bitkeeper revision 1.1108.35.5 (41090ef2VknMjEjPGflC7vkB7aE0IQ)

Add commands to convert between domain names and ids.
author mjw@wray-m-3.hpl.hp.com
date Thu Jul 29 14:51:30 2004 +0000 (2004-07-29)
parents cfbc2a2c3fea
children d004111c84fe
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Thu Jul 29 14:50:48 2004 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Thu Jul 29 14:51:30 2004 +0000
     1.3 @@ -452,6 +452,40 @@ class ProgMaxmem(Prog):
     1.4  
     1.5  xm.prog(ProgMaxmem)
     1.6  
     1.7 +class ProgDomid(Prog):
     1.8 +    group = 'domain'
     1.9 +    name = 'domid'
    1.10 +    info = 'Convert a domain name to a domain id.'
    1.11 +
    1.12 +    def help(self, args):
    1.13 +        print args[0], "DOM"
    1.14 +        print '\nGet the domain id for the domain with name DOM.'
    1.15 +        
    1.16 +    def main (self, args):
    1.17 +        if len(args) != 2: self.err("%s: Invalid argument(s)" % args[0])
    1.18 +        name = args[1]
    1.19 +        dom = server.xend_domain(name)
    1.20 +        print sxp.child_value(dom, 'id')
    1.21 +
    1.22 +xm.prog(ProgDomid)
    1.23 +
    1.24 +class ProgDomname(Prog):
    1.25 +    group = 'domain'
    1.26 +    name = 'domname'
    1.27 +    info = 'Convert a domain id to a domain name.'
    1.28 +
    1.29 +    def help(self, args):
    1.30 +        print args[0], "DOM"
    1.31 +        print '\nGet the name for the domain with id DOM.'
    1.32 +        
    1.33 +    def main (self, args):
    1.34 +        if len(args) != 2: self.err("%s: Invalid argument(s)" % args[0])
    1.35 +        name = args[1]
    1.36 +        dom = server.xend_domain(name)
    1.37 +        print sxp.child_value(dom, 'name')
    1.38 +
    1.39 +xm.prog(ProgDomname)
    1.40 +
    1.41  class ProgBvt(Prog):
    1.42      group = 'scheduler'
    1.43      name = "bvt"