WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Added event dispatch when a VM's power st

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Added event dispatch when a VM's power state changes. Fix the host.enabled and
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 07:30:22 -0700
Delivery-date: Wed, 18 Apr 2007 07:32:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User ewan@xxxxxxxxxxxxxxxxxxxxx
# Date 1176757372 14400
# Node ID 4538426ae5fd9abc6e1f160a567ce56548e62066
# Parent  66242baf79b1bc8c8f267b1cdcc0fa7f7c66005a
Added event dispatch when a VM's power state changes.  Fix the host.enabled and
host.software_version definitions.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |   14 +++++++++-----
 tools/python/xen/xend/XendDomainInfo.py |    3 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff -r 66242baf79b1 -r 4538426ae5fd tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Mon Apr 16 21:21:42 2007 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Mon Apr 16 17:02:52 2007 -0400
@@ -152,14 +152,14 @@ def _ctor_event_dispatch(xenapi, ctor, a
     result = ctor(xenapi, session, *args)
     if result['Status'] == 'Success':
         ref = result['Value']
-        _event_dispatch('add', api_cls, ref, '')
+        event_dispatch('add', api_cls, ref, '')
     return result
 
 
 def _dtor_event_dispatch(xenapi, dtor, api_cls, session, ref, args):
     result = dtor(xenapi, session, ref, *args)
     if result['Status'] == 'Success':
-        _event_dispatch('del', api_cls, ref, '')
+        event_dispatch('del', api_cls, ref, '')
     return result
 
 
@@ -167,11 +167,12 @@ def _setter_event_dispatch(xenapi, sette
                            args):
     result = setter(xenapi, session, ref, *args)
     if result['Status'] == 'Success':
-        _event_dispatch('mod', api_cls, ref, attr_name)
+        event_dispatch('mod', api_cls, ref, attr_name)
     return result
 
 
-def _event_dispatch(operation, api_cls, ref, attr_name):
+def event_dispatch(operation, api_cls, ref, attr_name):
+    assert operation in ['add', 'del', 'mod']
     event = {
         'timestamp' : now(),
         'class'     : api_cls,
@@ -934,7 +935,9 @@ class XendAPI(object):
         return xen_api_success(XEN_API_VERSION_VENDOR)
     def host_get_API_version_vendor_implementation(self, _, ref):
         return xen_api_success(XEN_API_VERSION_VENDOR_IMPLEMENTATION)
-    def host_get_enabled(self, _, _):
+    def host_get_software_version(self, session, host_ref):
+        return xen_api_success(XendNode.instance().xen_version())
+    def host_get_enabled(self, _1, _2):
         return xen_api_success(XendDomain.instance().allow_new_domains())
     def host_get_resident_VMs(self, session, host_ref):
         return xen_api_success(XendDomain.instance().get_domain_refs())
@@ -999,6 +1002,7 @@ class XendAPI(object):
                   'API_version_vendor_implementation':
                   XEN_API_VERSION_VENDOR_IMPLEMENTATION,
                   'software_version': node.xen_version(),
+                  'enabled': XendDomain.instance().allow_new_domains(),
                   'other_config': node.other_config,
                   'resident_VMs': dom.get_domain_refs(),
                   'host_CPUs': node.get_host_cpu_refs(),
diff -r 66242baf79b1 -r 4538426ae5fd tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Apr 16 21:21:42 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Apr 16 17:02:52 2007 -0400
@@ -1986,6 +1986,9 @@ class XendDomainInfo:
             if self.state != state:
                 self.state = state
                 self.state_updated.notifyAll()
+                import XendAPI
+                XendAPI.event_dispatch('mod', 'VM', self.info['uuid'],
+                                       'power_state')
         finally:
             self.state_updated.release()
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Added event dispatch when a VM's power state changes. Fix the host.enabled and, Xen patchbot-unstable <=