ia64/xen-unstable

changeset 1721:3b98f6df869f

bitkeeper revision 1.1053 (40ed42de9JFsw0T591T5jpnZ82grCw)

Quieten down debug and errors.
author mjw@wray-m-3.hpl.hp.com
date Thu Jul 08 12:49:34 2004 +0000 (2004-07-08)
parents 06e9774f9633
children 21d790dad6e6 23258a8bad48
files tools/python/xen/xend/XendClient.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendMigrate.py tools/python/xen/xend/server/SrvBase.py tools/python/xen/xend/server/SrvDaemon.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/netif.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendClient.py	Thu Jul 08 12:05:58 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendClient.py	Thu Jul 08 12:49:34 2004 +0000
     1.3 @@ -19,6 +19,9 @@ import PrettyPrint
     1.4  
     1.5  DEBUG = 0
     1.6  
     1.7 +class XendError(RuntimeError):
     1.8 +    pass
     1.9 +
    1.10  class Foo(httplib.HTTPResponse):
    1.11  
    1.12      def begin(self):
    1.13 @@ -118,7 +121,7 @@ def xend_request(url, method, data=None)
    1.14      if resp.status in [204, 404]:
    1.15          return None
    1.16      if resp.status not in [200, 201, 202, 203]:
    1.17 -        raise RuntimeError(resp.reason)
    1.18 +        raise XendError(resp.reason)
    1.19      pin = sxp.Parser()
    1.20      data = resp.read()
    1.21      if DEBUG: print "***data" , data
     2.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Jul 08 12:05:58 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Jul 08 12:49:34 2004 +0000
     2.3 @@ -8,7 +8,7 @@ import sys
     2.4  import traceback
     2.5  
     2.6  from twisted.internet import defer
     2.7 -defer.Deferred.debug = 1
     2.8 +#defer.Deferred.debug = 1
     2.9  from twisted.internet import reactor
    2.10  
    2.11  import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Jul 08 12:05:58 2004 +0000
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Jul 08 12:49:34 2004 +0000
     3.3 @@ -15,7 +15,7 @@ import sys
     3.4  import os
     3.5  
     3.6  from twisted.internet import defer
     3.7 -defer.Deferred.debug = 1
     3.8 +#defer.Deferred.debug = 1
     3.9  
    3.10  import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
    3.11  import xen.util.ip
     4.1 --- a/tools/python/xen/xend/XendMigrate.py	Thu Jul 08 12:05:58 2004 +0000
     4.2 +++ b/tools/python/xen/xend/XendMigrate.py	Thu Jul 08 12:49:34 2004 +0000
     4.3 @@ -6,7 +6,7 @@ import time
     4.4  
     4.5  from twisted.internet import reactor
     4.6  from twisted.internet import defer
     4.7 -defer.Deferred.debug = 1
     4.8 +#defer.Deferred.debug = 1
     4.9  from twisted.internet.protocol import Protocol
    4.10  from twisted.internet.protocol import ClientFactory
    4.11  
     5.1 --- a/tools/python/xen/xend/server/SrvBase.py	Thu Jul 08 12:05:58 2004 +0000
     5.2 +++ b/tools/python/xen/xend/server/SrvBase.py	Thu Jul 08 12:49:34 2004 +0000
     5.3 @@ -8,7 +8,7 @@ import types
     5.4  import StringIO
     5.5  
     5.6  from twisted.internet import defer
     5.7 -defer.Deferred.debug = 1
     5.8 +#defer.Deferred.debug = 1
     5.9  from twisted.internet import reactor
    5.10  from twisted.web import error
    5.11  from twisted.web import resource
     6.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Thu Jul 08 12:05:58 2004 +0000
     6.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Thu Jul 08 12:49:34 2004 +0000
     6.3 @@ -23,7 +23,7 @@ from twisted.internet import reactor
     6.4  from twisted.internet import protocol
     6.5  from twisted.internet import abstract
     6.6  from twisted.internet import defer
     6.7 -defer.Deferred.debug = 1
     6.8 +#defer.Deferred.debug = 1
     6.9  
    6.10  from xen.lowlevel import xu
    6.11  
     7.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Thu Jul 08 12:05:58 2004 +0000
     7.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Thu Jul 08 12:49:34 2004 +0000
     7.3 @@ -69,7 +69,7 @@ class SrvDomainDir(SrvDir):
     7.4          except Exception, ex:
     7.5              print 'op_create> Exception creating domain:'
     7.6              traceback.print_exc()
     7.7 -            req.setResponseCode(http.BAD_REQUEST, "Error creating domain")
     7.8 +            req.setResponseCode(http.BAD_REQUEST, "Error creating domain: " + str(ex))
     7.9              return str(ex)
    7.10              #return error.ErrorPage(http.BAD_REQUEST,
    7.11              #                       "Error creating domain",
    7.12 @@ -100,7 +100,7 @@ class SrvDomainDir(SrvDir):
    7.13          """Callback to handle errors in deferred domain creation.
    7.14          """
    7.15          print 'op_create> Deferred Exception creating domain:', err
    7.16 -        req.setResponseCode(http.BAD_REQUEST, "Error creating domain")
    7.17 +        req.setResponseCode(http.BAD_REQUEST, "Error creating domain: " + str(err))
    7.18          return str(err)
    7.19  
    7.20      def op_restore(self, op, req):
     8.1 --- a/tools/python/xen/xend/server/blkif.py	Thu Jul 08 12:05:58 2004 +0000
     8.2 +++ b/tools/python/xen/xend/server/blkif.py	Thu Jul 08 12:49:34 2004 +0000
     8.3 @@ -1,7 +1,7 @@
     8.4  # Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
     8.5  
     8.6  from twisted.internet import defer
     8.7 -defer.Deferred.debug = 1
     8.8 +#defer.Deferred.debug = 1
     8.9  
    8.10  from xen.xend import sxp
    8.11  from xen.xend import PrettyPrint
     9.1 --- a/tools/python/xen/xend/server/controller.py	Thu Jul 08 12:05:58 2004 +0000
     9.2 +++ b/tools/python/xen/xend/server/controller.py	Thu Jul 08 12:49:34 2004 +0000
     9.3 @@ -4,7 +4,7 @@ for a domain.
     9.4  """
     9.5  
     9.6  from twisted.internet import defer
     9.7 -defer.Deferred.debug = 1
     9.8 +#defer.Deferred.debug = 1
     9.9  
    9.10  import channel
    9.11  from messages import msgTypeName, printMsg
    10.1 --- a/tools/python/xen/xend/server/netif.py	Thu Jul 08 12:05:58 2004 +0000
    10.2 +++ b/tools/python/xen/xend/server/netif.py	Thu Jul 08 12:49:34 2004 +0000
    10.3 @@ -3,7 +3,7 @@
    10.4  import random
    10.5  
    10.6  from twisted.internet import defer
    10.7 -defer.Deferred.debug = 1
    10.8 +#defer.Deferred.debug = 1
    10.9  
   10.10  from xen.xend import sxp
   10.11  from xen.xend import PrettyPrint
    11.1 --- a/tools/python/xen/xm/create.py	Thu Jul 08 12:05:58 2004 +0000
    11.2 +++ b/tools/python/xen/xm/create.py	Thu Jul 08 12:49:34 2004 +0000
    11.3 @@ -7,7 +7,7 @@ import sys
    11.4  
    11.5  from xen.xend import sxp
    11.6  from xen.xend import PrettyPrint
    11.7 -from xen.xend.XendClient import server
    11.8 +from xen.xend.XendClient import server, XendError
    11.9  
   11.10  from xen.util import console_client
   11.11  
   11.12 @@ -352,13 +352,21 @@ def preprocess(opts, vals):
   11.13           
   11.14  def make_domain(opts, config):
   11.15      """Create, build and start a domain.
   11.16 -    Returns: pair: [int] the ID of the new domain, [int] console port
   11.17 +
   11.18 +    @param opts:   options
   11.19 +    @param config: configuration
   11.20 +    @return: domain id, console port
   11.21 +    @rtype:  (int, int)
   11.22      """
   11.23 -    if opts.vals.load:
   11.24 -        filename = os.path.abspath(opts.vals.load)
   11.25 -        dominfo = server.xend_domain_restore(filename, config)
   11.26 -    else:
   11.27 -        dominfo = server.xend_domain_create(config)
   11.28 +
   11.29 +    try:
   11.30 +        if opts.vals.load:
   11.31 +            filename = os.path.abspath(opts.vals.load)
   11.32 +            dominfo = server.xend_domain_restore(filename, config)
   11.33 +        else:
   11.34 +            dominfo = server.xend_domain_create(config)
   11.35 +    except XendError, ex:
   11.36 +        opts.err(str(ex))
   11.37  
   11.38      dom = int(sxp.child_value(dominfo, 'id'))
   11.39      console_info = sxp.child(dominfo, 'console')
   11.40 @@ -369,7 +377,7 @@ def make_domain(opts, config):
   11.41      
   11.42      if server.xend_domain_unpause(dom) < 0:
   11.43          server.xend_domain_destroy(dom)
   11.44 -        opts.err("Failed to start domain %d" % dom)
   11.45 +        opts.err("Failed to unpause domain %d" % dom)
   11.46      opts.info("Started domain %d, console on port %d"
   11.47                % (dom, console_port))
   11.48      return (dom, console_port)
   11.49 @@ -397,9 +405,9 @@ def main(argv):
   11.50      if opts.vals.dryrun:
   11.51          PrettyPrint.prettyprint(config)
   11.52      else:
   11.53 -        (d, c) = make_domain(opts, config)
   11.54 +        (dom, console) = make_domain(opts, config)
   11.55          if opts.vals.console_autoconnect:
   11.56 -            console_client.connect('localhost', c)
   11.57 +            console_client.connect('localhost', console)
   11.58          
   11.59  if __name__ == '__main__':
   11.60      main(sys.argv)