(* 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 =
| "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"
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
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";
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"
open Threadext
open Pervasiveext
+open Listext
open Stringext
open Server_helpers
open Client
(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)
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
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
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;
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
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