socket
let open_monitor_socket uuid name =
- Unixext.mkdir_rec "/var/lib/xenvm" 0o640;
- let filename = sprintf "/var/lib/xenvm/vm-%s" uuid in
+ (* look if we have forced the path to something else *)
+ let dir = try Sys.getenv "XENVM_SOCKET_DIR" with Not_found -> "/var/lib/xenvm" in
+ Unixext.mkdir_rec dir 0o640;
+ let filename = sprintf "%s/vm-%s" dir uuid in
bind_unix_socket filename 10, filename
let close_monitor_socket socket filename = Unix.close socket; Unixext.unlink_safe filename; ()
exception Connect_refused of string
let path_of_socket id =
- Printf.sprintf "/var/lib/xenvm/vm-%s" id
+ let dir = try Sys.getenv "XENVM_SOCKET_DIR" with Not_found -> "/var/lib/xenvm" in
+ Printf.sprintf "%s/vm-%s" dir id
let connect id =
let filename = path_of_socket id in