Fwd: Re: [CRIU] Signalling processes before CRIU/after unCRIU

Andrew Vagin avagin at parallels.com
Thu Oct 11 01:31:43 EDT 2012


> I attached two files:

test_app.py and criu-emu.py are attached to this message.

And one more benefit of dbus is, that it has libraries for all popular
languages (C, C++, java, python, ...)

> test_app.py [OBJ_NAME] - emulate an application, which registers one
> object com.criu.OBJ_NAME. It can be executed several times with
> different names.
> 
> criu-emu.py - emulate crtools. It enumerates all objects com.criu.* and
> executes a method prep() for each of them.
> 
> """
> The method's definition may require certain information to be passed
> with the request as arguments (input parameters). For every request, a
> reply message carries the result back to the requester, along with
> either result data (output parameters) or, if the action could not be
> performed, exception information. Exceptions will contain at least an
> exception name and an error message.
> """
> 
> >From all of this, I can say, that dbus can do all thing, which we need.
> 
> http://www.freedesktop.org/wiki/IntroductionToDBus
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu
-------------- next part --------------
import dbus
import dbus.service
import dbus.glib
import gobject
import sys

class Example(dbus.service.Object):
    def __init__(self, bus_name):
        dbus.service.Object.__init__(self, bus_name, "/com/criu/%s" % sys.argv[1])

    @dbus.service.method(dbus_interface='com.criu.%s' % sys.argv[1],
                         in_signature='v', out_signature='s')
    def prep(self, variant):
        return str(variant)


session_bus = dbus.SessionBus()
name = dbus.service.BusName('com.criu.%s' % sys.argv[1], bus=session_bus)
object = Example(name)

loop = gobject.MainLoop()
loop.run()
-------------- next part --------------
import dbus

session_bus = dbus.SessionBus()

clients = filter(lambda a: "com.criu" in str(a), session_bus.list_names())
for c in clients:
	print c
	proxy = session_bus.get_object(c, "/" + c.replace(".", "/"))
	print proxy.prep("Hi");


More information about the CRIU mailing list