From: Rok Strnisa Date: Wed, 26 Jan 2011 17:39:04 +0000 (+0000) Subject: Removed a small subset of compiler warnings. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7ea3bb0a26e839534fd5e712c86c27b16664ba00;p=xcp%2Fxen-api.git Removed a small subset of compiler warnings. Signed-off-by: Rok Strnisa --- diff --git a/ocaml/idl/dm_api.ml b/ocaml/idl/dm_api.ml index 407a3936..69917bc2 100644 --- a/ocaml/idl/dm_api.ml +++ b/ocaml/idl/dm_api.ml @@ -193,8 +193,8 @@ let check api emergency_calls = (* Sanity check 7: message parameters must be in increasing order of in_product_since *) let are_in_vsn_order ps = - let rec getlast l = - match l with [x] -> x | x::xs -> getlast xs in + let rec getlast l = (* TODO: move to standard library *) + match l with [x] -> x | _::xs -> getlast xs | [] -> raise (Invalid_argument "getlast") in let release_lt x y = release_leq x y && x<>y in let in_since releases = (* been in since the lowest of releases *) let rec find_smallest sofar l = diff --git a/ocaml/idl/ocaml_backend/event_helper.ml b/ocaml/idl/ocaml_backend/event_helper.ml index 8be1483b..e295bcc6 100644 --- a/ocaml/idl/ocaml_backend/event_helper.ml +++ b/ocaml/idl/ocaml_backend/event_helper.ml @@ -72,4 +72,4 @@ open Pervasiveext | "message" -> Message (Ref.of_string ev.Event_types.reference,API.From.message_t "" xmlrpc) | "secret" -> Secret (Ref.of_string ev.Event_types.reference,API.From.secret_t "" xmlrpc) | "vmpp" -> VMPP (Ref.of_string ev.Event_types.reference,API.From.vMPP_t "" xmlrpc) - + | _ -> failwith "unknown event type" diff --git a/ocaml/perftest/createVM.ml b/ocaml/perftest/createVM.ml index 11f9c641..06cfb2ba 100644 --- a/ocaml/perftest/createVM.ml +++ b/ocaml/perftest/createVM.ml @@ -38,7 +38,7 @@ let make_iscsi session_id pool network = let template = List.hd (Client.VM.get_by_name_label rpc session_id iscsi_vm_template) in let newvm = Client.VM.clone rpc session_id template "ISCSI target server" in Client.VM.provision rpc session_id newvm; - let isovbd = Client.VBD.create rpc session_id newvm iscsi_iso "0" true `RO `CD false false [] "" [] in + let _ (* isovbd *) = Client.VBD.create rpc session_id newvm iscsi_iso "0" true `RO `CD false false [] "" [] in let realpool = List.hd (Client.Pool.get_all rpc session_id) in let defaultsr = Client.Pool.get_default_SR rpc session_id realpool in @@ -46,7 +46,7 @@ let make_iscsi session_id pool network = let storage_vdi_label = Printf.sprintf "SCSI VDI %d" i in let storage_vdi = Client.VDI.create rpc session_id storage_vdi_label "" defaultsr sr_disk_size `user false false [oc_key,pool.key] [] [] [] in let userdevice = Printf.sprintf "%d" (i+1) in - Client.VBD.create rpc session_id newvm storage_vdi userdevice false `RW `Disk false false [] "" [] + ignore(Client.VBD.create rpc session_id newvm storage_vdi userdevice false `RW `Disk false false [] "" []) done; Client.VM.set_PV_bootloader rpc session_id newvm "pygrub"; diff --git a/ocaml/xapi/events.ml b/ocaml/xapi/events.ml index 65878eb0..2d64e2f0 100644 --- a/ocaml/xapi/events.ml +++ b/ocaml/xapi/events.ml @@ -497,7 +497,7 @@ let callback_devices ctx domid dev_event = then Hashtbl.replace Monitor.uncooperative_domains domid () else Hashtbl.remove Monitor.uncooperative_domains domid ) - | x -> debug "no handler for this event" + (*unused case, consider removing: | x -> debug "no handler for this event"*) with Vm_corresponding_to_domid_not_in_db domid -> error "device_event could not be processed because VM record not in database" diff --git a/ocaml/xapi/message_forwarding.ml b/ocaml/xapi/message_forwarding.ml index 2f4e6273..10e2be48 100644 --- a/ocaml/xapi/message_forwarding.ml +++ b/ocaml/xapi/message_forwarding.ml @@ -17,6 +17,7 @@ open Threadext open Pervasiveext +open Listext open Stringext open Server_helpers open Client @@ -1080,7 +1081,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct (fun session_id rpc -> Client.VM.start rpc session_id vm start_paused force))))); update_vbd_operations ~__context ~vm; update_vif_operations ~__context ~vm; - let uuid = Db.VM.get_uuid ~__context ~self:vm in + let _ (* uuid *) = Db.VM.get_uuid ~__context ~self:vm in let message_body = Printf.sprintf "VM '%s' started on host: %s (uuid: %s)" (Db.VM.get_name_label ~__context ~self:vm) @@ -1177,8 +1178,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct else Some (Db.VBD.get_VDI ~__context ~self:vbd)) (Db.VM.get_VBDs ~__context ~self:vm) in - let all_vm_vdis = List.filter (fun x -> match x with (Some _) -> true | _ -> false) all_vm_vdis in - let all_vm_vdis = List.map (fun x -> match x with (Some y)->y) all_vm_vdis in + let all_vm_vdis = List.unbox_list all_vm_vdis in let all_vm_srs = List.map (fun vdi -> Db.VDI.get_SR ~self:vdi ~__context) all_vm_vdis in let suitable_host = Xapi_vm_helpers.choose_host ~__context ~vm:vm ~choose_fn:(Xapi_vm_helpers.assert_can_see_specified_SRs ~__context ~reqd_srs:all_vm_srs) () in diff --git a/ocaml/xapi/xapi_host.ml b/ocaml/xapi/xapi_host.ml index 1e15641b..1fe58220 100644 --- a/ocaml/xapi/xapi_host.ml +++ b/ocaml/xapi/xapi_host.ml @@ -111,11 +111,11 @@ let assert_bacon_mode ~__context ~host = let vms = Db.VM.get_refs_where ~__context ~expr:(And(Eq (Field "resident_on", Literal (Ref.string_of host)), Eq (Field "power_state", Literal "Running"))) in (* We always expect a control domain to be resident on a host *) - match List.filter (fun vm -> not (Db.VM.get_is_control_domain ~__context ~self:vm)) vms with + (match List.filter (fun vm -> not (Db.VM.get_is_control_domain ~__context ~self:vm)) vms with | [] -> () | guest_vms -> let vm_data = [selfref; "vm"; Ref.string_of (List.hd guest_vms)] in - raise (Api_errors.Server_error (Api_errors.host_in_use, vm_data)) + raise (Api_errors.Server_error (Api_errors.host_in_use, vm_data))); debug "Bacon test: VMs OK - %d running VMs" (List.length vms); let controldomain = List.find (fun vm -> Db.VM.get_resident_on ~__context ~self:vm = host && Db.VM.get_is_control_domain ~__context ~self:vm) (Db.VM.get_all ~__context) in diff --git a/ocaml/xapi/xapi_vm.ml b/ocaml/xapi/xapi_vm.ml index d212cdea..8e5e188f 100644 --- a/ocaml/xapi/xapi_vm.ml +++ b/ocaml/xapi/xapi_vm.ml @@ -159,8 +159,6 @@ let set_memory_limits ~__context ~self if Db.VM.get_power_state ~__context ~self <> `Halted then failwith "assertion_failed: set_memory_limits should only be \ called when the VM is Halted"; - (* Support the redundant target field. *) - let target = dynamic_min in (* Check that the new limits are in the correct order. *) let constraints = {Vm_memory_constraints. static_min = static_min; diff --git a/ocaml/xenops/watch.ml b/ocaml/xenops/watch.ml index f71a3799..bfa4bd5b 100644 --- a/ocaml/xenops/watch.ml +++ b/ocaml/xenops/watch.ml @@ -42,7 +42,7 @@ let wait_for ~xs ?(timeout=60. *. 20.) (x: 'a t) = let result = ref None in let start_time = Unix.gettimeofday () in - let time_taken () = Unix.gettimeofday () -. start_time in + (* let time_taken () = Unix.gettimeofday () -. start_time in *) let callback (path, _) = match x.evaluate ~xs with diff --git a/ocaml/xenops/xal.ml b/ocaml/xenops/xal.ml index 3a1e29a7..53239d31 100644 --- a/ocaml/xenops/xal.ml +++ b/ocaml/xenops/xal.ml @@ -65,7 +65,6 @@ let string_of_dev_state = function let string_of_dev_event ev = let string_of_string_opt = function None -> "\"\"" | Some s -> s in - let string_of_b b = if b then "B" else "F" in match ev with | DevEject i -> sprintf "device eject {%s}" i