]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
add ability to start the dbus monitor on session bus instead of system bus
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Thu, 13 Aug 2009 10:06:59 +0000 (11:06 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Thu, 13 Aug 2009 10:06:59 +0000 (11:06 +0100)
xenvm/vmstate.ml
xenvm/xenvm.ml

index d39ec7a6c483794d7e7198313f50eb700ce69624..2e771c3a78f253a71fd1c7b207196722872eaa03 100644 (file)
@@ -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;
index 01789e8807fa506c68387e1c0124ecbed25c8b88..81a45d3a2e1f34fdb51b0a350de27aea9ca14fda 100644 (file)
@@ -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 <config>] [--uuid <uuid>] [<config>-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