Permalink
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...
1 parent cbb71bb commit 6314f5dd8c2f7b87df2d0c8452b7290d4d7ffc3f @jonludlam jonludlam committed Oct 10, 2011
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
@@ -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)
@@ -17,6 +17,7 @@ open Printf
open Debug
open Http
open Vmopshelpers
+open Xenstore
exception Failure
View
@@ -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
@@ -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
@@ -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;
) ()
@@ -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
@@ -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 *)
@@ -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
Oops, something went wrong.

0 comments on commit 6314f5d

Please sign in to comment.