# HG changeset patch
# User root@xxxxxxxxxxxxxxxxxxxxx
# Date 1291305003 18000
# Node ID 15700c869b5445ce6d239513c54d6f69f9d62808
# Parent 2e6a1485047a2e91c2e90d8ffdbf6c9a9814588c
HACK/PoC: adjust for minor differences in upstream Xc bindings
Just a PoC at this stage. It might be better to push the interface differences
to xen-api-libs.hg now to reduce the churn when rebasing to 4.1
Not-Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/balloon.ml
--- a/ocaml/xenops/balloon.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/balloon.ml Thu Dec 02 10:50:03 2010 -0500
@@ -26,7 +26,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.using_injection ()
+let on_xiu () = Xc.is_fake ()
(** Reads /proc/xen/balloon into a string * int64 option association list *)
let parse_proc_xen_balloon () =
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/device.ml
--- a/ocaml/xenops/device.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/device.ml Thu Dec 02 10:50:03 2010 -0500
@@ -749,8 +749,8 @@ let add ~xs ~devid ~netty ~mac ?mtu ?(ra
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.using_injection ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
- | Netman.Vswitch b -> [ "bridge", b; "bridge-MAC",
if(Xc.using_injection ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
+ | 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.DriverDomain -> []
| Netman.Nat -> []) @
(match rate with | None -> [] | Some(rate, timeslice) -> [ "rate",
Int64.to_string rate; "timeslice", Int64.to_string timeslice ]) in
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/domain.ml
--- a/ocaml/xenops/domain.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/domain.ml Thu Dec 02 10:50:03 2010 -0500
@@ -837,7 +837,9 @@ let vcpu_affinity_set ~xc domid vcpu cpu
Array.iteri (fun i has_affinity ->
if has_affinity then bitmap := bit_set !bitmap i
) cpumap;
- Xc.vcpu_affinity_set xc domid vcpu !bitmap
+ (*Xc.vcpu_affinity_set xc domid vcpu !bitmap*)
+ Xc.vcpu_affinity_set xc domid vcpu cpumap
+
let vcpu_affinity_get ~xc domid vcpu =
let bitmap = Xc.vcpu_affinity_get xc domid vcpu in
@@ -845,8 +847,9 @@ let vcpu_affinity_get ~xc domid vcpu =
let bit_isset bitmap n =
(Int64.logand bitmap (Int64.shift_left 1L n)) > 0L in
(* set bit in the array that are set in the bitmap *)
- for i = 0 to 63 do cpumap.(i) <- bit_isset bitmap i done;
- cpumap
+ (*for i = 0 to 63 do cpumap.(i) <- bit_isset bitmap i done;*)
+ (*cpumap*)
+ bitmap
let get_uuid ~xc domid =
Uuid.uuid_of_int_array (Xc.domain_getinfo xc domid).Xc.handle
@@ -961,19 +964,20 @@ let cpuid_set ~xc ~hvm domid cfg =
let tmp = Array.create 4 None in
let cfgout = List.map (fun (node, constr) ->
cpuid_cfg_to_xc_cpuid_cfg tmp constr;
- let ret = Xc.domain_cpuid_set xc domid hvm node tmp in
+ let ret = Xc.domain_cpuid_set xc domid (*hvm*) node tmp in
let ret = cpuid_cfg_of_xc_cpuid_cfg ret in
(node, ret)
) cfg in
cfgout
let cpuid_apply ~xc ~hvm domid =
- Xc.domain_cpuid_apply xc domid hvm
+ (*Xc.domain_cpuid_apply xc domid hvm*)
+ Xc.domain_cpuid_apply_policy xc domid
-let cpuid_check cfg =
+let cpuid_check ~xc cfg =
let tmp = Array.create 4 None in
List.map (fun (node, constr) ->
cpuid_cfg_to_xc_cpuid_cfg tmp constr;
- let (success, cfgout) = Xc.cpuid_check node tmp in
+ let (success, cfgout) = Xc.cpuid_check xc node tmp in
(success, (node, (cpuid_cfg_of_xc_cpuid_cfg cfgout)))
) cfg
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/domain.mli
--- a/ocaml/xenops/domain.mli Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/domain.mli Thu Dec 02 10:50:03 2010 -0500
@@ -206,4 +206,4 @@ val cpuid_rtype_of_char : char -> cpuid_
val cpuid_set : xc: Xc.handle -> hvm: bool -> domid -> cpuid_config ->
cpuid_config
val cpuid_apply : xc: Xc.handle -> hvm: bool -> domid -> unit
-val cpuid_check : cpuid_config -> (bool * ((int64 * int64 option) * (cpuid_reg
* cpuid_rtype array) list)) list
+val cpuid_check : xc: Xc.handle -> cpuid_config -> (bool * ((int64 * int64
option) * (cpuid_reg * cpuid_rtype array) list)) list
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/netman.ml
--- a/ocaml/xenops/netman.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/netman.ml Thu Dec 02 10:50:03 2010 -0500
@@ -27,7 +27,7 @@ let online vif netty =
Netdev.Link.arp dev false;
Netdev.Link.multicast dev false;
Netdev.Link.set_addr dev
- (if(Xc.using_injection ()) then "fe:fe:fe:fe:fe:fe" else
"fe:ff:ff:ff:ff:ff");
+ (if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else
"fe:ff:ff:ff:ff:ff");
Netdev.Addr.flush dev
in
match netty with
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenops/xenguestHelper.ml
--- a/ocaml/xenops/xenguestHelper.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenops/xenguestHelper.ml Thu Dec 02 10:50:03 2010 -0500
@@ -41,7 +41,7 @@ let connect (args: string list) (fds: (s
(* Need to send commands and receive responses from the
slave process *)
- let using_xiu = Xc.using_injection () in
+ let using_xiu = Xc.is_fake () in
let last_log_file = "/tmp/xenguest.log" in
(try Unix.unlink last_log_file with _ -> ());
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenstored/event.ml
--- a/ocaml/xenstored/event.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenstored/event.ml Thu Dec 02 10:50:03 2010 -0500
@@ -13,14 +13,15 @@
*)
(**************** high level binding ****************)
type t = {
- fd: Unix.file_descr;
+ handle: Eventchn.handle;
mutable virq_port: int;
}
-let init () = { fd = Eventchn.init (); virq_port = -1; }
-let bind_virq eventchn = eventchn.virq_port <- Eventchn.bind_virq eventchn.fd
-let bind_interdomain eventchn domid port = Eventchn.bind_interdomain
eventchn.fd domid port
-let unbind eventchn port = Eventchn.unbind eventchn.fd port
-let notify eventchn port = Eventchn.notify eventchn.fd port
-let read_port eventchn = Eventchn.read_port eventchn.fd
-let write_port eventchn port = Eventchn.write_port eventchn.fd port
+let init () = { handle = Eventchn.init (); virq_port = -1; }
+let fd eventchn = Eventchn.fd eventchn.handle
+let bind_dom_exc_virq eventchn = eventchn.virq_port <-
Eventchn.bind_dom_exc_virq eventchn.handle
+let bind_interdomain eventchn domid port = Eventchn.bind_interdomain
eventchn.handle domid port
+let unbind eventchn port = Eventchn.unbind eventchn.handle port
+let notify eventchn port = Eventchn.notify eventchn.handle port
+let pending eventchn = Eventchn.pending eventchn.handle
+let unmask eventchn port = Eventchn.unmask eventchn.handle port
diff -r 2e6a1485047a -r 15700c869b54 ocaml/xenstored/xenstored.ml
--- a/ocaml/xenstored/xenstored.ml Thu Nov 18 05:36:56 2010 -0500
+++ b/ocaml/xenstored/xenstored.ml Thu Dec 02 10:50:03 2010 -0500
@@ -249,7 +249,7 @@ let _ =
if cf.restart then (
DB.from_file store domains cons "/var/run/xenstored/db";
- Event.bind_virq eventchn
+ Event.bind_dom_exc_virq eventchn
) else (
if !Disk.enable then (
info "reading store from disk";
@@ -261,9 +261,9 @@ let _ =
Store.mkdir store (Perms.Connection.create 0) localpath;
if cf.domain_init then (
- let usingxiu = Xc.using_injection () in
+ let usingxiu = Xc.is_fake () in
Connections.add_domain cons (Domains.create0 usingxiu
domains);
- Event.bind_virq eventchn
+ Event.bind_dom_exc_virq eventchn
);
);
@@ -275,7 +275,7 @@ let _ =
Logging.init cf.activate_access_log (fun () -> DB.to_file store cons
"/var/run/xenstored/db");
let spec_fds = [ rw_sock; ro_sock ] @
- (if cf.domain_init then [ eventchn.Event.fd ] else []) in
+ (if cf.domain_init then [ Event.fd eventchn ] else []) in
let xc = Xc.interface_open () in
@@ -285,7 +285,7 @@ let _ =
debug "new connection through socket";
Connections.add_anonymous cons cfd can_write
and handle_eventchn fd =
- let port = Event.read_port eventchn in
+ let port = Event.pending eventchn in
finally (fun () ->
if port = eventchn.Event.virq_port then (
let (notify, deaddom) = Domains.cleanup
xc domains in
@@ -293,14 +293,14 @@ let _ =
if deaddom <> [] || notify then
Connections.fire_spec_watches
cons "@releaseDomain"
)
- ) (fun () -> Event.write_port eventchn port);
+ ) (fun () -> Event.unmask eventchn port);
and do_if_set fd set fct =
if List.mem fd set then
fct fd in
do_if_set rw_sock rset (accept_connection true);
do_if_set ro_sock rset (accept_connection false);
- do_if_set eventchn.Event.fd rset (handle_eventchn)
+ do_if_set (Event.fd eventchn) rset (handle_eventchn)
in
let last_stat_time = ref 0. in
diff -r 2e6a1485047a -r 15700c869b54 scripts/init.d-squeezed
--- a/scripts/init.d-squeezed Thu Nov 18 05:36:56 2010 -0500
+++ b/scripts/init.d-squeezed Thu Dec 02 10:50:03 2010 -0500
@@ -25,6 +25,7 @@ SUBSYS_FILE="/var/lock/subsys/squeezed"
. /etc/init.d/functions
if [ -e /var/xapi/xiu-xc ]; then
+ export XENCTRL_OSDEP=/opt/xensource/lib/xenctrl/osdep_xiu.so
export XIU=/var/xapi/xiu
fi
diff -r 2e6a1485047a -r 15700c869b54 scripts/init.d-xapi
--- a/scripts/init.d-xapi Thu Nov 18 05:36:56 2010 -0500
+++ b/scripts/init.d-xapi Thu Dec 02 10:50:03 2010 -0500
@@ -16,6 +16,7 @@ if [ -f /etc/sysconfig/xapi ]; then
fi
if [ -e /var/xapi/xiu-xc ]; then
+ export XENCTRL_OSDEP=/opt/xensource/lib/xenctrl/osdep_xiu.so
export XIU=/var/xapi/xiu
fi
diff -r 2e6a1485047a -r 15700c869b54 scripts/init.d-xenservices
--- a/scripts/init.d-xenservices Thu Nov 18 05:36:56 2010 -0500
+++ b/scripts/init.d-xenservices Thu Dec 02 10:50:03 2010 -0500
@@ -36,6 +36,7 @@ start() {
failure $"xiu"
exit 1
fi
+ export XENCTRL_OSDEP=/opt/xensource/lib/xenctrl/osdep_xiu.so
export XIU=/var/xapi/xiu
fi
echo -n $"Starting xenstored: "
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|