Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes required for the renaming of the xen ocaml packages

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
  • Loading branch information...
commit 6314f5dd8c2f7b87df2d0c8452b7290d4d7ffc3f 1 parent cbb71bb
@jonludlam jonludlam authored
Showing with 669 additions and 630 deletions.
  1. +2 −2 ocaml/xapi/OMakefile
  2. +1 −0  ocaml/xapi/console_text.ml
  3. +9 −9 ocaml/xapi/create_misc.ml
  4. +18 −17 ocaml/xapi/dbsync_slave.ml
  5. +7 −6 ocaml/xapi/events.ml
  6. +2 −1  ocaml/xapi/fakeguestagent.ml
  7. +2 −2 ocaml/xapi/helpers.ml
  8. +5 −5 ocaml/xapi/memory_control.mli
  9. +29 −29 ocaml/xapi/monitor.ml
  10. +1 −1  ocaml/xapi/monitor_types.ml
  11. +1 −0  ocaml/xapi/mtc.ml
  12. +3 −3 ocaml/xapi/pciops.ml
  13. +6 −6 ocaml/xapi/pciops.mli
  14. +5 −5 ocaml/xapi/quicktest_lifecycle.ml
  15. +1 −0  ocaml/xapi/sparse_dd.ml
  16. +9 −8 ocaml/xapi/vmops.ml
  17. +1 −1  ocaml/xapi/vmopshelpers.ml
  18. +11 −10 ocaml/xapi/xapi.ml
  19. +4 −4 ocaml/xapi/xapi_guest_agent.ml
  20. +1 −1  ocaml/xapi/xapi_ha.ml
  21. +2 −2 ocaml/xapi/xapi_host.ml
  22. +1 −0  ocaml/xapi/xapi_vif.ml
  23. +17 −16 ocaml/xapi/xapi_vm.ml
  24. +7 −6 ocaml/xapi/xapi_vm_helpers.ml
  25. +6 −6 ocaml/xapi/xapi_vm_migrate.ml
  26. +2 −1  ocaml/xapi/xapi_vm_snapshot.ml
  27. +2 −2 ocaml/xapi/xapi_xenops_errors.ml
  28. +2 −2 ocaml/xapi/xen_helpers.ml
  29. +1 −1  ocaml/xapi/xenstore_copy.ml
  30. +2 −1  ocaml/xapi/xenstore_dump.ml
  31. +2 −2 ocaml/xapi/xenstore_dump.mli
  32. +1 −1  ocaml/xe-cli/OMakefile
  33. +3 −3 ocaml/xenops/OMakefile
  34. +2 −1  ocaml/xenops/balloon.ml
  35. +1 −1  ocaml/xenops/balloon.mli
  36. +7 −7 ocaml/xenops/dbgring.ml
  37. +37 −36 ocaml/xenops/device.ml
  38. +55 −55 ocaml/xenops/device.mli
  39. +5 −4 ocaml/xenops/device_common.ml
  40. +16 −16 ocaml/xenops/device_common.mli
  41. +65 −64 ocaml/xenops/domain.ml
  42. +37 −37 ocaml/xenops/domain.mli
  43. +4 −4 ocaml/xenops/fence.ml
  44. +5 −4 ocaml/xenops/hotplug.ml
  45. +22 −22 ocaml/xenops/list_domains.ml
  46. +10 −10 ocaml/xenops/memory.ml
  47. +14 −13 ocaml/xenops/memory_breakdown.ml
  48. +8 −8 ocaml/xenops/memory_summary.ml
  49. +1 −1  ocaml/xenops/netman.ml
  50. +44 −43 ocaml/xenops/squeeze_xen.ml
  51. +2 −1  ocaml/xenops/squeezed.ml
  52. +4 −3 ocaml/xenops/squeezed_rpc.ml
  53. +1 −0  ocaml/xenops/squeezed_state.ml
  54. +2 −1  ocaml/xenops/stubdom.ml
  55. +1 −1  ocaml/xenops/stubdom.mli
  56. +15 −14 ocaml/xenops/tests.ml
  57. +4 −3 ocaml/xenops/watch.ml
  58. +1 −1  ocaml/xenops/watch.mli
  59. +1 −0  ocaml/xenops/watch_test.ml
  60. +34 −33 ocaml/xenops/xal.ml
  61. +4 −4 ocaml/xenops/xal.mli
  62. +2 −0  ocaml/xenops/{xenbus.ml → xenbus_utils.ml}
  63. +12 −12 ocaml/xenops/xenguestHelper.ml
  64. +58 −57 ocaml/xenops/xenops.ml
  65. +3 −2 ocaml/xenops/xenops_helpers.ml
  66. +3 −2 ocaml/xenops/xenstore_readdir.ml
  67. +1 −1  ocaml/xiu/OMakefile
  68. +17 −15 ocaml/xiu/xiu.ml
  69. +1 −1  ocaml/xstest/OMakefile
  70. +1 −0  ocaml/xstest/bm.ml
  71. +1 −0  ocaml/xstest/common.ml
  72. +1 −0  ocaml/xstest/perms.ml
  73. +1 −0  ocaml/xstest/xstest.ml
View
4 ocaml/xapi/OMakefile
@@ -1,4 +1,4 @@
-OCAMLPACKS = xml-light2 cdrom pciutil sexpr log stunnel http-svr rss xen-utils netdev tapctl vhd xs rpc-light
+OCAMLPACKS = xml-light2 cdrom pciutil sexpr log stunnel http-svr rss xen-utils netdev tapctl vhd xenstore rpc-light
OCAML_LIBS = ../util/version ../util/vm_memory_constraints ../util/sanitycheck ../util/stats \
../idl/ocaml_backend/common ../idl/ocaml_backend/client ../idl/ocaml_backend/server ../util/ocamltest
OCAMLINCLUDES = ../idl ../idl/ocaml_backend \
@@ -17,7 +17,7 @@ CFLAGS += -std=gnu99 -Wall -Werror -I$(shell ocamlc -where)
# (the same holds for OCaml packages)
XEN_OCAML_LIBS = ../xenops/xenops ../auth/pam
XEN_OCAMLINCLUDES =
-XEN_OCAMLPACKS = xc xs cpuid
+XEN_OCAMLPACKS = xenctrl xenstore cpuid
OCAML_CLIBS = $(XEN_OCAML_CLIBS) $(OCAML_CLIBS)
OCAML_LINK_FLAGS = $(XEN_OCAML_LINK_FLAGS) $(OCAML_LINK_FLAGS)
CFLAGS = $(XEN_CFLAGS) $(CFLAGS)
View
1  ocaml/xapi/console_text.ml
@@ -17,6 +17,7 @@ open Printf
open Debug
open Http
open Vmopshelpers
+open Xenstore
exception Failure
View
18 ocaml/xapi/create_misc.ml
@@ -43,10 +43,10 @@ type host_info = {
let read_localhost_info () =
let xen_verstring =
- let xc = Xc.interface_open () in
- let v = Xc.version xc in
- Xc.interface_close xc;
- Printf.sprintf "%d.%d%s" v.Xc.major v.Xc.minor v.Xc.extra
+ let xc = Xenctrl.interface_open () in
+ let v = Xenctrl.version xc in
+ Xenctrl.interface_close xc;
+ Printf.sprintf "%d.%d%s" v.Xenctrl.major v.Xenctrl.minor v.Xenctrl.extra
and linux_verstring =
let verstring = ref "" in
let f line =
@@ -393,10 +393,10 @@ let make_software_version () =
let create_host_cpu ~__context =
let get_nb_cpus () =
- let xc = Xc.interface_open () in
- let p = Xc.physinfo xc in
- Xc.interface_close xc;
- p.Xc.nr_cpus
+ let xc = Xenctrl.interface_open () in
+ let p = Xenctrl.physinfo xc in
+ Xenctrl.interface_close xc;
+ p.Xenctrl.nr_cpus
in
let trim_end s =
let i = ref (String.length s - 1) in
@@ -496,7 +496,7 @@ let create_chipset_info ~__context =
let host = Helpers.get_localhost ~__context in
let current_info = Db.Host.get_chipset_info ~__context ~self:host in
let iommu =
- let xen_dmesg = Vmopshelpers.with_xc (fun xc -> Xc.readconsolering xc) in
+ let xen_dmesg = Vmopshelpers.with_xc (fun xc -> Xenctrl.readconsolering xc) in
if String.has_substr xen_dmesg "I/O virtualisation enabled" then
"true"
else if String.has_substr xen_dmesg "I/O virtualisation disabled" then
View
35 ocaml/xapi/dbsync_slave.ml
@@ -22,6 +22,7 @@ open Vmopshelpers
open Create_misc
open Client
open Pervasiveext
+open Xenstore
module D=Debug.Debugger(struct let name="dbsync" end)
open D
@@ -82,7 +83,7 @@ let refresh_localhost_info ~__context info =
Db.Host.set_API_version_major ~__context ~self:host ~value:Xapi_globs.api_version_major;
Db.Host.set_API_version_minor ~__context ~self:host ~value:Xapi_globs.api_version_minor;
Db.Host.set_hostname ~__context ~self:host ~value:info.hostname;
- let caps = String.split ' ' (Xc.with_intf (fun xc -> Xc.version_capabilities xc)) in
+ let caps = String.split ' ' (Xenctrl.with_intf (fun xc -> Xenctrl.version_capabilities xc)) in
Db.Host.set_capabilities ~__context ~self:host ~value:caps;
Db.Host.set_address ~__context ~self:host ~value:(get_my_ip_addr());
@@ -138,9 +139,9 @@ let update_vms ~xal ~__context =
List.iter (fun self -> Xapi_vbd_helpers.clear_current_operations ~__context ~self) (Db.VM.get_VBDs ~__context ~self:vm);
force_state_reset ~__context ~self:vm ~value:state in
- let all_my_domains = Xc.domain_getinfolist xc 0 in
- let my_active_domains = List.filter (fun dinfo -> (not dinfo.Xc.dying) && (not dinfo.Xc.shutdown)) all_my_domains in
- let my_shutdown_domains = List.filter (fun dinfo -> dinfo.Xc.shutdown) all_my_domains in
+ let all_my_domains = Xenctrl.domain_getinfolist xc 0 in
+ let my_active_domains = List.filter (fun dinfo -> (not dinfo.Xenctrl.dying) && (not dinfo.Xenctrl.shutdown)) all_my_domains in
+ let my_shutdown_domains = List.filter (fun dinfo -> dinfo.Xenctrl.shutdown) all_my_domains in
let this_host = Helpers.get_localhost __context in
(* CA-22309: consider this host to 'own' a domain if:
@@ -171,7 +172,7 @@ let update_vms ~xal ~__context =
let my_running_vm_refs_according_to_db = List.map fst my_running_vms_according_to_db in
let uuid_from_dinfo dinfo =
- Uuid.to_string (Uuid.uuid_of_int_array dinfo.Xc.handle) in
+ Uuid.to_string (Uuid.uuid_of_int_array dinfo.Xenctrl.handle) in
let uuid_from_vmref vmref =
try
@@ -255,31 +256,31 @@ let update_vms ~xal ~__context =
or rebooted, which would always have the power state to Halted or Running)
We start it again by setting the domain's state to shutdown with reason reboot (the event
thread will do the hard work for us). *)
- if dinfo.Xc.paused && not(dinfo.Xc.shutdown) && dinfo.Xc.cpu_time = 0L &&
+ if dinfo.Xenctrl.paused && not(dinfo.Xenctrl.shutdown) && dinfo.Xenctrl.cpu_time = 0L &&
(vmrec.API.vM_power_state <> `Paused) then begin
warn "domain id %d uuid %s is paused but not in the database as paused; assuming it's broken; rebooting"
- dinfo.Xc.domid (uuid_from_vmref vmref);
+ dinfo.Xenctrl.domid (uuid_from_vmref vmref);
(* Mark the domain as shutdown(reboot), the power state as running and inject
a fake event into the event system. This should provoke the event thread into
restarting the VM *)
- Xc.domain_shutdown xc dinfo.Xc.domid Xc.Reboot;
- set_db_state_and_domid vmref `Running dinfo.Xc.domid;
- Events.callback_release xal dinfo.Xc.domid (Uuid.string_of_uuid (Uuid.uuid_of_int_array dinfo.Xc.handle))
+ Xenctrl.domain_shutdown xc dinfo.Xenctrl.domid Xenctrl.Reboot;
+ set_db_state_and_domid vmref `Running dinfo.Xenctrl.domid;
+ Events.callback_release xal dinfo.Xenctrl.domid (Uuid.string_of_uuid (Uuid.uuid_of_int_array dinfo.Xenctrl.handle))
end else begin
(* Reset the power state, this also clears VBD operations etc *)
- let state = if dinfo.Xc.paused then `Paused else `Running in
- set_db_state_and_domid vmref state dinfo.Xc.domid;
+ let state = if dinfo.Xenctrl.paused then `Paused else `Running in
+ set_db_state_and_domid vmref state dinfo.Xenctrl.domid;
end;
(* Now sync devices *)
debug "syncing devices and registering vm for monitoring: %s" (uuid_from_dinfo dinfo);
- let uuid = Uuid.uuid_of_int_array dinfo.Xc.handle in
+ let uuid = Uuid.uuid_of_int_array dinfo.Xenctrl.handle in
sync_devices dinfo;
(* Update the VM's guest metrics since: (i) while we were offline we may
have missed an update; and (ii) if the tools .iso has been updated then
we wish to re-evaluate whether we believe the VMs have up-to-date
tools *)
- Events.guest_agent_update xal dinfo.Xc.domid (uuid_from_dinfo dinfo);
+ Events.guest_agent_update xal dinfo.Xenctrl.domid (uuid_from_dinfo dinfo);
(* Now register with monitoring thread *)
Monitor_rrds.load_rrd ~__context (Uuid.to_string uuid) false
@@ -291,16 +292,16 @@ let update_vms ~xal ~__context =
let vmref,vmrec = vmrefrec_of_dinfo dinfo in
if vmrec.API.vM_resident_on = this_host then begin
debug "VM is apparently resident on this host; injecting a fake event into the event thread";
- Events.callback_release xal dinfo.Xc.domid (Uuid.string_of_uuid (Uuid.uuid_of_int_array dinfo.Xc.handle))
+ Events.callback_release xal dinfo.Xenctrl.domid (Uuid.string_of_uuid (Uuid.uuid_of_int_array dinfo.Xenctrl.handle))
end else begin
debug "VM is not resident on this host; destroying remnant of managed domain";
- Domain.destroy ~xc ~xs dinfo.Xc.domid
+ Domain.destroy ~xc ~xs dinfo.Xenctrl.domid
end in
(* Process an "unmanaged domain" that's running here *)
let unmanaged_domain_running dinfo =
debug "killing umanaged domain: %s" (uuid_from_dinfo dinfo);
- Domain.destroy ~xc ~xs dinfo.Xc.domid (* bye-bye... *) in
+ Domain.destroy ~xc ~xs dinfo.Xenctrl.domid (* bye-bye... *) in
let have_record_for dinfo = try let _,_ = vmrefrec_of_dinfo dinfo in true with _ -> false in
View
13 ocaml/xapi/events.ml
@@ -16,6 +16,7 @@ open Vmopshelpers
open Pervasiveext
open Threadext
open Listext
+open Xenstore
module D = Debug.Debugger(struct let name = "event" end)
open D
@@ -61,7 +62,7 @@ module Crashdump = struct
let fd = Unix.openfile filename [ Unix.O_WRONLY; Unix.O_CREAT;
Unix.O_TRUNC; ] 0o640 in
Pervasiveext.finally (fun () ->
- with_xc (fun xc -> Xc.coredump xc domid fd);
+ with_xc (fun xc -> Xenctrl.coredump xc domid fd);
) (fun () -> Unix.close fd)
)
@@ -363,7 +364,7 @@ module Resync = struct
end else begin
with_xc
(fun xc ->
- let dom = Xc.domain_getinfo xc domid in
+ let dom = Xenctrl.domain_getinfo xc domid in
if Xal.is_running dom then begin
debug "VM %s (domid %d) is still running; taking no action" vm' domid;
false (* no action taken *)
@@ -471,7 +472,7 @@ let callback_devices ctx domid dev_event =
try
let vif =
try Ref.of_string (xs.Xs.read (private_data_path ^ "/ref"))
- with Xb.Noent -> Helpers.vif_of_devid ~__context ~vm (int_of_string devid) in
+ with Xenbus.Xb.Noent -> Helpers.vif_of_devid ~__context ~vm (int_of_string devid) in
let work_item ~__context token =
Resync.vif ~__context token vm vif
in
@@ -598,8 +599,8 @@ let guest_agent_update ctx domid uuid =
(fun () ->
let xs = Xal.xs_of_ctx ctx in
let path = xs.Xs.getdomainpath domid in
- let lookup (key: string) = try Some (xs.Xs.read (path ^ "/" ^ key)) with Xb.Noent -> None in
- let list (dir: string) = try List.filter (fun x -> x <> "") (xs.Xs.directory (path ^ dir)) with Xb.Noent -> [] in
+ let lookup (key: string) = try Some (xs.Xs.read (path ^ "/" ^ key)) with Xenbus.Xb.Noent -> None in
+ let list (dir: string) = try List.filter (fun x -> x <> "") (xs.Xs.directory (path ^ dir)) with Xenbus.Xb.Noent -> [] in
(* NB Xapi_guest_agent.all is robust to spurious events *)
Server_helpers.exec_with_new_task (Printf.sprintf "Event thread updating guest metrics (domid: %d)" domid)
(fun __context -> Xapi_guest_agent.all lookup list ~__context ~domid ~uuid)
@@ -621,7 +622,7 @@ let callback_memory_target ctx domid =
(fun () ->
let xs = Xal.xs_of_ctx ctx in
let path = xs.Xs.getdomainpath domid in
- let target = try Some (Int64.mul 1024L (Int64.of_string (xs.Xs.read (path ^ "/memory/target")))) with Xb.Noent -> None in
+ let target = try Some (Int64.mul 1024L (Int64.of_string (xs.Xs.read (path ^ "/memory/target")))) with Xenbus.Xb.Noent -> None in
Opt.iter (fun t -> Mutex.execute Monitor.memory_targets_m (fun () -> Hashtbl.replace Monitor.memory_targets domid t)) target;
) ()
View
3  ocaml/xapi/fakeguestagent.ml
@@ -18,6 +18,7 @@
open Printf
open Pervasiveext
+open Xenstore
let debug_enabled = ref false
let debug (fmt: ('a, unit, string, unit) format4) =
@@ -78,7 +79,7 @@ let _ =
do
Xal.wait xal 5.;
- let currents = List.map (fun dominfo -> dominfo.Xc.domid) (Xc.domain_getinfolist (Xal.xc_of_ctx xal) 1) in
+ let currents = List.map (fun dominfo -> dominfo.Xenctrl.domid) (Xenctrl.domain_getinfolist (Xal.xc_of_ctx xal) 1) in
List.iter (fun domid ->
debug "writing guest data to domain %d" domid;
let path = sprintf "/local/domain/%d" domid in
View
4 ocaml/xapi/helpers.ml
@@ -370,8 +370,8 @@ let vif_of_devid ~__context ~vm devid =
domid might immediately change after the call returns. Caller beware! *)
let domid_of_vm ~__context ~self =
let uuid = Uuid.uuid_of_string (Db.VM.get_uuid ~__context ~self) in
- let all = Xc.with_intf (fun xc -> Xc.domain_getinfolist xc 0) in
- let uuid_to_domid = List.map (fun di -> Uuid.uuid_of_int_array di.Xc.handle, di.Xc.domid) all in
+ let all = Xenctrl.with_intf (fun xc -> Xenctrl.domain_getinfolist xc 0) in
+ let uuid_to_domid = List.map (fun di -> Uuid.uuid_of_int_array di.Xenctrl.handle, di.Xenctrl.domid) all in
if List.mem_assoc uuid uuid_to_domid
then List.assoc uuid uuid_to_domid
else -1 (* for backwards compat with old behaviour *)
View
10 ocaml/xapi/memory_control.mli
@@ -26,19 +26,19 @@
*)
(** reserve [kib] KiB of memory for some undisclosed purpose, return a reservation_id *)
-val reserve_memory: __context:Context.t -> xc:Xc.handle -> xs:Xs.xsh -> kib:int64 -> string
+val reserve_memory: __context:Context.t -> xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> kib:int64 -> string
(** reserve between [min] and [max] KiB of memory for some undisclosed purpose, return the actual amount plus reservation_id *)
-val reserve_memory_range: __context:Context.t -> xc:Xc.handle -> xs:Xs.xsh -> min:int64 -> max:int64 -> int64 * string
+val reserve_memory_range: __context:Context.t -> xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> min:int64 -> max:int64 -> int64 * string
(** Transfer the memory reserved by [reservation_id] to domain [domid] *)
-val transfer_reservation_to_domain: __context:Context.t -> xs:Xs.xsh -> reservation_id:string -> domid:int -> unit
+val transfer_reservation_to_domain: __context:Context.t -> xs:Xenstore.Xs.xsh -> reservation_id:string -> domid:int -> unit
(** Delete the reservation given by [reservation_id] *)
-val delete_reservation: __context:Context.t -> xs:Xs.xsh -> reservation_id:string -> unit
+val delete_reservation: __context:Context.t -> xs:Xenstore.Xs.xsh -> reservation_id:string -> unit
(** After some domain destruction event (or possibly other memory-changing event), rebalance memory allocations *)
-val balance_memory: __context:Context.t -> xc:Xc.handle -> xs:Xs.xsh -> unit
+val balance_memory: __context:Context.t -> xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> unit
(** Arrange to have at least one more memory rebalance happen in the future *)
val async_balance_memory: At_least_once_more.manager
View
58 ocaml/xapi/monitor.ml
@@ -56,15 +56,15 @@ let uncooperative_domains: (int, unit) Hashtbl.t = Hashtbl.create 20
let uncooperative_domains_m = Mutex.create ()
let uuid_of_domid domains domid =
- let domid_to_uuid = List.map (fun di -> di.Xc.domid, Uuid.uuid_of_int_array di.Xc.handle) domains in
+ let domid_to_uuid = List.map (fun di -> di.Xenctrl.domid, Uuid.uuid_of_int_array di.Xenctrl.handle) domains in
if List.mem_assoc domid domid_to_uuid
then Uuid.string_of_uuid (List.assoc domid domid_to_uuid)
else failwith (Printf.sprintf "Failed to find uuid corresponding to domid: %d" domid)
let get_uncooperative_domains () =
let domids = Mutex.execute uncooperative_domains_m (fun () -> Hashtbl.fold (fun domid _ acc -> domid::acc) uncooperative_domains []) in
- let dis = Xc.with_intf (fun xc -> Xc.domain_getinfolist xc 0) in
- let domid_to_uuid = List.map (fun di -> di.Xc.domid, Uuid.uuid_of_int_array di.Xc.handle) dis in
+ let dis = Xenctrl.with_intf (fun xc -> Xenctrl.domain_getinfolist xc 0) in
+ let domid_to_uuid = List.map (fun di -> di.Xenctrl.domid, Uuid.uuid_of_int_array di.Xenctrl.handle) dis in
let uuids = List.concat (List.map (fun domid -> if List.mem_assoc domid domid_to_uuid then [ List.assoc domid domid_to_uuid ] else []) domids) in
List.map Uuid.string_of_uuid uuids
@@ -76,30 +76,30 @@ let get_uncooperative_domains () =
VMs present on this host *)
let update_vcpus xc doms =
List.fold_left (fun (dss,uuids,domids) dom ->
- let domid = dom.Xc.domid in
- let maxcpus = dom.Xc.max_vcpu_id + 1 in
- let uuid = Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle) in
+ let domid = dom.Xenctrl.domid in
+ let maxcpus = dom.Xenctrl.max_vcpu_id + 1 in
+ let uuid = Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xenctrl.handle) in
let rec cpus i dss =
if i>=maxcpus then dss else
- let vcpuinfo = Xc.domain_get_vcpuinfo xc domid i in
+ let vcpuinfo = Xenctrl.domain_get_vcpuinfo xc domid i in
cpus (i+1) ((VM uuid,ds_make ~name:(Printf.sprintf "cpu%d" i)
~description:(Printf.sprintf "CPU%d usage" i)
- ~value:(Rrd.VT_Float ((Int64.to_float vcpuinfo.Xc.cputime) /. 1.0e9))
+ ~value:(Rrd.VT_Float ((Int64.to_float vcpuinfo.Xenctrl.cputime) /. 1.0e9))
~ty:Rrd.Derive ~default:true ~min:0.0 ~max:1.0())::dss)
in
(* Runstate info is per-domain rather than per-vcpu *)
let dss =
try
- let ri = Xc.domain_get_runstate_info xc domid in
- (VM uuid, ds_make ~name:"runstate_entry_time" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.state_entry_time) /. 1.0e9)) ~description:"" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_fullrun" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time0) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are running" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_full_contention" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time1) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are runnable (i.e., waiting for CPU)" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_concurrency_hazard" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time2) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are running and some are runnable" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_blocked" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time3) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are blocked or offline" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_partial_run" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time4) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are running, and some are blocked" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
- (VM uuid, ds_make ~name:"runstate_partial_contention" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xc.time5) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are runnable and some are blocked" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::dss
+ let ri = Xenctrl.domain_get_runstate_info xc domid in
+ (VM uuid, ds_make ~name:"runstate_entry_time" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.state_entry_time) /. 1.0e9)) ~description:"" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_fullrun" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time0) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are running" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_full_contention" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time1) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are runnable (i.e., waiting for CPU)" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_concurrency_hazard" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time2) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are running and some are runnable" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_blocked" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time3) /. 1.0e9)) ~description:"Fraction of time that all VCPUs are blocked or offline" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_partial_run" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time4) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are running, and some are blocked" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::
+ (VM uuid, ds_make ~name:"runstate_partial_contention" ~value:(Rrd.VT_Float ((Int64.to_float ri.Xenctrl.time5) /. 1.0e9)) ~description:"Fraction of time that some VCPUs are runnable and some are blocked" ~ty:Rrd.Derive ~default:false ~min:0.0 ())::dss
with e ->
dss
in
@@ -116,12 +116,12 @@ let physcpus = ref [| |]
let update_pcpus xc =
let len = Array.length !physcpus in
let newinfos = if len = 0 then (
- let physinfo = Xc.physinfo xc in
- let pcpus = physinfo.Xc.nr_cpus in
+ let physinfo = Xenctrl.physinfo xc in
+ let pcpus = physinfo.Xenctrl.nr_cpus in
physcpus := if pcpus > 0 then (Array.make pcpus 0L) else [| |];
- Xc.pcpu_info xc pcpus
+ Xenctrl.pcpu_info xc pcpus
) else (
- Xc.pcpu_info xc len
+ Xenctrl.pcpu_info xc len
) in
let (dss,_) = Array.fold_left (fun (acc,i) v ->
((Host,ds_make ~name:(Printf.sprintf "cpu%d" i)
@@ -132,10 +132,10 @@ let update_pcpus xc =
let update_memory __context xc doms =
List.fold_left (fun acc dom ->
- let domid = dom.Xc.domid in
- let kib = Xc.pages_to_kib (Int64.of_nativeint dom.Xc.total_memory_pages) in
+ let domid = dom.Xenctrl.domid in
+ let kib = Xenctrl.pages_to_kib (Int64.of_nativeint dom.Xenctrl.total_memory_pages) in
let memory = Int64.mul kib 1024L in
- let uuid = Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle) in
+ let uuid = Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xenctrl.handle) in
let main_mem_ds =
(VM uuid,
ds_make ~name:"memory" ~description:"Memory currently allocated to VM"
@@ -402,9 +402,9 @@ let previous_free_words = ref 0
let previous_live_words = ref 0
let read_mem_metrics xc =
- let physinfo = Xc.physinfo xc in
- let total_kib = Xc.pages_to_kib (Int64.of_nativeint physinfo.Xc.total_pages)
- and free_kib = Xc.pages_to_kib (Int64.of_nativeint physinfo.Xc.free_pages) in
+ let physinfo = Xenctrl.physinfo xc in
+ let total_kib = Xenctrl.pages_to_kib (Int64.of_nativeint physinfo.Xenctrl.total_pages)
+ and free_kib = Xenctrl.pages_to_kib (Int64.of_nativeint physinfo.Xenctrl.free_pages) in
let gcstat =
if !Xapi_globs.xapi_gc_debug then (
@@ -529,12 +529,12 @@ let read_all_dom0_stats __context =
end in
Mutex.execute lock (fun () ->
with_xc (fun xc ->
- let domains = Xc.domain_getinfolist xc 0 in
+ let domains = Xenctrl.domain_getinfolist xc 0 in
let timestamp = Unix.gettimeofday() in
let my_rebooting_vms = StringSet.fold (fun uuid acc -> uuid::acc) !rebooting_vms [] in
let uuid_of_domain d =
- Uuid.to_string (Uuid.uuid_of_int_array (d.Xc.handle)) in
- let domain_paused d = d.Xc.paused in
+ Uuid.to_string (Uuid.uuid_of_int_array (d.Xenctrl.handle)) in
+ let domain_paused d = d.Xenctrl.paused in
let my_paused_domain_uuids =
List.map uuid_of_domain (List.filter domain_paused domains) in
let (vifs,pifs) = try update_netdev domains with e -> (debug "Exception in update_netdev(). Defaulting value for vifs/pifs: %s" (Printexc.to_string e); ([],[])) in
View
2  ocaml/xapi/monitor_types.ml
@@ -18,7 +18,7 @@
type vcpu = {
vcpu_sumcpus: float;
vcpu_vcpus: float array;
- vcpu_rawvcpus: Xc.vcpuinfo array;
+ vcpu_rawvcpus: Xenctrl.vcpuinfo array;
vcpu_cputime: int64;
}
View
1  ocaml/xapi/mtc.ml
@@ -27,6 +27,7 @@
open Pervasiveext
open Printf
open Vmopshelpers
+open Xenstore
module DD=Debug.Debugger(struct let name="MTC:" end)
open DD
View
6 ocaml/xapi/pciops.ml
@@ -71,7 +71,7 @@ let plug_pcidevs ~__context ~vm domid pcidevs =
if List.length pcidevs > 0 then begin
(* XXX: PCI passthrough needs a lot of work *)
Vmopshelpers.with_xc_and_xs (fun xc xs ->
- if (Xc.domain_getinfo xc domid).Xc.hvm_guest then begin
+ if (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest then begin
Device.PCI.bind pcidevs;
List.iter (fun ((a, b, c, d) as device) ->
debug "hotplugging PCI device %04x:%02x:%02x.%01x into domid: %d" a b c d domid;
@@ -100,7 +100,7 @@ let plug_pcis ~__context ~vm domid managed_pcis other_pcidevs =
let unplug_pcidevs_noexn ~__context ~vm domid pcidevs =
Helpers.log_exn_continue "unplug_pcidevs" (fun () ->
Vmopshelpers.with_xc_and_xs (fun xc xs ->
- if (Xc.domain_getinfo xc domid).Xc.hvm_guest then begin
+ if (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest then begin
List.iter (fun (devid, devices) ->
List.iter (fun device ->
debug "requesting hotunplug of PCI device %s" (Device.PCI.to_string device);
@@ -114,7 +114,7 @@ let unplug_pcidevs_noexn ~__context ~vm domid pcidevs =
let currently_attached_pcis ~__context domid =
let host = Helpers.get_localhost ~__context in
Vmopshelpers.with_xc_and_xs (fun xc xs ->
- if (Xc.domain_getinfo xc domid).Xc.hvm_guest then begin
+ if (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest then begin
let online_devs = List.map (fun (_, (a, b, c, d)) -> Printf.sprintf "%04x:%02x:%02x.%01x" a b c d)
(Device.PCI.list ~xc ~xs domid) in
List.filter_map (fun (pref, prec) ->
View
12 ocaml/xapi/pciops.mli
@@ -29,22 +29,22 @@ val other_pcidevs_of_vm :
(** Attach PCI devices to the domain. The should be done before starting the domain. *)
val attach_pcis :
__context:'a ->
- xc:Xc.handle ->
- xs:Xs.xsh ->
- hvm:bool -> Xc.domid -> (int * (int * int * int * int)) list -> unit
+ xc:Xenctrl.handle ->
+ xs:Xenstore.Xs.xsh ->
+ hvm:bool -> Xenctrl.domid -> (int * (int * int * int * int)) list -> unit
(** Hotplug the PCI devices into the domain (as opposed to 'attach_pcis') *)
val plug_pcis :
__context:Context.t ->
vm:'a ->
- Xc.domid ->
+ Xenctrl.domid ->
[ `PCI ] Ref.t list -> ('b * (int * int * int * int)) list -> unit
(** Hot unplug the PCI devices from the domain. Note this is done serially due to a limitation of the
xenstore protocol. *)
val unplug_pcidevs_noexn :
- __context:'a -> vm:'b -> Xc.domid -> ('c * Device.PCI.dev) list -> unit
+ __context:'a -> vm:'b -> Xenctrl.domid -> ('c * Device.PCI.dev) list -> unit
(** Find all PCI devices that are currently attached to a domain, according to XenStore. *)
val currently_attached_pcis :
- __context:Context.t -> Xc.domid -> 'a Ref.t list
+ __context:Context.t -> Xenctrl.domid -> 'a Ref.t list
View
10 ocaml/xapi/quicktest_lifecycle.ml
@@ -144,13 +144,13 @@ let one s vm test =
begin match test with
| { api = None; parallel_op = Some x } ->
let reason = match x with
- | Internal_reboot -> Xc.Reboot
- | Internal_halt -> Xc.Halt
- | Internal_crash -> Xc.Crash
- | Internal_suspend -> Xc.Suspend in
+ | Internal_reboot -> Xenctrl.Reboot
+ | Internal_halt -> Xenctrl.Halt
+ | Internal_crash -> Xenctrl.Crash
+ | Internal_suspend -> Xenctrl.Suspend in
begin
try
- Xc.with_intf (fun xc -> Xc.domain_shutdown xc (Int64.to_int domid) reason)
+ Xenctrl.with_intf (fun xc -> Xenctrl.domain_shutdown xc (Int64.to_int domid) reason)
with e ->
debug t (Printf.sprintf "Ignoring exception: %s" (Printexc.to_string e))
end
View
1  ocaml/xapi/sparse_dd.ml
@@ -5,6 +5,7 @@ open Pervasiveext
open Stringext
open Listext
open Zerocheck
+open Xenstore
let ( +* ) = Int64.add
let ( -* ) = Int64.sub
View
17 ocaml/xapi/vmops.ml
@@ -24,6 +24,7 @@ open Client
open Vbdops
open Listext
open Fun
+open Xenstore
let ( +++ ) = Int64.add
let ( --- ) = Int64.sub
@@ -302,7 +303,7 @@ let general_domain_create_check ~__context ~vm ~snapshot =
(* If guest will boot HVM check that this host has HVM capabilities *)
let hvm = Helpers.is_hvm snapshot in
if hvm then (
- let caps = with_xc (fun xc -> Xc.version_capabilities xc) in
+ let caps = with_xc (fun xc -> Xenctrl.version_capabilities xc) in
if not (String.has_substr caps "hvm") then (raise (Api_errors.Server_error (Api_errors.vm_hvm_required,[]))))
(** [vcpu_configuration snapshot] transforms a vM_t into a list of
@@ -310,7 +311,7 @@ let general_domain_create_check ~__context ~vm ~snapshot =
let vcpu_configuration snapshot =
let vcpus = Int64.to_int snapshot.API.vM_VCPUs_max in
let vcpus_current = Int64.to_int snapshot.API.vM_VCPUs_at_startup in
- let pcpus = with_xc (fun xc -> (Xc.physinfo xc).Xc.max_nr_cpus) in
+ let pcpus = with_xc (fun xc -> (Xenctrl.physinfo xc).Xenctrl.max_nr_cpus) in
debug "xen reports max %d pCPUs" pcpus;
(* vcpu <-> pcpu affinity settings are stored here. Format is either:
@@ -864,8 +865,8 @@ let clean_shutdown_with_reason ?(at = fun _ -> ()) ~xal ~__context ~self ?(rel_t
debug "MTC: calling xal.wait_release timeout=%f" rel_timeout;
Xs.monitor_paths xs [ "@releaseDomain","X" ] rel_timeout
(fun _ ->
- try (Xc.domain_getinfo xc domid).Xc.shutdown with Xc.Error _ -> true);
- result := Some (try Domain.shutdown_reason_of_int (Xc.domain_getinfo xc domid).Xc.shutdown_code with _ -> Domain.Unknown (-1));
+ try (Xenctrl.domain_getinfo xc domid).Xenctrl.shutdown with Xenctrl.Error _ -> true);
+ result := Some (try Domain.shutdown_reason_of_int (Xenctrl.domain_getinfo xc domid).Xenctrl.shutdown_code with _ -> Domain.Unknown (-1));
with Xs.Timeout ->
if reason <> Domain.Suspend && TaskHelper.is_cancelling ~__context
then raise (Api_errors.Server_error(Api_errors.task_cancelled, [ Ref.string_of (Context.get_task_id __context) ]));
@@ -920,7 +921,7 @@ let suspend ~live ~progress_cb ~__context ~xc ~xs ~vm =
Domain.set_memory_dynamic_range ~xs ~min ~max:min domid;
Memory_control.balance_memory ~__context ~xc ~xs;
debug "suspend phase 1/4: hot-unplugging any PCI devices";
- let hvm = (Xc.domain_getinfo xc domid).Xc.hvm_guest in
+ let hvm = (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest in
if hvm then Pciops.unplug_pcidevs_noexn ~__context ~vm domid (Device.PCI.list xc xs domid);
Sm_fs_ops.with_new_fs_vdi __context
~name_label:"Suspend image" ~name_description:"Suspend image"
@@ -951,11 +952,11 @@ let suspend ~live ~progress_cb ~__context ~xc ~xs ~vm =
debug "suspend phase 4/4: recording memory usage";
(* Record the final memory usage of the VM, so that we know how much *)
(* memory to free before attempting to resume this VM in future. *)
- let di = with_xc (fun xc -> Xc.domain_getinfo xc domid) in
+ let di = with_xc (fun xc -> Xenctrl.domain_getinfo xc domid) in
let final_memory_bytes = Memory.bytes_of_pages
- (Int64.of_nativeint di.Xc.total_memory_pages) in
+ (Int64.of_nativeint di.Xenctrl.total_memory_pages) in
debug "total_memory_pages=%Ld; storing target=%Ld"
- (Int64.of_nativeint di.Xc.total_memory_pages) final_memory_bytes;
+ (Int64.of_nativeint di.Xenctrl.total_memory_pages) final_memory_bytes;
(* CA-31759: avoid using the LBR to simplify upgrade *)
Db.VM.set_memory_target ~__context ~self:vm ~value:final_memory_bytes
in
View
2  ocaml/xapi/vmopshelpers.ml
@@ -36,6 +36,6 @@ let vm_of_domid ~__context domid =
try
let uuid = Uuid.to_string (with_xc (fun xc -> Domain.get_uuid xc domid)) in
Db.VM.get_by_uuid ~__context ~uuid
- with Xc.Error _
+ with Xenctrl.Error _
-> raise (Vm_corresponding_to_domid_not_in_db domid)
View
21 ocaml/xapi/xapi.ml
@@ -23,6 +23,7 @@ open Pervasiveext
open Listext
open Auth_signature
open Extauth
+open Xenstore
module D=Debug.Debugger(struct let name="xapi" end)
@@ -39,7 +40,7 @@ let check_control_domain () =
let uuid = Xapi_inventory.lookup Xapi_inventory._control_domain_uuid in
if domuuid <> uuid then (
info "dom0 uuid mismatch with inventory -- setting it the proper value";
- with_xc (fun xc -> Xc.domain_sethandle xc 0 uuid)
+ with_xc (fun xc -> Xenctrl.domain_sethandle xc 0 uuid)
)
(** Perform some startup sanity checks. Note that we nolonger look for processes using 'ps':
@@ -172,8 +173,8 @@ let signals_handling () =
let domain0_setup () =
with_xc_and_xs (fun xc xs ->
(* Write an initial neutral target in for domain 0 *)
- let di = Xc.domain_getinfo xc 0 in
- let memory_actual_kib = Xc.pages_to_kib (Int64.of_nativeint di.Xc.total_memory_pages) in
+ let di = Xenctrl.domain_getinfo xc 0 in
+ let memory_actual_kib = Xenctrl.pages_to_kib (Int64.of_nativeint di.Xenctrl.total_memory_pages) in
(* Find domain 0's UUID *)
let uuid = Xapi_inventory.lookup Xapi_inventory._control_domain_uuid in
(* setup xenstore domain 0 for blktap, xentop (CA-24231) *)
@@ -301,7 +302,7 @@ let on_master_restart ~__context =
(fun () ->
(* Explicitly dirty all VM memory values *)
let uuids = Vmopshelpers.with_xc
- (fun xc -> List.map (fun di -> Uuid.to_string (Uuid.uuid_of_int_array di.Xc.handle)) (Xc.domain_getinfolist xc 0)) in
+ (fun xc -> List.map (fun di -> Uuid.to_string (Uuid.uuid_of_int_array di.Xenctrl.handle)) (Xenctrl.domain_getinfolist xc 0)) in
Rrd_shared.dirty_memory := List.fold_left (fun acc x -> Rrd_shared.StringSet.add x acc) Rrd_shared.StringSet.empty uuids;
Rrd_shared.dirty_host_memory := true;
Condition.broadcast Rrd_shared.condition);
@@ -548,15 +549,15 @@ let resynchronise_ha_state () =
(* 2. No other domains have been started. *)
let calculate_boot_time_host_free_memory () =
let ( + ) = Nativeint.add in
- let host_info = with_xc (fun xc -> Xc.physinfo xc) in
- let host_free_pages = host_info.Xc.free_pages in
- let host_scrub_pages = host_info.Xc.scrub_pages in
- let domain0_info = with_xc (fun xc -> Xc.domain_getinfo xc 0) in
- let domain0_total_pages = domain0_info.Xc.total_memory_pages in
+ let host_info = with_xc (fun xc -> Xenctrl.physinfo xc) in
+ let host_free_pages = host_info.Xenctrl.free_pages in
+ let host_scrub_pages = host_info.Xenctrl.scrub_pages in
+ let domain0_info = with_xc (fun xc -> Xenctrl.domain_getinfo xc 0) in
+ let domain0_total_pages = domain0_info.Xenctrl.total_memory_pages in
let boot_time_host_free_pages =
host_free_pages + host_scrub_pages + domain0_total_pages in
let boot_time_host_free_kib =
- Xc.pages_to_kib (Int64.of_nativeint boot_time_host_free_pages) in
+ Xenctrl.pages_to_kib (Int64.of_nativeint boot_time_host_free_pages) in
Memory.bytes_of_kib boot_time_host_free_kib
(* Read the free memory on the host and record this in the db. This is used *)
View
8 ocaml/xapi/xapi_guest_agent.ml
@@ -243,12 +243,12 @@ let guest_metrics_liveness_thread () =
while true do
try
Thread.delay Xapi_globs.guest_liveness_timeout;
- let doms = Xc.domain_getinfolist xc 1 in (* no guest agent in dom0 *)
+ let doms = Xenctrl.domain_getinfolist xc 1 in (* no guest agent in dom0 *)
let now = Unix.gettimeofday () in
(* debug "Running liveness logic"; *)
Mutex.execute mutex (fun () ->
List.iter (fun dom ->
- let domid = dom.Xc.domid in
+ let domid = dom.Xenctrl.domid in
try
let (_,_,_,_,_,last_updated) = Hashtbl.find cache domid in
let dead = IntSet.mem domid !dead_domains in
@@ -261,7 +261,7 @@ let guest_metrics_liveness_thread () =
(* debug "Marking as alive!"; *)
(* Mark guest as alive! *)
dead_domains := IntSet.remove domid !dead_domains;
- let vm = Db.VM.get_by_uuid ~__context ~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle)) in
+ let vm = Db.VM.get_by_uuid ~__context ~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xenctrl.handle)) in
let vm_guest_metrics = Db.VM.get_guest_metrics ~__context ~self:vm in
Db.VM_guest_metrics.set_live ~__context ~self:vm_guest_metrics ~value:true;
(* debug "Done" *)
@@ -277,7 +277,7 @@ let guest_metrics_liveness_thread () =
(* debug "Marking as dead!"; *)
(* Mark guest as dead! *)
dead_domains := IntSet.add domid !dead_domains;
- let vm = Db.VM.get_by_uuid ~__context ~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle)) in
+ let vm = Db.VM.get_by_uuid ~__context ~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xenctrl.handle)) in
let vm_guest_metrics = Db.VM.get_guest_metrics ~__context ~self:vm in
Db.VM_guest_metrics.set_live ~__context ~self:vm_guest_metrics ~value:false;
(* debug "Done" *)
View
2  ocaml/xapi/xapi_ha.ml
@@ -1605,7 +1605,7 @@ let before_clean_shutdown_or_reboot ~__context ~host =
(* UNLIKELY to happen but we do our best to kill ourselves and do not return *)
error "Error past the commit-point while cleanly shutting down host: %s" (ExnHelper.string_of_exn e);
error "Host will self-fence via its own watchdog for safety";
- (* NB we don't use Xc directly because in the SDK VM this is all fake... *)
+ (* NB we don't use Xenctrl directly because in the SDK VM this is all fake... *)
ignore(Forkhelpers.execute_command_get_output fence_path [ "yesreally" ]);
Thread.delay 60.;
error "Watchdog has not triggered after 60 seconds";
View
4 ocaml/xapi/xapi_host.ml
@@ -535,7 +535,7 @@ let power_on ~__context ~host =
if result <> "True" then failwith (Printf.sprintf "The host failed to power on.")
let dmesg ~__context ~host =
- Vmopshelpers.with_xc (fun xc -> Xc.readconsolering xc)
+ Vmopshelpers.with_xc (fun xc -> Xenctrl.readconsolering xc)
let dmesg_clear ~__context ~host =
raise (Api_errors.Server_error (Api_errors.not_implemented, [ "dmesg_clear" ]))
@@ -544,7 +544,7 @@ let get_log ~__context ~host =
raise (Api_errors.Server_error (Api_errors.not_implemented, [ "get_log" ]))
let send_debug_keys ~__context ~host ~keys =
- Vmopshelpers.with_xc (fun xc -> Xc.send_debug_keys xc keys)
+ Vmopshelpers.with_xc (fun xc -> Xenctrl.send_debug_keys xc keys)
let list_methods ~__context =
raise (Api_errors.Server_error (Api_errors.not_implemented, [ "list_method" ]))
View
1  ocaml/xapi/xapi_vif.ml
@@ -13,6 +13,7 @@
*)
open Vmopshelpers
open Xapi_vif_helpers
+open Xenstore
open D
let assert_operation_valid ~__context ~self ~(op:API.vif_operations) =
View
33 ocaml/xapi/xapi_vm.ml
@@ -20,6 +20,7 @@ open Client
open Threadext
open Xmlrpc_sexpr
open Listext
+open Xenstore
(* Notes re: VM.{start,resume}{on,}:
* Until we support pools properly VM.start and VM.start_on both try
@@ -305,9 +306,9 @@ module TwoPhase = struct
&& domid <> -1 (* someone set the state to Halted *)
&& (with_xc
(fun xc ->
- let di = Xc.domain_getinfo xc domid in
+ let di = Xenctrl.domain_getinfo xc domid in
let running = Xal.is_running di in
- debug "VM domid=%d has shutdown=%b; dying=%b -> %s running" domid di.Xc.shutdown di.Xc.dying (if running then "still" else "not");
+ debug "VM domid=%d has shutdown=%b; dying=%b -> %s running" domid di.Xenctrl.shutdown di.Xenctrl.dying (if running then "still" else "not");
running))
(** Called before a regular synchronous reboot/shutdown to simulate parallel in-guest shutdowns *)
@@ -321,10 +322,10 @@ module TwoPhase = struct
(fun xc ->
warn "FIST: simulating internal %s for domid=%d" x domid;
match x with
- | "reboot" -> Xc.domain_shutdown xc domid Xc.Reboot
- | "halt" -> Xc.domain_shutdown xc domid Xc.Halt
- | "suspend" -> Xc.domain_shutdown xc domid Xc.Suspend
- | "crash" -> Xc.domain_shutdown xc domid Xc.Crash
+ | "reboot" -> Xenctrl.domain_shutdown xc domid Xenctrl.Reboot
+ | "halt" -> Xenctrl.domain_shutdown xc domid Xenctrl.Halt
+ | "suspend" -> Xenctrl.domain_shutdown xc domid Xenctrl.Suspend
+ | "crash" -> Xenctrl.domain_shutdown xc domid Xenctrl.Crash
| _ -> failwith "Unknown simulate_internal_shutdown code");
(* pause for 5s which probably lets the event thread do something (unless it is disabled) *)
Thread.delay 5.
@@ -366,9 +367,9 @@ module Reboot = struct
(* Make sure no-one inserts an artificial delay at this point *)
(with_xs (fun xs -> xs.Xs.write (Hotplug.get_private_path domid ^ "/" ^ Xapi_globs.artificial_reboot_delay) "0"));
(* The domain might be killed by the event thread. Again, this is ok. *)
- Helpers.log_exn_continue (Printf.sprintf "Xc.domain_shutdown domid=%d Xc.Reboot" domid)
+ Helpers.log_exn_continue (Printf.sprintf "Xenctrl.domain_shutdown domid=%d Xenctrl.Reboot" domid)
(fun () ->
- with_xc (fun xc -> Xc.domain_shutdown xc domid Xc.Reboot)
+ with_xc (fun xc -> Xenctrl.domain_shutdown xc domid Xenctrl.Reboot)
) ()
end
end
@@ -511,10 +512,10 @@ module Shutdown = struct
end else begin
debug "%s phase 0/3: no shutdown request required since this is a hard_shutdown" api_call_name;
(* The domain might be killed by the event thread. Again, this is ok. *)
- Helpers.log_exn_continue (Printf.sprintf "Xc.domain_shutdown domid=%d Xc.Halt" domid)
+ Helpers.log_exn_continue (Printf.sprintf "Xenctrl.domain_shutdown domid=%d Xenctrl.Halt" domid)
(fun () ->
- debug "Xc.domain_shutdown domid=%d Halt" domid;
- with_xc (fun xc -> Xc.domain_shutdown xc domid Xc.Halt)
+ debug "Xenctrl.domain_shutdown domid=%d Halt" domid;
+ with_xc (fun xc -> Xenctrl.domain_shutdown xc domid Xenctrl.Halt)
) ()
end
end
@@ -543,12 +544,12 @@ module Shutdown = struct
(fun xc xs ->
begin
try
- let di = Xc.domain_getinfo xc domid in
+ let di = Xenctrl.domain_getinfo xc domid in
(* If someone rebooted it while we dropped the lock: *)
if Xal.is_running di
then raise (Api_errors.Server_error(Api_errors.other_operation_in_progress, [ "VM"; Ref.string_of vm ]));
(* see retry_on_conflict *)
- with Xc.Error("2: No such file or directory") -> ()
+ with Xenctrl.Error("2: No such file or directory") -> ()
end;
(* Invoke pre_destroy hook *)
@@ -701,7 +702,7 @@ let power_state_reset ~__context ~vm =
if power_state = `Running || power_state = `Paused then begin
debug "VM.power_state_reset vm=%s power state is either running or paused: performing sanity checks" (Ref.string_of vm);
let localhost = Helpers.get_localhost ~__context in
- (* We only query domid, resident_on and Xc.domain_getinfo with the VM lock held to make
+ (* We only query domid, resident_on and Xenctrl.domain_getinfo with the VM lock held to make
sure the VM isn't in the middle of a migrate/reboot/shutdown. Note we don't hold it for
the whole of this function which might perform off-box RPCs. *)
let resident, domid, getinfo = Locking_helpers.with_lock vm
@@ -712,7 +713,7 @@ let power_state_reset ~__context ~vm =
if resident = localhost then begin
debug "VM.power_state_reset vm=%s resident_on=localhost; looking for a domain" (Ref.string_of vm);
if domid = -1L then None
- else (try Some (with_xc (fun xc -> Xc.domain_getinfo xc (Int64.to_int domid)))
+ else (try Some (with_xc (fun xc -> Xenctrl.domain_getinfo xc (Int64.to_int domid)))
with e ->
debug "VM.power_state_reset vm=%s caught %s: assuming domain doesn't exist"
(Ref.string_of vm) (ExnHelper.string_of_exn e);
@@ -722,7 +723,7 @@ let power_state_reset ~__context ~vm =
if resident = localhost then begin
match getinfo with
| Some di ->
- let uuid = Uuid.to_string (Uuid.uuid_of_int_array di.Xc.handle) in
+ let uuid = Uuid.to_string (Uuid.uuid_of_int_array di.Xenctrl.handle) in
if Db.VM.get_uuid ~__context ~self:vm = uuid then begin
error "VM.power_state_reset vm=%s uuid=%s domid=%Ld cannot proceed because domain still exists"
(Ref.string_of vm) uuid domid;
View
13 ocaml/xapi/xapi_vm_helpers.ml
@@ -19,6 +19,7 @@ open Stringext
open Printf
open Xapi_vm_memory_constraints
open Listext
+open Xenstore
module D=Debug.Debugger(struct let name="xapi" end)
open D
@@ -768,9 +769,9 @@ let wait_memory_target_live ~__context ~self
then raise_error Api_errors.task_cancelled;
(* Fetch up-to-date value of memory_actual via a hypercall to Xen. *)
let domain_id = Helpers.domid_of_vm ~__context ~self in
- let domain_info = Vmopshelpers.with_xc (fun xc -> Xc.domain_getinfo xc domain_id) in
- let memory_actual_pages = Int64.of_nativeint domain_info.Xc.total_memory_pages in
- let memory_actual_kib = Xc.pages_to_kib memory_actual_pages in
+ let domain_info = Vmopshelpers.with_xc (fun xc -> Xenctrl.domain_getinfo xc domain_id) in
+ let memory_actual_pages = Int64.of_nativeint domain_info.Xenctrl.total_memory_pages in
+ let memory_actual_kib = Xenctrl.pages_to_kib memory_actual_pages in
let memory_actual_bytes = Memory.bytes_of_kib memory_actual_kib in
(* Fetch up-to-date value of target from xenstore. *)
let memory_target_kib = Int64.of_string (Vmopshelpers.with_xs (fun xs -> xs.Xs.read (xs.Xs.getdomainpath domain_id ^ "/memory/target"))) in
@@ -832,9 +833,9 @@ let set_shadow_multiplier_live ~__context ~self ~multiplier =
Memory_check.host_compute_free_memory_with_maximum_compression
~__context ~host None in
let free_mem_mib = Int64.to_int (Int64.div (Int64.div free_mem_b 1024L) 1024L) in
- let multiplier_to_record = Xc.with_intf
+ let multiplier_to_record = Xenctrl.with_intf
(fun xc ->
- let curshadow = Xc.shadow_allocation_get xc domid in
+ let curshadow = Xenctrl.shadow_allocation_get xc domid in
let needed_mib = newshadow - curshadow in
debug "Domid %d has %d MiB shadow; an increase of %d MiB requested; host has %d MiB free"
domid curshadow needed_mib free_mem_mib;
@@ -849,7 +850,7 @@ let set_shadow_multiplier_live ~__context ~self ~multiplier =
raise (Api_errors.Server_error(Api_errors.host_not_enough_free_memory, [ Int64.to_string (Memory.bytes_of_mib (Int64.of_int needed_mib)); Int64.to_string free_mem_b ]));
end;
debug "Setting domid %d's shadow memory to %d MiB" domid newshadow;
- Xc.shadow_allocation_set xc domid newshadow;
+ Xenctrl.shadow_allocation_set xc domid newshadow;
Memory.HVM.round_shadow_multiplier static_max_mib vcpus multiplier domid) in
Db.VM.set_HVM_shadow_multiplier ~__context ~self ~value:multiplier_to_record;
let newbootrec = { bootrec with API.vM_HVM_shadow_multiplier = multiplier_to_record } in
View
12 ocaml/xapi/xapi_vm_migrate.ml
@@ -226,7 +226,7 @@ let transmitter ~xal ~__context is_localhost_migration fd vm_migrate_failed host
try
if want_failure __context vm 2 then begin
debug "Simulating domain crash during Domain.suspend";
- Xc.domain_shutdown xc domid Xc.Crash;
+ Xenctrl.domain_shutdown xc domid Xenctrl.Crash;
raise (Vmops.Domain_shutdown_for_wrong_reason Xal.Crashed)
end;
@@ -451,7 +451,7 @@ let receiver ~__context ~localhost is_localhost_migration fd vm xc xs memory_req
(* <-- [2] Synchronisation point *)
if want_failure __context vm 5 then begin
debug "Simulating domain crash after restore";
- Xc.domain_shutdown xc domid Xc.Crash;
+ Xenctrl.domain_shutdown xc domid Xenctrl.Crash;
(* Continue on, like would happen if we crashed asynchronously *)
end;
@@ -577,12 +577,12 @@ let pool_migrate_nolock ~__context ~vm ~host ~options =
(* The lowest upper-bound on the amount of memory the domain can consume during
the migration is the max of maxmem and memory_actual (with our overheads subtracted),
assuming no reconfiguring of target happens during the process. *)
- let info = Xc.domain_getinfo xc domid in
+ let info = Xenctrl.domain_getinfo xc domid in
let totmem =
- Memory.bytes_of_pages (Int64.of_nativeint info.Xc.total_memory_pages) in
+ Memory.bytes_of_pages (Int64.of_nativeint info.Xenctrl.total_memory_pages) in
let maxmem =
- let overhead_bytes = Memory.bytes_of_mib (if info.Xc.hvm_guest then Memory.HVM.xen_max_offset_mib else Memory.Linux.xen_max_offset_mib) in
- let raw_bytes = Memory.bytes_of_pages (Int64.of_nativeint info.Xc.max_memory_pages) in
+ let overhead_bytes = Memory.bytes_of_mib (if info.Xenctrl.hvm_guest then Memory.HVM.xen_max_offset_mib else Memory.Linux.xen_max_offset_mib) in
+ let raw_bytes = Memory.bytes_of_pages (Int64.of_nativeint info.Xenctrl.max_memory_pages) in
Int64.sub raw_bytes overhead_bytes in
(* CA-31764: maxmem may be larger than static_max if maxmem has been increased to initial-reservation. *)
let memory_required_kib = Memory.kib_of_bytes_used (Pervasives.max totmem maxmem) in
View
3  ocaml/xapi/xapi_vm_snapshot.ml
@@ -17,6 +17,7 @@
open Client
open Vmopshelpers
+open Xenstore
open Client
module D = Debug.Debugger(struct let name="xapi" end)
@@ -231,7 +232,7 @@ let checkpoint ~__context ~vm ~new_name =
Vmops.restore ~__context ~xc ~xs ~self:vm false in
let domid = Helpers.domid_of_vm ~__context ~self:vm in
- let hvm = (Xc.domain_getinfo xc domid).Xc.hvm_guest in
+ let hvm = (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest in
if hvm
then fast_resume ()
else slow_resume () (* most vendor kernels don't support fast resume *)
View
4 ocaml/xapi/xapi_xenops_errors.ml
@@ -63,14 +63,14 @@ let to_api_error = function
Server_error(internal_error, [ sprintf "received failure message from xenguesthelper: %s" x ])
| XenguestHelper.Domain_builder_error(fn, code, msg) ->
Server_error(domain_builder_error, [ fn; string_of_int code; msg ])
- | Xc.Error x ->
+ | Xenctrl.Error x ->
Vmopshelpers.with_xc
(fun xc ->
let free = Memory.get_free_memory_kib ~xc
and total = Memory.get_total_memory_mib ~xc
and scrub = Memory.get_scrub_memory_kib ~xc in
- Server_error(internal_error, [ sprintf "Xc.Error [ memory %Ld KiB free; to be scrubbed %Ld KiB; total %Ld MiB]: %s" free scrub total x ])
+ Server_error(internal_error, [ sprintf "Xenctrl.Error [ memory %Ld KiB free; to be scrubbed %Ld KiB; total %Ld MiB]: %s" free scrub total x ])
)
| e -> e
View
4 ocaml/xapi/xen_helpers.ml
@@ -32,8 +32,8 @@ let device_of_vbd ~__context ~self =
let domid = Int64.to_int (Db.VM.get_domid ~__context ~self:vm) in
let hvm =
try
- Xc.with_intf (fun xc -> (Xc.domain_getinfo xc domid).Xc.hvm_guest)
- with Xc.Error("2: No such file or directory") ->
+ Xenctrl.with_intf (fun xc -> (Xenctrl.domain_getinfo xc domid).Xenctrl.hvm_guest)
+ with Xenctrl.Error("2: No such file or directory") ->
(* This can happen if someone calls "xenops destroy_domain" *)
error "VM %s domid:%d has been destroyed beneath us: returning VM_BAD_POWER_STATE" (Ref.string_of vm) domid;
raise (Api_errors.Server_error(Api_errors.vm_bad_power_state, [Ref.string_of vm; "running"; (Record_util.power_to_string `Halted)]))
View
2  ocaml/xapi/xenstore_copy.ml
@@ -14,7 +14,7 @@
(* Simple example program which recursively copies a xenstore subtree to another path. *)
open Xenstore_dump
-
+open Xenstore
let _ =
View
3  ocaml/xapi/xenstore_dump.ml
@@ -18,9 +18,10 @@
*)
open Stringext
+open Xenstore
exception Invalid_path of string
-let handle_enoent f x = try f x with Xb.Noent -> raise (Invalid_path x)
+let handle_enoent f x = try f x with Xenbus.Xb.Noent -> raise (Invalid_path x)
let dump ~xs (path: string) : Xml.xml =
let rec ls_R prefix path =
View
4 ocaml/xapi/xenstore_dump.mli
@@ -14,8 +14,8 @@
exception Invalid_path of string
(** Dump a xenstore subtree as XML *)
-val dump : xs:Xs.xsh -> string -> Xml.xml
+val dump : xs:Xenstore.Xs.xsh -> string -> Xml.xml
(** Restore a xenstore subtree from XML at a new path. Permissions are not restored
and therefore will inherit from the parent node. *)
-val restore : xs:Xs.xsh -> string -> Xml.xml -> unit
+val restore : xs:Xenstore.Xs.xsh -> string -> Xml.xml -> unit
View
2  ocaml/xe-cli/OMakefile
@@ -11,7 +11,7 @@ section
section
- OCAMLPACKS += xb xs netdev
+ OCAMLPACKS += xenbus xenstore netdev
OCAML_CLIBS = ../xenops/statdev_stubs
OCamlProgram(fatxe, cli options \
View
6 ocaml/xenops/OMakefile
@@ -4,10 +4,10 @@ OCAML_CLIBS += $(XEN_OCAML_CLIBS)
OCAML_LINK_FLAGS+= $(XEN_OCAML_LINK_FLAGS)
CFLAGS += $(XEN_CFLAGS)
-OCAMLPACKS = threads xc xs stdext log cdrom netdev
+OCAMLPACKS = threads xenctrl xenstore stdext log cdrom netdev
OCAMLFLAGS += -thread
-LIBFILES = table xenops_helpers xenbus balloon xenguestHelper domain hotplug device io statdev xal netman memory watch device_common squeeze squeeze_xen squeezed_rpc squeezed_state squeezed_rpc device_number stubdom
+LIBFILES = table xenops_helpers xenbus_utils balloon xenguestHelper domain hotplug device io statdev xal netman memory watch device_common squeeze squeeze_xen squeezed_rpc squeezed_state squeezed_rpc device_number stubdom
StaticCLibrary(statdev_stubs, statdev_stubs)
OCamlLibraryClib(xenops, $(LIBFILES), statdev_stubs)
@@ -46,7 +46,7 @@ OCamlProgram(dbgring, dbgring)
section
OCAMLINCLUDES = ../idl/ocaml_backend ../idl
OCAMLFLAGS = -dtypes -warn-error F -cclib -static
- OCAMLPACKS = xc xs
+ OCAMLPACKS = xenctrl xenstore
OCamlProgram(xs, xenstore_readdir)
OCamlProgram(xal, xal_main)
View
3  ocaml/xenops/balloon.ml
@@ -13,6 +13,7 @@
*)
open Stringext
open Printf
+open Xenstore
module D = Debug.Debugger(struct let name = "xenops" end)
open D
@@ -26,7 +27,7 @@ let _low_mem_balloon = "Low-mem balloon"
let _high_mem_balloon = "High-mem balloon"
(** Indicates whether or not we're running with XIU (Xen-In Userspace) *)
-let on_xiu () = Xc.is_fake ()
+let on_xiu () = Xenctrl.is_fake ()
(** Reads /proc/xen/balloon into a string * int64 option association list *)
let parse_proc_xen_balloon () =
View
2  ocaml/xenops/balloon.mli
@@ -12,7 +12,7 @@
* GNU Lesser General Public License for more details.
*)
val parse_proc_xen_balloon : unit -> (string * int64 option) list
-val set_memory_target : xs:Xs.xsh -> Xs.domid -> int64 -> unit
+val set_memory_target : xs:Xenstore.Xs.xsh -> Xenstore.Xs.domid -> int64 -> unit
val _current_allocation : string
val _requested_target : string
val _low_mem_balloon : string
View
14 ocaml/xenops/dbgring.ml
@@ -16,16 +16,16 @@ let xenstored_proc_kva = "/proc/xen/xsd_kva"
let open_ring0 () =
let fd = Unix.openfile xenstored_proc_kva [ Unix.O_RDWR ] 0o600 in
- let sz = Mmap.getpagesize () in
- let intf = Mmap.mmap fd Mmap.RDWR Mmap.SHARED sz 0 in
+ let sz = Xenmmap.getpagesize () in
+ let intf = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED sz 0 in
Unix.close fd;
intf
let open_ringU domid mfn =
- let xc = Xc.interface_open () in
+ let xc = Xenctrl.interface_open () in
Pervasiveext.finally
- (fun () -> Xc.map_foreign_range xc domid (Mmap.getpagesize()) mfn)
- (fun () -> Xc.interface_close xc)
+ (fun () -> Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn)
+ (fun () -> Xenctrl.interface_close xc)
let open_ring domid mfn =
if domid = 0
@@ -72,9 +72,9 @@ let _ =
try int_of_string Sys.argv.(1), Nativeint.of_string Sys.argv.(2)
with _ -> 0, Nativeint.zero
in
- let sz = Mmap.getpagesize () - 1024 - 512 in
+ let sz = Xenmmap.getpagesize () - 1024 - 512 in
let intf = open_ring domid mfn in
- let s = Mmap.read intf 0 sz in
+ let s = Xenmmap.read intf 0 sz in
let ss = (hexify s) in
let req_cons = int_from_page ss (4*ring_size) in
View
73 ocaml/xenops/device.ml
@@ -19,6 +19,7 @@ open Pervasiveext
open Listext
open Device_common
+open Xenstore
exception Ioemu_failed of string
exception Ioemu_failed_dying
@@ -62,10 +63,10 @@ let add_device ~xs device backend_list frontend_list private_list =
Xs.transaction xs (fun t ->
begin try
ignore (t.Xst.read frontend_path);
- if Xenbus.of_string (t.Xst.read (frontend_path ^ "/state"))
- <> Xenbus.Closed then
+ if Xenbus_utils.of_string (t.Xst.read (frontend_path ^ "/state"))
+ <> Xenbus_utils.Closed then
raise (Device_frontend_already_connected device)
- with Xb.Noent -> () end;
+ with Xenbus.Xb.Noent -> () end;
t.Xst.rm frontend_path;
t.Xst.rm backend_path;
@@ -124,13 +125,13 @@ let exists ~xs (x: device) =
try
ignore_string(xs.Xs.read backend_stub);
true
- with Xb.Noent -> false
+ with Xenbus.Xb.Noent -> false
let assert_exists_t ~xs t (x: device) =
let backend_stub = backend_path_of_device ~xs x in
try
ignore_string(t.Xst.read backend_stub)
- with Xb.Noent -> raise Device_not_found
+ with Xenbus.Xb.Noent -> raise Device_not_found
(** When hot-unplugging a device we ask nicely *)
let request_closure ~xs (x: device) =
@@ -140,10 +141,10 @@ let request_closure ~xs (x: device) =
let online_path = backend_path ^ "/online" in
debug "xenstore-write %s = 0" online_path;
t.Xst.write online_path "0";
- let state = try Xenbus.of_string (t.Xst.read state_path) with _ -> Xenbus.Closed in
- if state <> Xenbus.Closed then (
+ let state = try Xenbus_utils.of_string (t.Xst.read state_path) with _ -> Xenbus_utils.Closed in
+ if state <> Xenbus_utils.Closed then (
debug "Device.del_device setting backend to Closing";
- t.Xst.write state_path (Xenbus.string_of Xenbus.Closing);
+ t.Xst.write state_path (Xenbus_utils.string_of Xenbus_utils.Closing);
)
)
@@ -151,7 +152,7 @@ let unplug_watch ~xs (x: device) =
let path = Hotplug.path_written_by_hotplug_scripts x in
Watch.map (fun () -> "") (Watch.key_to_disappear path)
let error_watch ~xs (x: device) = Watch.value_to_appear (error_path_of_device ~xs x)
-let frontend_closed ~xs (x: device) = Watch.map (fun () -> "") (Watch.value_to_become (frontend_path_of_device ~xs x ^ "/state") (Xenbus.string_of Xenbus.Closed))
+let frontend_closed ~xs (x: device) = Watch.map (fun () -> "") (Watch.value_to_become (frontend_path_of_device ~xs x ^ "/state") (Xenbus_utils.string_of Xenbus_utils.Closed))
let clean_shutdown ~xs (x: device) =
debug "Device.Generic.clean_shutdown %s" (string_of_device x);
@@ -215,7 +216,7 @@ let wait_for_error_or ~xs ?(timeout=Hotplug.hotplug_timeout) doc predicate other
let finished = ref false and error = ref None in
let callback watch =
finished := predicate ();
- error := (try Some (xs.Xs.read errorpath) with Xb.Noent -> None);
+ error := (try Some (xs.Xs.read errorpath) with Xenbus.Xb.Noent -> None);
(* We return if the predicate is true of an error node has appeared *)
!finished || !error <> None in
begin try
@@ -505,7 +506,7 @@ let pause ~xs (x: device) =
ignore(t.Xst.read path);
error "Vbd.pause failed because path exists already: %s" path;
raise Pause_failed
- with Xb.Noent -> () in
+ with Xenbus.Xb.Noent -> () in
path_should_not_exist request_path;
path_should_not_exist token_path;
path_should_not_exist response_path;
@@ -542,7 +543,7 @@ let unpause ~xs (x: device) (token: string) =
let path_should_exist path =
try ignore(t.Xst.read path)
- with Xb.Noent ->
+ with Xenbus.Xb.Noent ->
error "Vbd.unpause failed because path does not exist already: %s" path;
raise Device_not_paused in
path_should_exist request_path;
@@ -571,7 +572,7 @@ let unpause ~xs (x: device) (token: string) =
let is_paused ~xs (x: device) =
let request_path = backend_pause_request_path_of_device ~xs x in
- try ignore(xs.Xs.read request_path); true with Xb.Noent -> false
+ try ignore(xs.Xs.read request_path); true with Xenbus.Xb.Noent -> false
(* Add the VBD to the domain, When this command returns, the device is ready. (This isn't as
concurrent as xend-- xend allocates loopdevices via hotplug in parallel and then
@@ -604,7 +605,7 @@ let add ~xs ~hvm ~mode ~device_number ~phystype ~params ~dev_type ~unpluggable
Hashtbl.add_list front_tbl [
"backend-id", string_of_int backend_domid;
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
"virtual-device", string_of_int devid;
"device-type", if dev_type = CDROM then "cdrom" else "disk";
];
@@ -614,7 +615,7 @@ let add ~xs ~hvm ~mode ~device_number ~phystype ~params ~dev_type ~unpluggable
This allows the xenbus connection to re-establish itself *)
"online", "1";
"removable", if unpluggable then "1" else "0";
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
"dev", Device_number.to_linux_device device_number;
"type", backendty_of_physty phystype;
"mode", string_of_mode mode;
@@ -785,7 +786,7 @@ let add ~xs ~devid ~netty ~mac ~carrier ?mtu ?(rate=None) ?(protocol=Protocol_Na
let back = [
"frontend-id", sprintf "%u" domid;
"online", "1";
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
"script", "/etc/xensource/scripts/vif";
"mac", mac;
"handle", string_of_int devid
@@ -799,7 +800,7 @@ let add ~xs ~devid ~netty ~mac ~carrier ?mtu ?(rate=None) ?(protocol=Protocol_Na
let front = [
"backend-id", string_of_int backend_domid;
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
"handle", string_of_int devid;
"mac", mac;
"disconnect", if carrier then "0" else "1";
@@ -810,8 +811,8 @@ let add ~xs ~devid ~netty ~mac ~carrier ?mtu ?(rate=None) ?(protocol=Protocol_Na
let extra_private_keys = extra_private_keys @
(match mtu with | Some mtu when mtu > 0 -> [ "MTU", string_of_int mtu ] | _ -> []) @
(match netty with
- | Netman.Bridge b -> [ "bridge", b; "bridge-MAC", if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
- | Netman.Vswitch b -> [ "bridge", b; "bridge-MAC", if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
+ | Netman.Bridge b -> [ "bridge", b; "bridge-MAC", if(Xenctrl.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
+ | Netman.Vswitch b -> [ "bridge", b; "bridge-MAC", if(Xenctrl.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
| Netman.DriverDomain -> []
| Netman.Nat -> []) @
(match rate with | None -> [] | Some(rate, timeslice) -> [ "rate", Int64.to_string rate; "timeslice", Int64.to_string timeslice ]) in
@@ -858,7 +859,7 @@ let status ~xs ~devid domid =
| "online" -> true
| "offline" -> false
| _ -> (* garbage, assuming false *) false
- with Xb.Noent -> false
+ with Xenbus.Xb.Noent -> false
end
@@ -1013,14 +1014,14 @@ let grant_access_resources xc domid resources v =
let nr_ports = (Int64.to_int e) - first_port + 1 in
debug "pci %s io bar %Lx-%Lx" action s e;
- Xc.domain_ioport_permission xc domid first_port nr_ports v
+ Xenctrl.domain_ioport_permission xc domid first_port nr_ports v
) else (
let mem_to_pfn m = Int64.to_nativeint (Int64.div m 4096L) in
let first_pfn = mem_to_pfn s and end_pfn = mem_to_pfn e in
let nr_pfns = Nativeint.add (Nativeint.sub end_pfn first_pfn) 1n in
debug "pci %s mem bar %Lx-%Lx" action s e;
- Xc.domain_iomem_permission xc domid first_pfn nr_pfns v
+ Xenctrl.domain_iomem_permission xc domid first_pfn nr_pfns v
)
) resources
@@ -1038,12 +1039,12 @@ let add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?(flrscript=None) pcide
List.iter (fun dev ->
if hvm then (
- ignore_bool (Xc.domain_test_assign_device xc domid (dev.domain, dev.bus, dev.slot, dev.func));
+ ignore_bool (Xenctrl.domain_test_assign_device xc domid (dev.domain, dev.bus, dev.slot, dev.func));
()
);
grant_access_resources xc domid dev.resources true;
if dev.irq > 0 then
- Xc.domain_irq_permission xc domid dev.irq true
+ Xenctrl.domain_irq_permission xc domid dev.irq true
) pcidevs;
let device = {
@@ -1060,12 +1061,12 @@ let add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?(flrscript=None) pcide
"frontend-id", sprintf "%u" domid;
"online", "1";
"num_devs", string_of_int (List.length xsdevs);
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
"msitranslate", string_of_int (msitranslate);
"pci_power_mgmt", string_of_int (pci_power_mgmt);
] and frontendlist = [
"backend-id", "0";
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
] in
Generic.add_device ~xs device (others @ xsdevs @ backendlist) frontendlist [];
()
@@ -1090,7 +1091,7 @@ let release ~xc ~xs ~hvm pcidevs domid devid =
List.iter (fun dev ->
grant_access_resources xc domid dev.resources false;
if dev.irq > 0 then
- Xc.domain_irq_permission xc domid dev.irq false
+ Xenctrl.domain_irq_permission xc domid dev.irq false
) pcidevs;
()
@@ -1172,9 +1173,9 @@ let reset ~xs (x: dev) =
let clean_shutdown ~xs (x: device) =
debug "Device.Pci.clean_shutdown %s" (string_of_device x);
let devs = enumerate_devs ~xs x in
- Xc.with_intf (fun xc ->
+ Xenctrl.with_intf (fun xc ->
let hvm =
- try (Xc.domain_getinfo xc x.frontend.domid).Xc.hvm_guest
+ try (Xenctrl.domain_getinfo xc x.frontend.domid).Xenctrl.hvm_guest
with _ -> false
in
try release ~xc ~xs ~hvm devs x.frontend.domid x.frontend.devid
@@ -1218,7 +1219,7 @@ let wait_device_model ~xc ~xs domid =
let read_pcidir ~xc ~xs domid =
let path = device_model_pci_device_path xs 0 domid in
let prefix = "dev-" in
- let all = List.filter (String.startswith prefix) (try xs.Xs.directory path with Xb.Noent -> []) in
+ let all = List.filter (String.startswith prefix) (try xs.Xs.directory path with Xenbus.Xb.Noent -> []) in
(* The values are the PCI device (domain, bus, dev, func) strings *)
let device_number_of_string x =
(* remove the silly prefix *)
@@ -1247,7 +1248,7 @@ let plug ~xc ~xs (domain, bus, dev, func) domid =
| x ->
failwith
(Printf.sprintf "Waiting for state=pci-inserted; got state=%s" x) in
- Xc.domain_assign_device xc domid (domain, bus, dev, func)
+ Xenctrl.domain_assign_device xc domid (domain, bus, dev, func)
let unplug ~xc ~xs (domain, bus, dev, func) domid =
let current = list ~xc ~xs domid in
@@ -1265,7 +1266,7 @@ let unplug ~xc ~xs (domain, bus, dev, func) domid =
in
(* CA-62028: tell the device to stop whatever it's doing *)
do_flr pci;
- Xc.domain_deassign_device xc domid (domain, bus, dev, func)
+ Xenctrl.domain_deassign_device xc domid (domain, bus, dev, func)
end
@@ -1324,12 +1325,12 @@ let add ~xc ~xs ?(backend_domid=0) ?(protocol=Protocol_Native) domid =
let back = [
"frontend-id", sprintf "%u" domid;
"online", "1";
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
] in
let front = [
"backend-id", string_of_int backend_domid;
"protocol", (string_of_protocol protocol);
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
] in
Generic.add_device ~xs device back front [];
()
@@ -1356,12 +1357,12 @@ let add ~xc ~xs ?(backend_domid=0) ?(protocol=Protocol_Native) domid =
let back = [
"frontend-id", sprintf "%u" domid;
"online", "1";
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
] in
let front = [
"backend-id", string_of_int backend_domid;
"protocol", (string_of_protocol protocol);
- "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+ "state", string_of_int (Xenbus_utils.int_of Xenbus_utils.Initialising);
] in
Generic.add_device ~xs device back front [];
()
View
110 ocaml/xenops/device.mli
@@ -26,8 +26,8 @@ exception Cdrom
module Generic :
sig
- val rm_device_state : xs:Xs.xsh -> device -> unit
- val exists : xs:Xs.xsh -> device -> bool
+ val rm_device_state : xs:Xenstore.Xs.xsh -> device -> unit
+ val exists : xs:Xenstore.Xs.xsh -> device -> bool
end
module Vbd :
@@ -50,7 +50,7 @@ sig
val device_major_minor : string -> int * int
val major_minor_to_device : int * int -> string
- val add : xs:Xs.xsh -> hvm:bool -> mode:mode
+ val add : xs:Xenstore.Xs.xsh -> hvm:bool -> mode:mode
-> device_number:Device_number.t
-> phystype:physty -> params:string
-> dev_type:devty
@@ -58,24 +58,24 @@ sig
-> ?protocol:protocol
-> ?extra_backend_keys:(string*string) list
-> ?extra_private_keys:(string*string) list
- -> ?backend_domid:Xc.domid
- -> Xc.domid -> device
+ -> ?backend_domid:Xenctrl.domid
+ -> Xenctrl.domid -> device
- val release : xs:Xs.xsh -> device -> unit
- val media_eject : xs:Xs.xsh -> device_number:Device_number.t -> int -> unit
- val media_insert : xs:Xs.xsh -> device_number:Device_number.t
+ val release : xs:Xenstore.Xs.xsh -> device -> unit
+ val media_eject : xs:Xenstore.Xs.xsh -> device_number:Device_number.t -> int -> unit
+ val media_insert : xs:Xenstore.Xs.xsh -> device_number:Device_number.t
-> params:string -> phystype:physty -> int -> unit
- val media_refresh : xs:Xs.xsh -> device_number:Device_number.t -> params:string -> int -> unit
- val media_is_ejected : xs:Xs.xsh -> device_number:Device_number.t -> int -> bool
- val media_tray_is_locked : xs:Xs.xsh -> device_number:Device_number.t -> int -> bool
+ val media_refresh : xs:Xenstore.Xs.xsh -> device_number:Device_number.t -> params:string -> int -> unit
+ val media_is_ejected : xs:Xenstore.Xs.xsh -> device_number:Device_number.t -> int -> bool
+ val media_tray_is_locked : xs:Xenstore.Xs.xsh -> device_number:Device_number.t -> int -> bool
- val pause : xs:Xs.xsh -> device -> string (* token *)
- val unpause : xs:Xs.xsh -> device -> string (* token *) -> unit
- val is_paused : xs:Xs.xsh -> device -> bool
+ val pause : xs:Xenstore.Xs.xsh -> device -> string (* token *)
+ val unpause : xs:Xenstore.Xs.xsh -> device -> string (* token *) -> unit
+ val is_paused : xs:Xenstore.Xs.xsh -> device -> bool
(* For migration: *)
- val hard_shutdown_request : xs:Xs.xsh -> device -> unit
- val hard_shutdown_complete : xs:Xs.xsh -> device -> string Watch.t
+ val hard_shutdown_request : xs:Xenstore.Xs.xsh -> device -> unit
+ val hard_shutdown_complete : xs:Xenstore.Xs.xsh -> device -> string Watch.t
end
@@ -83,40 +83,40 @@ module Vif :
sig
exception Invalid_Mac of string
- val add : xs:Xs.xsh -> devid:int -> netty:Netman.netty
+ val add : xs:Xenstore.Xs.xsh -> devid:int -> netty:Netman.netty
-> mac:string -> carrier:bool
-> ?mtu:int -> ?rate:(int64 * int64) option
- -> ?protocol:protocol -> ?backend_domid:Xc.domid
+ -> ?protocol:protocol -> ?backend_domid:Xenctrl.domid
-> ?other_config:((string * string) list)
- -> ?extra_private_keys:(string * string) list -> Xc.domid
+ -> ?extra_private_keys:(string * string) list -> Xenctrl.domid
-> device
- val set_carrier : xs:Xs.xsh -> device -> bool -> unit
- val release : xs:Xs.xsh -> device -> unit
+ val set_carrier : xs:Xenstore.Xs.xsh -> device -> bool -> unit
+ val release : xs:Xenstore.Xs.xsh -> device -> unit
end
-val clean_shutdown : xs:Xs.xsh -> device -> unit
-val hard_shutdown : xs:Xs.xsh -> device -> unit
+val clean_shutdown : xs:Xenstore.Xs.xsh -> device -> unit
+val hard_shutdown : xs:Xenstore.Xs.xsh -> device -> unit
-val can_surprise_remove : xs:Xs.xsh -> device -> bool
+val can_surprise_remove : xs:Xenstore.Xs.xsh -> device -> bool
module Vcpu :
sig
- val add : xs:Xs.xsh -> devid:int -> int -> unit
- val del : xs:Xs.xsh -> devid:int -> int -> unit
- val set : xs:Xs.xsh -> devid:int -> int -> bool -> unit
- val status : xs:Xs.xsh -> devid:int -> int -> bool
+ val add : xs:Xenstore.Xs.xsh -> devid:int -> int -> unit
+ val del : xs:Xenstore.Xs.xsh -> devid:int -> int -> unit
+ val set : xs:Xenstore.Xs.xsh -> devid:int -> int -> bool -> unit
+ val status : xs:Xenstore.Xs.xsh -> devid:int -> int -> bool
end
module PV_Vnc :
sig
exception Failed_to_start
- val save : xs:Xs.xsh -> Xc.domid -> unit
- val get_statefile : xs:Xs.xsh -> Xc.domid -> string option
- val start : ?statefile:string -> xs:Xs.xsh -> Xc.domid -> unit
- val stop : xs:Xs.xsh -> Xc.domid -> unit
+ val save : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
+ val get_statefile : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> string option
+ val start : ?statefile:string -> xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
+ val stop : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
- val get_vnc_port : xs:Xs.xsh -> Xc.domid -> int option
- val get_tc_port : xs:Xs.xsh -> Xc.domid -> int option
+ val get_vnc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
+ val get_tc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
end
module PCI :
@@ -136,30 +136,30 @@ sig
exception Cannot_use_pci_with_no_pciback of t list
- val add : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool -> msitranslate:int -> pci_power_mgmt:int
- -> ?flrscript:string option -> dev list -> Xc.domid -> int -> unit
- val release : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool
- -> (int * int * int * int) list -> Xc.domid -> int -> unit
- val reset : xs:Xs.xsh -> dev -> unit
+ val add : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> hvm:bool -> msitranslate:int -> pci_power_mgmt:int
+ -> ?flrscript:string option -> dev list -> Xenctrl.domid -> int -> unit
+ val release : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> hvm:bool
+ -> (int * int * int * int) list -> Xenctrl.domid -> int -> unit
+ val reset : xs:Xenstore.Xs.xsh -> dev -> unit
val bind : dev list -> unit
- val plug : xc:Xc.handle -> xs:Xs.xsh -> dev -> Xc.domid -> unit
- val unplug : xc:Xc.handle -> xs:Xs.xsh -> dev -> Xc.domid -> unit
- val list : xc:Xc.handle -> xs:Xs.xsh -> Xc.domid -> (int * dev) list
+ val plug : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> dev -> Xenctrl.domid -> unit
+ val unplug : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> dev -> Xenctrl.domid -> unit
+ val list : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> Xenctrl.domid -> (int * dev) list
end
module Vfs :
sig
- val add : xc:Xc.handle -> xs:Xs.xsh -> ?backend_domid:int -> Xc.domid -> unit
+ val add : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> ?backend_domid:int -> Xenctrl.domid -> unit
end
module Vfb :
sig
- val add : xc:Xc.handle -> xs:Xs.xsh -> ?backend_domid:int -> ?protocol:protocol -> Xc.domid -> unit
+ val add : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> ?backend_domid:int -> ?protocol:protocol -> Xenctrl.domid -> unit
end
module Vkbd :
sig
- val add : xc:Xc.handle -> xs:Xs.xsh -> ?backend_domid:int -> ?protocol:protocol -> Xc.domid -> unit
+ val add : xc:Xenctrl.handle -> xs:Xenstore.Xs.xsh -> ?backend_domid:int -> ?protocol:protocol -> Xenctrl.domid -> unit
end
module Dm :
@@ -202,18 +202,18 @@ sig
extras: (string * string option) list;
}
- val get_vnc_port : xs:Xs.xsh -> Xc.domid -> int option
- val get_tc_port : xs:Xs.xsh -> Xc.domid -> int option
+ val get_vnc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
+ val get_tc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
- val signal : xs:Xs.xsh -> domid:Xc.domid -> ?wait_for:string -> ?param:string
+ val signal : xs:Xenstore.Xs.xsh -> domid:Xenctrl.domid -> ?wait_for:string -> ?param:string
-> string -> unit
- val start : xs:Xs.xsh -> dmpath:string -> ?timeout:float -> info -> Xc.domid -> unit
- val restore : xs:Xs.xsh -> dmpath:string -> ?timeout:float -> info -> Xc.domid -> unit
- val suspend : xs:Xs.xsh -> Xc.domid -> unit
- val resume : xs:Xs.xsh -> Xc.domid -> unit
- val stop : xs:Xs.xsh -> Xc.domid -> unit
+ val start : xs:Xenstore.Xs.xsh -> dmpath:string -> ?timeout:float -> info -> Xenctrl.domid -> unit
+ val restore : xs:Xenstore.Xs.xsh -> dmpath:string -> ?timeout:float -> info -> Xenctrl.domid -> unit
+ val suspend : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
+ val resume : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
+ val stop : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> unit
end
-val get_vnc_port : xs:Xs.xsh -> Xc.domid -> int option
-val get_tc_port : xs:Xs.xsh -> Xc.domid -> int option
+val get_vnc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
+val get_tc_port : xs:Xenstore.Xs.xsh -> Xenctrl.domid -> int option
View
9 ocaml/xenops/device_common.ml
@@ -15,12 +15,13 @@ open Printf
open Stringext
open Hashtblext
open Pervasiveext
+open Xenstore
type kind = Vif | Vbd | Tap | Pci | Vfs | Vfb | Vkbd
type devid = int
(** Represents one end of a device *)
-type endpoint = { domid: Xc.domid; kind: kind; devid: int }
+type endpoint = { domid: Xenctrl.domid; kind: kind; devid: int }
(** Represent a device as a pair of endpoints *)
type device = {
@@ -51,7 +52,7 @@ let kind_of_string = function
let string_of_endpoint (x: endpoint) =
sprintf "(domid=%d | kind=%s | devid=%d)" x.domid (string_of_kind x.kind) x.devid
-let backend_path ~xs (backend: endpoint) (domu: Xc.domid) =
+let backend_path ~xs (backend: endpoint) (domu: Xenctrl.domid) =
sprintf "%s/backend/%s/%u/%d"
(xs.Xs.getdomainpath backend.domid)
(string_of_kind backend.kind)
@@ -111,7 +112,7 @@ let backend_pause_done_path_of_device ~xs (x: device) =
let string_of_device (x: device) =
sprintf "frontend %s; backend %s" (string_of_endpoint x.frontend) (string_of_endpoint x.backend)
-let device_of_backend (backend: endpoint) (domu: Xc.domid) =
+let device_of_backend (backend: endpoint) (domu: Xenctrl.domid) =
let frontend = { domid = domu;
kind = (match backend.kind with
| Vbd | Tap -> Vbd
@@ -151,7 +152,7 @@ let parse_backend_link x =
end
| _ -> None
-let readdir ~xs d = try xs.Xs.directory d with Xb.Noent -> []
+let readdir ~xs d = try xs.Xs.directory d with Xenbus.Xb.Noent -> []
let to_list ys = List.concat (List.map Opt.to_list ys)
let list_kinds ~xs dir = to_list (List.map parse_kind (readdir ~xs dir))
View
32 ocaml/xenops/device_common.mli
@@ -17,7 +17,7 @@ type kind = Vif | Vbd | Tap | Pci | Vfs | Vfb | Vkbd
type devid = int
(** Represents one end of a device *)
-type endpoint = { domid: Xc.domid; kind: kind; devid: int }
+type endpoint = { domid: Xenctrl.domid; kind: kind; devid: int }
(** Represent a device as a pair of endpoints *)
type device = {
@@ -32,19 +32,19 @@ exception Device_error of device * string
exception Device_unrecognized of string
exception Hotplug_script_expecting_field of device * string
-val backend_path : xs:Xs.xsh -> endpoint -> Xc.domid -> string
-val backend_path_of_device : xs:Xs.xsh -> device -> string
-val frontend_path_of_device : xs:Xs.xsh -> device -> string
-val disconnect_path_of_device : xs:Xs.xsh -> device -> string
-val error_path_of_device : xs:Xs.xsh -> device -> string
-val backend_error_path_of_device : xs:Xs.xsh -> device -> string
+val backend_path : xs:Xenstore.Xs.xsh -> endpoint -> Xenctrl.domid -> string
+val backend_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val frontend_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val disconnect_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val error_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val backend_error_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
-val backend_shutdown_request_path_of_device : xs:Xs.xsh -> device -> string
-val backend_shutdown_done_path_of_device : xs:Xs.xsh -> device -> string
+val backend_shutdown_request_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val backend_shutdown_done_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
-val backend_pause_request_path_of_device : xs:Xs.xsh -> device -> string
-val backend_pause_token_path_of_device : xs:Xs.xsh -> device -> string
-val backend_pause_done_path_of_device : xs:Xs.xsh -> device -> string
+val backend_pause_request_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val backend_pause_token_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
+val backend_pause_done_path_of_device : xs:Xenstore.Xs.xsh -> device -> string
val string_of_endpoint : endpoint -> string
val string_of_device : device -> string
@@ -54,18 +54,18 @@ val kind_of_string : string -> kind
(** [list_backends xs domid] returns a list of devices where there is a
backend in [domid]. This function only reads data stored in the backend