[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 5 of 6] HACK/PoC: adjust for minor differences in upstream Xc bindings
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1294740909 0 # Node ID 5ee7f91dfdbc2b203cb07bd31a1eb15567a91718 # Parent 244aa754f123ed8531afd4124fc54769559c0359 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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/balloon.ml --- a/ocaml/xenops/balloon.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/balloon.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/device.ml --- a/ocaml/xenops/device.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/device.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/domain.ml --- a/ocaml/xenops/domain.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/domain.ml Tue Jan 11 10:15:09 2011 +0000 @@ -834,7 +834,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 @@ -842,8 +844,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 @@ -958,19 +961,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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/domain.mli --- a/ocaml/xenops/domain.mli Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/domain.mli Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/netman.ml --- a/ocaml/xenops/netman.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/netman.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenops/xenguestHelper.ml --- a/ocaml/xenops/xenguestHelper.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenops/xenguestHelper.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenstored/event.ml --- a/ocaml/xenstored/event.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenstored/event.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc ocaml/xenstored/xenstored.ml --- a/ocaml/xenstored/xenstored.ml Tue Jan 11 10:15:09 2011 +0000 +++ b/ocaml/xenstored/xenstored.ml Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc scripts/init.d-squeezed --- a/scripts/init.d-squeezed Tue Jan 11 10:15:09 2011 +0000 +++ b/scripts/init.d-squeezed Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc scripts/init.d-xapi --- a/scripts/init.d-xapi Tue Jan 11 10:15:09 2011 +0000 +++ b/scripts/init.d-xapi Tue Jan 11 10:15:09 2011 +0000 @@ -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 244aa754f123 -r 5ee7f91dfdbc scripts/init.d-xenservices --- a/scripts/init.d-xenservices Tue Jan 11 10:15:09 2011 +0000 +++ b/scripts/init.d-xenservices Tue Jan 11 10:15:09 2011 +0000 @@ -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-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |