# HG changeset patch # User Rok Strnisa # Date 1289323370 0 # Node ID 403764544b97988f2e3d5c1cd4608c34f61863b6 # Parent dd7e1f8d25ff8d75000725cc053d007cb2c838e2 imported patch removing-warnings diff --git a/ocaml/idl/dm_api.ml b/ocaml/idl/dm_api.ml --- 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 --- 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/idl/ocaml_backend/gen_db_actions.ml b/ocaml/idl/ocaml_backend/gen_db_actions.ml --- a/ocaml/idl/ocaml_backend/gen_db_actions.ml +++ b/ocaml/idl/ocaml_backend/gen_db_actions.ml @@ -232,7 +232,7 @@ let db_action api : O.Module.t = let get_record_aux_fn_body ?(m="API.") (obj: obj) (all_fields: field list) = let fields = List.filter field_in_this_table all_fields in - let sql_fields = List.map (fun f -> Escaping.escape_id f.full_name) fields in + let _ (* sql_fields *) = List.map (fun f -> Escaping.escape_id f.full_name) fields in let of_field = function | { DT.ty = DT.Set(DT.Ref other); full_name = full_name; DT.field_ignore_foreign_key = false } -> @@ -267,8 +267,8 @@ let db_action api : O.Module.t = ~body: [ get_record_aux_fn_body ~m:"" obj record_fields ] () in let get_records_where (obj: obj) name conversion_fn = - let record_name = OU.ocaml_of_record_name obj.DT.name in - let ref_name = OU.alias_of_ty (Ref obj.DT.name) in + let _ (* record_name *) = OU.ocaml_of_record_name obj.DT.name in + let _ (* ref_name *) = OU.alias_of_ty (Ref obj.DT.name) in O.Let.make ~name: name ~params: [ Gen_common.context_arg; expr_arg ] @@ -297,7 +297,7 @@ let db_action api : O.Module.t = let converter = O.type_of_param arg in Printf.sprintf "let %s = %s.%s %s in" binding _dm_to_string converter binding in - let snapshot self = snapshot obj.DT.name self in + (* let snapshot self = snapshot obj.DT.name self in *) let body = match tag with | FromField(Setter, fld) -> diff --git a/ocaml/idl/ocaml_backend/gen_rbac.ml b/ocaml/idl/ocaml_backend/gen_rbac.ml --- a/ocaml/idl/ocaml_backend/gen_rbac.ml +++ b/ocaml/idl/ocaml_backend/gen_rbac.ml @@ -313,10 +313,10 @@ let gen_permissions_of_static_roles high let api_roles_permissions = (get_roles_permissions_of_objs ([],all_objs)) (*api*) in - let http_roles_permissions = + let _ (* http_roles_permissions *) = (gen_roles_of_permissions get_http_permissions_roles) (*http*) in - let extra_roles_permisions = (* extra, not associated to api or http calls *) + let _ (* extra_roles_permisions *) = (* extra, not associated to api or http calls *) (gen_roles_of_permissions get_extra_permissions_roles) in let roles_permissions = (*api+http+extra*) diff --git a/ocaml/idl/ocaml_backend/gen_server.ml b/ocaml/idl/ocaml_backend/gen_server.ml --- a/ocaml/idl/ocaml_backend/gen_server.ml +++ b/ocaml/idl/ocaml_backend/gen_server.ml @@ -79,12 +79,12 @@ let operation (obj: obj) (x: message) = let msg_without_default_values = {x with DT.msg_params=msg_params_without_default_values} in let all_args = Client.args_of_message obj x in - let args_with_default_values = Client.args_of_message obj msg_with_default_values in + let _ (* args_with_default_values *) = Client.args_of_message obj msg_with_default_values in let args_without_default_values = Client.args_of_message obj msg_without_default_values in (* Constructors use a on the wire *) let is_ctor = x.msg_tag = FromObject(Make) && Client.use_structure_in_ctor in - let task = DT.Ref Datamodel._task in + let _ (* task *) = DT.Ref Datamodel._task in (* Result marshaller converts the result to a string for the Task table *) let result_marshaller = match x.msg_custom_marshaller, x.msg_result with @@ -209,7 +209,7 @@ let operation (obj: obj) (x: message) = let ret = match x.msg_result with Some(ty, _) -> Some ty | _ -> None in let type_xml = XMLRPC.TypeToXML.marshal ret in let module_prefix = if (Gen_empty_custom.operation_requires_side_effect x) then _custom else _db_defaults in - let cls = OU.ocaml_of_obj_name obj.DT.name in + let _ (* cls *) = OU.ocaml_of_obj_name obj.DT.name in let common_let_decs = [ "let marshaller = "^result_marshaller^" in"; diff --git a/ocaml/perftest/createVM.ml b/ocaml/perftest/createVM.ml --- 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/util/stats.ml b/ocaml/util/stats.ml --- a/ocaml/util/stats.ml +++ b/ocaml/util/stats.ml @@ -72,9 +72,9 @@ let string_of (p: Normal_population.t) = let sample (name: string) (x: float) = (* Use the lognormal distribution: *) let x' = log x in - let p = Mutex.execute timings_m + let _ (* p *) = Mutex.execute timings_m (fun () -> - let p = + let p = if Hashtbl.mem timings name then Hashtbl.find timings name else Normal_population.empty in diff --git a/ocaml/xapi/dbsync_slave.ml b/ocaml/xapi/dbsync_slave.ml --- a/ocaml/xapi/dbsync_slave.ml +++ b/ocaml/xapi/dbsync_slave.ml @@ -154,8 +154,8 @@ let update_vms ~xal ~__context = List.filter (fun (_, vm_r) -> not (Db.is_valid_ref vm_r.API.vM_resident_on)) all_scheduled_to_be_resident_on_vms in let all_vms_assigned_to_me = Listext.List.setify (all_resident_on_vms @ really_my_scheduled_to_be_resident_on_vms) in - let all_vbds = Db.VBD.get_records_where ~__context ~expr:Db_filter_types.True in - let all_vifs = Db.VIF.get_records_where ~__context ~expr:Db_filter_types.True in + let _ (* all_vbds *) = Db.VBD.get_records_where ~__context ~expr:Db_filter_types.True in + let _ (* all_vifs *) = Db.VIF.get_records_where ~__context ~expr:Db_filter_types.True in let power_states_where_domain_exists = [ `Running; `Paused ] in let my_running_vms_according_to_db = @@ -296,8 +296,8 @@ let update_vms ~xal ~__context = debug "killing umanaged domain: %s" (uuid_from_dinfo dinfo); Domain.destroy ~xc ~xs dinfo.Xc.domid (* bye-bye... *) in - let all_vm_refs = List.map fst all_vms_assigned_to_me in - let have_record_for dinfo = try let vmref,_ = vmrefrec_of_dinfo dinfo in true with _ -> false in + let _ (* all_vm_refs *) = List.map fst all_vms_assigned_to_me in + let have_record_for dinfo = try let _ (* vmref *), _ = vmrefrec_of_dinfo dinfo in true with _ -> false in let all_my_managed_domains = List.filter have_record_for all_my_domains in let my_active_managed_domains = List.filter have_record_for my_active_domains in diff --git a/ocaml/xapi/events.ml b/ocaml/xapi/events.ml --- a/ocaml/xapi/events.ml +++ b/ocaml/xapi/events.ml @@ -279,7 +279,7 @@ module Resync = struct with_xs (fun xs -> - let protocol = Helpers.device_protocol_of_string (Db.VM.get_domarch ~__context ~self:vm) in + let _ (* protocol *) = Helpers.device_protocol_of_string (Db.VM.get_domarch ~__context ~self:vm) in (* This is what the DB thinks: *) let is_attached = Db.VIF.get_currently_attached ~__context ~self:vif in let device = Xen_helpers.device_of_vif ~__context ~self:vif in @@ -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 --- 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 @@ -72,14 +73,14 @@ module Early_wakeup = struct finally (fun () -> let start = Unix.gettimeofday () in - let waited_full_length = Delay.wait d time in - let time_sleeping = Unix.gettimeofday () -. start in + let _ (* waited_full_length *) = Delay.wait d time in + let _ (* time_sleeping *) = Unix.gettimeofday () -. start in (* debug "Early_wakeup %s key = (%s, %s) after %.2f (speedup %.2f seconds)" (if waited_full_length then "slept" else "woken") a b time_sleeping (time -. time_sleeping) *)() ) (fun () -> Mutex.execute table_m (fun () -> Hashtbl.remove table key)) - let broadcast ((a, b) as key) = + let broadcast (a, b) (* ((a, b) as key) *) = (*debug "Early_wakeup broadcast key = (%s, %s)" a b;*) Mutex.execute table_m (fun () -> @@ -900,7 +901,7 @@ module Forward = functor(Local: Custom_a let clone ~__context ~vm ~new_name = info "VM.clone: VM = '%s'; new_name = '%s'" (vm_uuid ~__context vm) new_name; - let task_id = Ref.string_of (Context.get_task_id __context) in + let _ (* task_id *) = Ref.string_of (Context.get_task_id __context) in let local_fn = Local.VM.clone ~vm ~new_name in (* We mark the VM as cloning. We don't mark the disks; the implementation of the clone uses the API to clone and lock the individual VDIs. We don't give any atomicity @@ -919,7 +920,7 @@ module Forward = functor(Local: Custom_a (* almost a copy of the clone function *) let snapshot ~__context ~vm ~new_name = info "VM.snapshot: VM = '%s'; new_name = '%s'" (vm_uuid ~__context vm) new_name; - let task_id = Ref.string_of (Context.get_task_id __context) in + let _ (* task_id *) = Ref.string_of (Context.get_task_id __context) in let local_fn = Local.VM.snapshot ~vm ~new_name in (* We mark the VM as snapshoting. We don't mark the disks; the implementation of the snapshot uses the API *) (* to snapshot and lock the individual VDIs. We don't give any atomicity guarantees here but we do prevent *) @@ -931,7 +932,7 @@ module Forward = functor(Local: Custom_a let snapshot_with_quiesce ~__context ~vm ~new_name = info "VM.snapshot_with_quiesce: VM = '%s'; new_name = '%s'" (vm_uuid ~__context vm) new_name; - let task_id = Ref.string_of (Context.get_task_id __context) in + let _ (* task_id *) = Ref.string_of (Context.get_task_id __context) in let local_fn = Local.VM.snapshot_with_quiesce ~vm ~new_name in (* We mark the VM as snapshoting. We don't mark the disks; the implementation of the snapshot uses the API *) (* to snapshot and lock the individual VDIs. We don't give any atomicity guarantees here but we do prevent *) @@ -959,7 +960,7 @@ module Forward = functor(Local: Custom_a let copy ~__context ~vm ~new_name ~sr = info "VM.copy: VM = '%s'; new_name = '%s'; SR = '%s'" (vm_uuid ~__context vm) new_name (sr_uuid ~__context sr); - let task_id = Ref.string_of (Context.get_task_id __context) in + let _ (* task_id *) = Ref.string_of (Context.get_task_id __context) in let local_fn = Local.VM.copy ~vm ~new_name ~sr in (* We mark the VM as cloning. We don't mark the disks; the implementation of the clone uses the API to clone and lock the individual VDIs. We don't give any atomicity @@ -1080,7 +1081,7 @@ module Forward = functor(Local: Custom_a (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_a 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 @@ -1293,7 +1293,7 @@ module Forward = functor(Local: Custom_a (* same forwarding logic as clone *) let csvm ~__context ~vm = info "VM.csvm: VM = '%s'" (vm_uuid ~__context vm); - let task_id = Ref.string_of (Context.get_task_id __context) in + let _ (* task_id *) = Ref.string_of (Context.get_task_id __context) in let local_fn = Local.VM.csvm ~vm in (* We mark the VM as cloning. We don't mark the disks; the implementation of the clone uses the API to clone and lock the individual VDIs. We don't give any atomicity @@ -2924,7 +2924,7 @@ end let generate_config ~__context ~host ~vdi = info "VDI.generate_config: VDI = '%s'; host = '%s'" (vdi_uuid ~__context vdi) (host_uuid ~__context host); let local_fn = Local.VDI.generate_config ~host ~vdi in - let sR = Db.VDI.get_SR ~__context ~self:vdi in + let _ (* sR *) = Db.VDI.get_SR ~__context ~self:vdi in with_sr_andor_vdi ~__context ~vdi:(vdi, `generate_config) ~doc:"VDI.generate_config" (fun () -> do_op_on ~local_fn ~__context ~host diff --git a/ocaml/xapi/sparse_dd.ml b/ocaml/xapi/sparse_dd.ml --- a/ocaml/xapi/sparse_dd.ml +++ b/ocaml/xapi/sparse_dd.ml @@ -20,7 +20,7 @@ exception ShortWrite of int (* offset *) (* Consider a tunable quantum of non-zero'ness such that if we encounter a non-zero, we know we're going to incur the penalty of a seek/write and we may as well write a sizeable chunk at a time. *) -let roundup x = +let roundup x = let quantum = 16384 in ((x + quantum + quantum - 1) / quantum) * quantum @@ -113,13 +113,13 @@ end module File_reader = struct type t = Unix.file_descr let op stream stream_offset { buf = buf; offset = offset; len = len } = - Unix.LargeFile.lseek stream stream_offset Unix.SEEK_SET; - Unixext.really_read stream buf offset len + ignore(Unix.LargeFile.lseek stream stream_offset Unix.SEEK_SET); + Unixext.really_read stream buf offset len end module File_writer = struct type t = Unix.file_descr let op stream stream_offset { buf = buf; offset = offset; len = len } = - let newoff = Unix.LargeFile.lseek stream stream_offset Unix.SEEK_SET in + let _ (* newoff *) = Unix.LargeFile.lseek stream stream_offset Unix.SEEK_SET in (* Printf.printf "Unix.write buf len %d; offset %d; len %d\n" (String.length buf) offset len; *) let n = Unix.write stream buf offset len in if n < len @@ -246,9 +246,9 @@ let file_dd ?(progress_cb = (fun _ -> () end else begin let ofd = Unix.openfile dst [ Unix.O_WRONLY; Unix.O_CREAT ] 0o600 in (* Make sure the output file has the right size *) - Unix.LargeFile.lseek ofd (size -* 1L) Unix.SEEK_SET; - Unix.write ofd "\000" 0 1; - Unix.LargeFile.lseek ofd 0L Unix.SEEK_SET; + ignore(Unix.LargeFile.lseek ofd (size -* 1L) Unix.SEEK_SET); + ignore(Unix.write ofd "\000" 0 1); + ignore(Unix.LargeFile.lseek ofd 0L Unix.SEEK_SET); Printf.printf "Copying\n"; File_copy.copy progress_cb bat prezeroed ifd ofd blocksize size end diff --git a/ocaml/xapi/xapi.ml b/ocaml/xapi/xapi.ml --- a/ocaml/xapi/xapi.ml +++ b/ocaml/xapi/xapi.ml @@ -719,7 +719,7 @@ let server_init() = let service_name = Db.Host.get_external_auth_service_name ~__context ~self:host in let last_error = ref None in (* watchdog to indicate that on_xapi_initialize wasn't successful after 2 min initializing *) - Thread.create (fun ()-> Thread.delay (2.0 *. 60.0); (* wait 2min before testing for success *) + ignore(Thread.create (fun ()-> Thread.delay (2.0 *. 60.0); (* wait 2min before testing for success *) if not !Xapi_globs.event_hook_auth_on_xapi_initialize_succeeded then begin (* no success after 2 min *) let obj_uuid = Helpers.get_localhost_uuid () in @@ -738,7 +738,7 @@ let server_init() = ); )); end - ) (); + ) ()); (* persistent loop trying to initialize the external authentication service *) (* obs: this loop will also end after a host.disable_external_auth call *) while (not !Xapi_globs.event_hook_auth_on_xapi_initialize_succeeded) do diff --git a/ocaml/xapi/xapi_host.ml b/ocaml/xapi/xapi_host.ml --- 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 @@ -619,12 +619,12 @@ let license_apply ~__context ~host ~cont let create ~__context ~uuid ~name_label ~name_description ~hostname ~address ~external_auth_type ~external_auth_service_name ~external_auth_configuration ~license_params ~edition ~license_server = - let existing_host = try Some (Db.Host.get_by_uuid __context uuid) with _ -> None in + let _ (* existing_host *) = try Some (Db.Host.get_by_uuid __context uuid) with _ -> None in let make_new_metrics_object ref = Db.Host_metrics.create ~__context ~ref ~uuid:(Uuid.to_string (Uuid.make_uuid ())) ~live:false ~memory_total:0L ~memory_free:0L ~last_updated:Date.never ~other_config:[] in - let xapi_verstring = get_xapi_verstring() in + let _ (* xapi_verstring *) = get_xapi_verstring() in let name_description = "Default install of XenServer" and host = Ref.make () in @@ -1161,7 +1161,7 @@ let disable_external_auth_common ?during (Ext_auth.d()).on_disable config; None (* OK, on_disable succeeded *) with - | Auth_signature.Auth_service_error (errtag,msg) as e -> + | Auth_signature.Auth_service_error (errtag,msg) (* as e *) -> begin debug "Failed while calling on_disable event of external authentication plugin in host %s: %s" host_name_label msg; Some (Api_errors.Server_error(Api_errors.auth_disable_failed^(Auth_signature.suffix_of_tag errtag), [msg])) diff --git a/ocaml/xapi/xapi_pool.ml b/ocaml/xapi/xapi_pool.ml --- a/ocaml/xapi/xapi_pool.ml +++ b/ocaml/xapi/xapi_pool.ml @@ -295,7 +295,7 @@ let rec create_or_get_host_on_master __c (* Copy the suspend image SR *) let my_suspend_image_sr = Db.Host.get_crash_dump_sr ~__context ~self:host_ref in let my_suspend_image_sr_rec = Db.SR.get_record ~__context ~self:my_suspend_image_sr in - let syspend_image_sr = create_or_get_sr_on_master __context rpc session_id (my_suspend_image_sr, my_suspend_image_sr_rec) in + let _ (* syspend_image_sr *) = create_or_get_sr_on_master __context rpc session_id (my_suspend_image_sr, my_suspend_image_sr_rec) in no_exn (fun () -> Client.Host.set_crash_dump_sr ~rpc ~session_id ~self:ref ~value:my_suspend_image_sr) (); ref in @@ -820,7 +820,7 @@ let is_slave ~__context ~host = let is_slave = not (Pool_role.is_master ()) in info "Pool.is_slave call received (I'm a %s)" (if is_slave then "slave" else "master"); debug "About to kick the database connection to make sure it's still working..."; - Db.is_valid_ref (Ref.of_string "Pool.is_slave checking to see if the database connection is up"); + ignore(Db.is_valid_ref (Ref.of_string "Pool.is_slave checking to see if the database connection is up")); is_slave let hello ~__context ~host_uuid ~host_address = @@ -867,7 +867,7 @@ let hello ~__context ~host_uuid ~host_ad (* Update the heartbeat timestamp for this host so we don't mark it as offline in the next db_gc *) - Db_gc.tickle_heartbeat ~__context host_ref []; + ignore(Db_gc.tickle_heartbeat ~__context host_ref []); `ok with e -> debug "Caught exception: %s" (ExnHelper.string_of_exn e); @@ -1278,7 +1278,7 @@ let disable_external_auth ~__context ~po (* no failed host to add to the filtered list, just visit next host *) (host,"","") with - | Api_errors.Server_error (err,[host_msg]) as e -> begin + | Api_errors.Server_error (err,[host_msg]) (* as e *) -> begin let msg = (Printf.sprintf "%s: %s" (Db.Host.get_name_label ~__context ~self:host) host_msg) in debug "Failed to disable the external authentication of pool in host %s" msg; @@ -1449,7 +1449,7 @@ let disable_redo_log ~__context = let assert_is_valid_ip ip_addr = if ip_addr <> "" then - try Unix.inet_addr_of_string ip_addr; () + try ignore(Unix.inet_addr_of_string ip_addr) with _ -> raise (Api_errors.Server_error (Api_errors.invalid_ip_address_specified, [ "address" ])) let set_vswitch_controller ~__context ~address = @@ -1472,8 +1472,7 @@ let audit_log_append ~__context ~line = (* this is necessary here because the slave doesn't have access to these names *) let line = Rbac_audit.populate_audit_record_with_obj_names_of_refs line in (* copy audit record from slave exactly as it is, without any new prefixes *) - Rbac_audit.append_line ~raw:true "%s" line; - () + ignore(Rbac_audit.append_line ~raw:true "%s" line) let test_archive_target ~__context ~self ~config = Xapi_plugins.call_plugin diff --git a/ocaml/xapi/xapi_vm.ml b/ocaml/xapi/xapi_vm.ml --- 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; @@ -629,7 +627,7 @@ let hard_shutdown ~__context ~vm = let args = { TwoPhase.__context=__context; vm=vm; api_call_name="VM.hard_shutdown"; clean=false } in retry_on_conflict args (of_action action) with - | Api_errors.Server_error(code, _) as e + | Api_errors.Server_error(code, _) (* as e *) when code = Api_errors.vm_bad_power_state -> (* ToDo: How do you test directly if the VM is already shut-down? I hope we are not masking bugs here. diff --git a/ocaml/xenops/domain.ml b/ocaml/xenops/domain.ml --- a/ocaml/xenops/domain.ml +++ b/ocaml/xenops/domain.ml @@ -392,7 +392,7 @@ let build_pre ~xc ~xs ~vcpus ~xen_max_mi domid xen_max_mib shadow_mib required_host_free_mib; (* CA-39743: Wait, if necessary, for the Xen scrubber to catch up. *) - Memory.wait_xen_free_mem ~xc (Memory.kib_of_mib required_host_free_mib); + ignore(Memory.wait_xen_free_mem ~xc (Memory.kib_of_mib required_host_free_mib)); let shadow_mib = Int64.to_int shadow_mib in diff --git a/ocaml/xenops/squeeze.ml b/ocaml/xenops/squeeze.ml --- a/ocaml/xenops/squeeze.ml +++ b/ocaml/xenops/squeeze.ml @@ -373,7 +373,7 @@ module Squeezer = struct let max_target domain = domain.target_kib = domain.dynamic_max_kib in let cant_allocate_any_more = all max_target active_domains in - let cant_free_any_more = all min_target active_domains in + let _ (* cant_free_any_more *) = all min_target active_domains in (* Note the asymmetry between: 1. increasing free memory: if we think we can't free enough then we give up @@ -604,7 +604,7 @@ let is_host_memory_unbalanced ?fistpoint let debug_string, host = io.make_host () in let domains = List.map (fun d -> d.domid, d) host.domains in - let t = io.gettimeofday () in + let _ (* t *) = io.gettimeofday () in let _, _, _, result = Squeezer.one_iteration ?fistpoints false (is_balanced io) (Squeezer.make ()) host io.target_host_free_mem_kib (io.gettimeofday ()) in diff --git a/ocaml/xenops/squeeze_xen.ml b/ocaml/xenops/squeeze_xen.ml --- a/ocaml/xenops/squeeze_xen.ml +++ b/ocaml/xenops/squeeze_xen.ml @@ -227,7 +227,7 @@ let update_cooperative_flags cnx = let make_host ~verbose ~xc ~xs = (* Wait for any scrubbing so that we don't end up with no immediately usable pages -- this might cause something else to fail (eg domain builder?) *) - while Memory.get_scrub_memory_kib ~xc <> 0L do Unix.select [] [] [] 0.25 done; + while Memory.get_scrub_memory_kib ~xc <> 0L do ignore(Unix.select [] [] [] 0.25) done; (* Some VMs are considered by us (but not by xen) to have an "initial-reservation". For VMs which have never run (eg which are still being built or restored) we take the difference between memory_actual_kib and the diff --git a/ocaml/xenops/watch.ml b/ocaml/xenops/watch.ml --- a/ocaml/xenops/watch.ml +++ b/ocaml/xenops/watch.ml @@ -42,7 +42,7 @@ let wait_for ~xs ?(timeout=60. *. 20.) ( 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 --- 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 @@ -573,10 +572,10 @@ let domain_device_event ctx w v = match ev with | Rtc _ | IntMessage _ | BackThread _ | BackEject -> assert false | Backend state -> - let oldstate = devstate.backstate in + let _ (* oldstate *) = devstate.backstate in devstate.backstate <- state; | Frontend state -> - let oldstate = devstate.frontstate in + let _ (* oldstate *) = devstate.frontstate in devstate.frontstate <- state; | BackShutdown -> ctx.callback_devices ctx domid (DevShutdownDone (ty, devid))