Useful for restarting the container, e.g. with the following sequence:
session = DBusContainerService().GetSession()
DBusContainerService().Stop(False)
DBusContainerService().Start(session)
def Start(self, session):
do_start(self.args, session)
def Start(self, session):
do_start(self.args, session)
- @dbus.service.method("id.waydro.ContainerManager", in_signature='', out_signature='')
- def Stop(self):
- stop(self.args)
+ @dbus.service.method("id.waydro.ContainerManager", in_signature='b', out_signature='')
+ def Stop(self, quit_session):
+ stop(self.args, quit_session)
@dbus.service.method("id.waydro.ContainerManager", in_signature='', out_signature='')
def Freeze(self):
@dbus.service.method("id.waydro.ContainerManager", in_signature='', out_signature='')
def Freeze(self):
+def stop(args, quit_session=True):
try:
services.hardware_manager.stop(args)
status = helpers.lxc.status(args)
try:
services.hardware_manager.stop(args)
status = helpers.lxc.status(args)
helpers.mount.umount_all(args, tools.config.defaults["data"])
if "session" in args:
helpers.mount.umount_all(args, tools.config.defaults["data"])
if "session" in args:
- try:
- os.kill(int(args.session["pid"]), signal.SIGUSR1)
- except:
- pass
+ if quit_session:
+ try:
+ os.kill(int(args.session["pid"]), signal.SIGUSR1)
+ except:
+ pass
del args.session
except:
pass
del args.session
except:
pass
@dbus.service.method("id.waydro.SessionManager", in_signature='', out_signature='')
def Stop(self):
do_stop(self.args, self.looper)
@dbus.service.method("id.waydro.SessionManager", in_signature='', out_signature='')
def Stop(self):
do_stop(self.args, self.looper)
+ stop_container(quit_session=False)
def service(args, looper):
dbus_obj = DbusSessionManager(looper, dbus.SessionBus(), '/SessionManager', args)
def service(args, looper):
dbus_obj = DbusSessionManager(looper, dbus.SessionBus(), '/SessionManager', args)
def sigint_handler(data):
do_stop(args, mainloop)
def sigint_handler(data):
do_stop(args, mainloop)
+ stop_container(quit_session=False)
def sigusr_handler(data):
do_stop(args, mainloop)
def sigusr_handler(data):
do_stop(args, mainloop)
try:
tools.helpers.ipc.DBusSessionService().Stop()
except dbus.DBusException:
try:
tools.helpers.ipc.DBusSessionService().Stop()
except dbus.DBusException:
+ stop_container(quit_session=True)
+def stop_container(quit_session):
- tools.helpers.ipc.DBusContainerService().Stop()
+ tools.helpers.ipc.DBusContainerService().Stop(quit_session)
except dbus.DBusException:
pass
except dbus.DBusException:
pass