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;
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;
)
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;
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 <config>] [--uuid <uuid>] [<config>-deprecated]" Sys.argv.(0) in
("--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 (
);
*)
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