ia64/xen-unstable

changeset 2155:31a33f49cc2c

bitkeeper revision 1.1159.13.2 (4118a05d8c-7rVahMVITdEqi_yjy1Q)

Modify domain events, add an event when a suspend completes.
author mjw@wray-m-3.hpl.hp.com
date Tue Aug 10 10:15:57 2004 +0000 (2004-08-10)
parents e5f6ec915c89
children 9fe59cdcbfdd
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Tue Aug 10 10:14:28 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue Aug 10 10:15:57 2004 +0000
     1.3 @@ -199,7 +199,7 @@ class XendDomain:
     1.4          self.domain_db[info.id] = info.sxpr()
     1.5          self.domain_by_name[info.name] = info
     1.6          self.sync_domain(info.id)
     1.7 -        if notify: eserver.inject('xend.domain.created', info.name)
     1.8 +        if notify: eserver.inject('xend.domain.created', [info.name, info.id])
     1.9  
    1.10      def _delete_domain(self, id, notify=1):
    1.11          """Remove a domain from the tables.
    1.12 @@ -209,7 +209,7 @@ class XendDomain:
    1.13          """
    1.14          if id in self.domain_by_id:
    1.15              info = self.domain_by_id[id]
    1.16 -            if notify: eserver.inject('xend.domain.died', info.name)
    1.17 +            if notify: eserver.inject('xend.domain.died', [info.name, info.id])
    1.18              if info.name in self.domain_by_name:
    1.19                  del self.domain_by_name[info.name]
    1.20              del self.domain_by_id[id]
    1.21 @@ -239,6 +239,9 @@ class XendDomain:
    1.22                  reason = XendDomainInfo.shutdown_reason(d['shutdown_reason'])
    1.23                  log.debug('XendDomain>reap> shutdown id=%s reason=%s', id, reason)
    1.24                  if reason in ['suspend']:
    1.25 +                    dominfo = self.domain_by_id.get(id)
    1.26 +                    name = (dominfo and dominfo.name) or '??'
    1.27 +                    eserver.inject('xend.domain.suspended', [name, id])
    1.28                      continue
    1.29                  if reason in ['poweroff', 'reboot']:
    1.30                      self.domain_restart_schedule(id, reason)
    1.31 @@ -421,7 +424,7 @@ class XendDomain:
    1.32          @param id: domain id
    1.33          """
    1.34          dominfo = self.domain_lookup(id)
    1.35 -        eserver.inject('xend.domain.unpause', dominfo.name)
    1.36 +        eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.id])
    1.37          try:
    1.38              return xc.domain_unpause(dom=dominfo.dom)
    1.39          except Exception, ex:
    1.40 @@ -433,7 +436,7 @@ class XendDomain:
    1.41          @param id: domain id
    1.42          """
    1.43          dominfo = self.domain_lookup(id)
    1.44 -        eserver.inject('xend.domain.pause', dominfo.name)
    1.45 +        eserver.inject('xend.domain.pause', [dominfo.name, dominfo.id])
    1.46          try:
    1.47              return xc.domain_pause(dom=dominfo.dom)
    1.48          except Exception, ex:
    1.49 @@ -455,7 +458,7 @@ class XendDomain:
    1.50              self.domain_restart_cancel(dominfo.id)
    1.51          else:
    1.52              self.domain_restart_schedule(dominfo.id, reason, force=1)
    1.53 -        eserver.inject('xend.domain.shutdown', [dominfo.name, reason])
    1.54 +        eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.id, reason])
    1.55          if reason == 'halt':
    1.56              reason = 'poweroff'
    1.57          val = xend.domain_shutdown(dominfo.id, reason)
    1.58 @@ -535,7 +538,7 @@ class XendDomain:
    1.59          """
    1.60          dominfo = self.domain_lookup(id)
    1.61          log.info('Destroying domain: name=%s', dominfo.name)
    1.62 -        eserver.inject('xend.domain.destroy', dominfo.name)
    1.63 +        eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.id])
    1.64          if dominfo:
    1.65              val = dominfo.destroy()
    1.66          else: