Permalink
Browse files

Add an operation_id to Resource.{attach,detach}

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
  • Loading branch information...
1 parent 0654100 commit 6b3de58155e58741d581fdace8351eeac3c20a9c David Scott committed Feb 12, 2014
Showing with 11 additions and 8 deletions.
  1. +9 −8 dbus/vm/python/dbus-resource-script.py
  2. +2 −0 dbus/vm/resource.xml
@@ -155,7 +155,7 @@ def run(self):
taskMonitor = TaskMonitor()
class Task(dbus.service.Object, threading.Thread):
- def __init__(self, cmd, owner_uri):
+ def __init__(self, cmd, owner_uri, operation_id):
threading.Thread.__init__(self)
self.bus = dbus.SessionBus()
@@ -172,6 +172,7 @@ def __init__(self, cmd, owner_uri):
self.returncode = None
self.auto_destroy = False
self.owner_uri = owner_uri
+ self.operation_id = operation_id
taskMonitor.add(self, owner_uri)
@@ -185,7 +186,7 @@ def __init__(self, cmd, owner_uri):
dbus.service.Object.__init__(self, bus_name, self.path)
- info("%s: running %s" % (self.path, " ".join(cmd)))
+ info("%s: created by %s, running %s" % (self.path, self.operation_id, " ".join(cmd)))
self.start()
@dbus.service.signal(dbus_interface=TASK_INTERFACE)
@@ -266,12 +267,12 @@ def __init__(self):
bus_name = dbus.service.BusName(name, bus=self.bus)
dbus.service.Object.__init__(self, bus_name, "/" + name.replace(".", "/"))
- @dbus.service.method(dbus_interface=RESOURCE_INTERFACE, in_signature="ss", out_signature="s")
- def attach(self, global_uri, owner_uri):
- return Task([script, "attach", global_uri], owner_uri).uri
- @dbus.service.method(dbus_interface=RESOURCE_INTERFACE, in_signature="ss", out_signature="s")
- def detach(self, id, owner_uri):
- return Task([script, "detach", id], owner_uri).uri
+ @dbus.service.method(dbus_interface=RESOURCE_INTERFACE, in_signature="sss", out_signature="s")
+ def attach(self, global_uri, owner_uri, operation_id):
+ return Task([script, "attach", global_uri], owner_uri, operation_id).uri
+ @dbus.service.method(dbus_interface=RESOURCE_INTERFACE, in_signature="sss", out_signature="s")
+ def detach(self, id, owner_uri, operation_id):
+ return Task([script, "detach", id], owner_uri, operation_id).uri
gobject.threads_init()
DBusGMainLoop(set_as_default=True)
View
@@ -3,11 +3,13 @@
<method name="attach">
<arg name="global_uri" type="s" direction="in"/>
<arg name="owner_uri" type="s" direction="in"/>
+ <arg name="operation_id" type="s" direction="in"/>
<arg name="task" type="o" direction="out"/>
</method>
<method name="detach">
<arg name="id" type="s" direction="in"/>
<arg name="owner_uri" type="s" direction="in"/>
+ <arg name="operation_id" type="s" direction="in"/>
<arg name="task" type="o" direction="out"/>
</method>
</interface>

0 comments on commit 6b3de58

Please sign in to comment.