From: Vincent Hanquez Date: Thu, 13 Aug 2009 10:06:59 +0000 (+0100) Subject: add ability to start the dbus monitor on session bus instead of system bus X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cb94ab8722273fcb26ac1033099237867954794e;p=xenclient%2Ftoolstack.git add ability to start the dbus monitor on session bus instead of system bus --- diff --git a/xenvm/vmstate.ml b/xenvm/vmstate.ml index d39ec7a..2e771c3 100644 --- a/xenvm/vmstate.ml +++ b/xenvm/vmstate.ml @@ -41,6 +41,7 @@ type locks = { type monitor_state = { mutable monitor_use_dbus: bool; + mutable monitor_use_dbus_session: bool; mutable monitor_use_json: bool; mutable monitor_json_quit: bool; mutable monitor_dbus_quit: bool; @@ -70,6 +71,7 @@ let state_init uuid config_path cfg = vm_uuid = uuid; vm_monitors = { monitor_use_dbus = false; + monitor_use_dbus_session = false; monitor_use_json = true; monitor_json_quit = false; monitor_dbus_quit = false; diff --git a/xenvm/xenvm.ml b/xenvm/xenvm.ml index 01789e8..81a45d3 100644 --- a/xenvm/xenvm.ml +++ b/xenvm/xenvm.ml @@ -650,7 +650,7 @@ let monitor_rpc_json socket state = ) let monitor_rpc_dbus state = - let use_session = false in + let use_session = state.vm_monitors.monitor_use_dbus_session in let match_s = sprintf "type='method',interface='org.xen.vm.%s'" (String.replace "-" "_" state.vm_uuid) in let bus = DBus.Bus.get (if use_session then DBus.Bus.Session else DBus.Bus.System) in DBus.Bus.add_match bus match_s false; @@ -860,6 +860,7 @@ let () = let uuid = ref "" in let daemonize = ref true in let monitor_dbus = ref false in + let monitor_dbus_session = ref false in let monitor_json = ref true in let usage_msg = sprintf "usage: %s [--config ] [--uuid ] [-deprecated]" Sys.argv.(0) in @@ -870,6 +871,7 @@ let () = ("--no-daemonize", Arg.Clear daemonize, "leave the daemon in foreground"); ("--monitor-dbus", Arg.Bool (fun b -> monitor_dbus := b), "a monitor will listen on the dbus"); ("--monitor-json", Arg.Bool (fun b -> monitor_json := b), "a monitor will listen on a unix/json interface"); + ("--monitor-dbus-session", Arg.Set monitor_dbus_session, "dbus monitor will listen on session bus, not system"); ] (fun s -> anon := s :: !anon) usage_msg; if !config = "" && List.length !anon > 0 then ( @@ -918,6 +920,7 @@ let () = ); *) state.vm_monitors.monitor_use_dbus <- !monitor_dbus; + state.vm_monitors.monitor_use_dbus_session <- !monitor_dbus_session; state.vm_monitors.monitor_use_json <- !monitor_json; if !daemonize then