Vinzenz Feenstra has uploaded a new change for review.

Change subject: virt: Introduction of the GuestAgentEvents class
......................................................................

virt: Introduction of the GuestAgentEvents class

This is a convenience class for the guest agent to have callable
functions for the individual events sent to the guest agent on the
guest side.

Change-Id: If9dde856aa43bf130e28ce1ebc8cc7dac0341f45
Bug-Url: https://bugzilla.redhat.com/1298120
Signed-off-by: Vinzenz Feenstra <[email protected]>
---
M vdsm/virt/guestagent.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/51781/1

diff --git a/vdsm/virt/guestagent.py b/vdsm/virt/guestagent.py
index 8b783ac..c3a69ba 100644
--- a/vdsm/virt/guestagent.py
+++ b/vdsm/virt/guestagent.py
@@ -24,6 +24,7 @@
 import errno
 import json
 import re
+import weakref
 
 from vdsm import supervdsm
 from vdsm.infra import filecontrol
@@ -112,6 +113,17 @@
         Exception.__init__(self, message)
 
 
+class GuestAgentEvents(object):
+    def __init__(self, agent):
+        self._agent = weakref.ref(agent)
+
+    def before_migration(self):
+        self._agent.sendLifecycleEvent('before_migration')
+
+    def after_migration(self):
+        self._agent.sendLifecycleEvent('after_migration')
+
+
 class GuestAgent(object):
     MAX_MESSAGE_SIZE = 2 ** 20  # 1 MiB for now
 
@@ -139,6 +151,7 @@
         self._agentTimestamp = 0
         self._channelListener = channelListener
         self._messageState = MessageState.NORMAL
+        self.events = GuestAgentEvents(self)
 
     @property
     def guestStatus(self):


-- 
To view, visit https://gerrit.ovirt.org/51781
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9dde856aa43bf130e28ce1ebc8cc7dac0341f45
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to