ia64/xen-unstable

changeset 1528:f394dae9278b

bitkeeper revision 1.990.2.9 (40d6f5f8xz_AYQRSIovsE9CVdGY9aQ)

Remove consoles when domains die.
Some other small fixes.
author mjw@wray-m-3.hpl.hp.com
date Mon Jun 21 14:51:36 2004 +0000 (2004-06-21)
parents 025909f2f72d
children 2c0b02513019
files tools/xenmgr/lib/EventServer.py tools/xenmgr/lib/XendConsole.py tools/xenmgr/lib/server/SrvConsoleServer.py tools/xenmgr/lib/server/controller.py tools/xenmgr/lib/xm/main.py
line diff
     1.1 --- a/tools/xenmgr/lib/EventServer.py	Mon Jun 21 13:55:03 2004 +0000
     1.2 +++ b/tools/xenmgr/lib/EventServer.py	Mon Jun 21 14:51:36 2004 +0000
     1.3 @@ -85,7 +85,8 @@ class EventServer:
     1.4          hl = self.handlers.get(event)
     1.5          if hl is None:
     1.6              return
     1.7 -        hl.remove(handler)
     1.8 +        if handler in hl:
     1.9 +            hl.remove(handler)
    1.10  
    1.11      def inject(self, event, val):
    1.12          """Inject an event. Handlers for it are called if runing, otherwise
     2.1 --- a/tools/xenmgr/lib/XendConsole.py	Mon Jun 21 13:55:03 2004 +0000
     2.2 +++ b/tools/xenmgr/lib/XendConsole.py	Mon Jun 21 14:51:36 2004 +0000
     2.3 @@ -104,8 +104,10 @@ class XendConsole:
     2.4                  self._delete_console(c.id)
     2.5  
     2.6      def onDomainDied(self, event, val):
     2.7 +        print 'onDomainDied', "dom=", dom,
     2.8          dom = int(val)
     2.9          for c in self.consoles():
    2.10 +            print 'onDomainDied', "dom=", dom, "dom1=", c.dom1, "dom2=", c.dom2
    2.11              if (c.dom1 == dom) or (c.dom2 == dom):
    2.12                  self._delete_console(c.id)
    2.13  
     3.1 --- a/tools/xenmgr/lib/server/SrvConsoleServer.py	Mon Jun 21 13:55:03 2004 +0000
     3.2 +++ b/tools/xenmgr/lib/server/SrvConsoleServer.py	Mon Jun 21 14:51:36 2004 +0000
     3.3 @@ -291,6 +291,12 @@ class EventProtocol(protocol.Protocol):
     3.4              else:
     3.5                  self.send_error()
     3.6  
     3.7 +    def loseConnection(self):
     3.8 +        if self.transport:
     3.9 +            self.transport.loseConnection()
    3.10 +        if self.connected:
    3.11 +            reactor.callLater(0, self.connectionLost)
    3.12 +
    3.13      def connectionLost(self, reason=None):
    3.14          self.unsubscribe()
    3.15  
    3.16 @@ -663,7 +669,7 @@ class Daemon:
    3.17          """
    3.18          dom = int(id)
    3.19          if dom <= 0: return 0 
    3.20 -        return xc.domain_destroy(dom=dom, force=0)
    3.21 +        return xc.domain_destroy(dom=dom, force=force)
    3.22      
    3.23  
    3.24  def instance():
     4.1 --- a/tools/xenmgr/lib/server/controller.py	Mon Jun 21 13:55:03 2004 +0000
     4.2 +++ b/tools/xenmgr/lib/server/controller.py	Mon Jun 21 14:51:36 2004 +0000
     4.3 @@ -37,9 +37,7 @@ class CtrlMsgRcvr:
     4.4      
     4.5      def registerChannel(self):
     4.6          self.channel = self.channelFactory.domChannel(self.dom)
     4.7 -        #print 'registerChannel> channel=', self.channel, self
     4.8          self.idx = self.channel.getIndex()
     4.9 -        #print 'registerChannel> idx=', self.idx
    4.10          if self.majorTypes:
    4.11              self.channel.registerDevice(self.majorTypes, self)
    4.12          
    4.13 @@ -90,7 +88,7 @@ class ControllerFactory(CtrlMsgRcvr):
    4.14          return None
    4.15  
    4.16      def delInstance(self, instance):
    4.17 -        if instance in self.instances:
    4.18 +        if instance.idx in self.instances:
    4.19              del self.instances[instance.idx]
    4.20  
    4.21      def createInstance(self, dom):
     5.1 --- a/tools/xenmgr/lib/xm/main.py	Mon Jun 21 13:55:03 2004 +0000
     5.2 +++ b/tools/xenmgr/lib/xm/main.py	Mon Jun 21 14:51:36 2004 +0000
     5.3 @@ -76,6 +76,7 @@ class Xm:
     5.4          """List domains."""
     5.5          if help: self.help('xm_' + args[0], args); return
     5.6          doms = server.xend_domains()
     5.7 +        doms.sort()
     5.8          print 'Dom  Name             Mem(MB)  CPU  State  Time(s)'
     5.9          for dom in doms:
    5.10              info = server.xend_domain(dom)
    5.11 @@ -86,7 +87,7 @@ class Xm:
    5.12              d['cpu'] = int(sxp.child_value(info, 'cpu', '0'))
    5.13              d['state'] = sxp.child_value(info, 'state', '??')
    5.14              d['cpu_time'] = float(sxp.child_value(info, 'cpu_time', '0'))
    5.15 -            print ("%(dom)-4d %(name)-16s %(mem)4d     %(cpu)3d %(state)5s %(cpu_time)10.2f" % d)
    5.16 +            print ("%(dom)-4d %(name)-16s %(mem)7d  %(cpu)3d  %(state)5s  %(cpu_time)7.1f" % d)
    5.17  
    5.18      def xm_domain(self, help, args):
    5.19          """Get information about a domain."""
    5.20 @@ -144,32 +145,6 @@ class Xm:
    5.21          v = map(int, args[1:3])
    5.22          server.xend_domain_pincpu(*v)
    5.23  
    5.24 -##     def xm_vif_stats(self, help, args):
    5.25 -##         """Get stats for a virtual interface."""
    5.26 -##         if help:
    5.27 -##             print args[0], 'DOM VIF'
    5.28 -##             print '\nGet stats for interface VIF on domain DOM.'
    5.29 -##             return
    5.30 -##         if len(args) != 3: self.err("%s: Invalid argument(s)" % args[0])
    5.31 -##         v = map(int, args[1:3])
    5.32 -##         print server.xend_domain_vif_stats(*v)
    5.33 -
    5.34 -##     def xm_vif_rate(self, help, args):
    5.35 -##         """Set or get vif rate params."""
    5.36 -##         if help:
    5.37 -##             print args[0], "DOM VIF [BYTES USECS]"
    5.38 -##             print '\nSet or get rate controls for interface VIF on domain DOM.'
    5.39 -##             return
    5.40 -##         n = len(args)
    5.41 -##         if n == 3:
    5.42 -##             v = map(int, args[1:n])
    5.43 -##             print server.xend_domain_vif_scheduler_get(*v)
    5.44 -##         elif n == 5:
    5.45 -##             v = map(int, args[1:n])
    5.46 -##             server.xend_domain_vif_scheduler_set(*v)
    5.47 -##         else:
    5.48 -##             self.err("%s: Invalid argument(s)" % args[0])
    5.49 -
    5.50      def xm_bvt(self, help, args):
    5.51          """Set BVT scheduler parameters."""
    5.52          if help: