ia64/xen-unstable

changeset 1766:1858589ab205

bitkeeper revision 1.1075 (40f3d929OFHwDCndxHCAhHnmUAclPg)

Improve error trapping in xm.
Allow nfs_server to override dummy addr.
author mjw@wray-m-3.hpl.hp.com
date Tue Jul 13 12:44:25 2004 +0000 (2004-07-13)
parents 0a953bcc44bb
children 1331621fe269
files tools/python/xen/xend/Args.py tools/python/xen/xend/XendClient.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/Args.py	Tue Jul 13 09:59:23 2004 +0000
     1.2 +++ b/tools/python/xen/xend/Args.py	Tue Jul 13 12:44:25 2004 +0000
     1.3 @@ -107,11 +107,11 @@ class Args:
     1.4  
     1.5      def call_with_args(self, fn, args, xargs=None):
     1.6          (params, keys) = self.get_args(args, xargs=xargs)
     1.7 -        fn(*params, **keys)
     1.8 +        return fn(*params, **keys)
     1.9  
    1.10      def call_with_form_args(self, fn, fargs, xargs=None):
    1.11          (params, keys) = self.get_form_args(fargs, xargs=xargs)
    1.12 -        fn(*params, **keys)
    1.13 +        return fn(*params, **keys)
    1.14  
    1.15  class ArgFn(Args):
    1.16      """Represent a remote HTTP operation as a function.
     2.1 --- a/tools/python/xen/xend/XendClient.py	Tue Jul 13 09:59:23 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendClient.py	Tue Jul 13 12:44:25 2004 +0000
     2.3 @@ -136,7 +136,7 @@ def xend_request(url, method, data=None)
     2.4      #if isinstance(val, types.ListType) and sxp.name(val) == 'val':
     2.5      #    val = val[1]
     2.6      if isinstance(val, types.ListType) and sxp.name(val) == 'err':
     2.7 -        raise RuntimeError(val[1])
     2.8 +        raise XendError(val[1])
     2.9      if DEBUG: print '**val='; sxp.show(val); print
    2.10      return val
    2.11  
     3.1 --- a/tools/python/xen/xm/create.py	Tue Jul 13 09:59:23 2004 +0000
     3.2 +++ b/tools/python/xen/xm/create.py	Tue Jul 13 12:44:25 2004 +0000
     3.3 @@ -347,8 +347,9 @@ def preprocess_ip(opts, vals):
     3.4      setip = (vals.hostname or vals.netmask
     3.5               or vals.gateway or vals.dhcp or vals.interface)
     3.6      if not setip: return
     3.7 +    dummy_nfs_server = '1.2.3.4'
     3.8      ip = (vals.ip
     3.9 -          + ':' + '1.2.3.4'
    3.10 +          + ':' + (vals.nfs_server or dummy_nfs_server)
    3.11            + ':' + vals.gateway
    3.12            + ':' + vals.netmask
    3.13            + ':' + vals.hostname
    3.14 @@ -357,11 +358,9 @@ def preprocess_ip(opts, vals):
    3.15      vals.cmdline_ip = ip
    3.16  
    3.17  def preprocess_nfs(opts, vals):
    3.18 -    if (vals.nfs_root or vals.nfs_server):
    3.19 -        if (not vals.nfs_root) or (not vals.nfs_server):
    3.20 -            opts.err('Must set nfs root and nfs server')
    3.21 -    else:
    3.22 -        return
    3.23 +    if not vals.nfs_root: return
    3.24 +    if not vals.nfs_server:
    3.25 +        opts.err('Must set nfs root and nfs server')
    3.26      nfs = 'nfsroot=' + vals.nfs_server + ':' + vals.nfs_root
    3.27      vals.extra = nfs + ' ' + vals.extra
    3.28      
     4.1 --- a/tools/python/xen/xm/main.py	Tue Jul 13 09:59:23 2004 +0000
     4.2 +++ b/tools/python/xen/xm/main.py	Tue Jul 13 12:44:25 2004 +0000
     4.3 @@ -9,7 +9,7 @@ import socket
     4.4  
     4.5  from xen.xend import PrettyPrint
     4.6  from xen.xend import sxp
     4.7 -from xen.xend.XendClient import server
     4.8 +from xen.xend.XendClient import XendError, server
     4.9  from xen.xend.XendClient import main as xend_client_main
    4.10  from xen.xm import create, shutdown
    4.11  
    4.12 @@ -72,6 +72,8 @@ class Xm:
    4.13          except socket.error, ex:
    4.14              print >>sys.stderr, ex
    4.15              self.err("Error connecting to xend, is xend running?")
    4.16 +        except XendError, ex:
    4.17 +            self.err(str(ex))
    4.18  
    4.19      def main_call(self, args):
    4.20          """Main entry point. Dispatches to the progs.