2
* Copyright (C) 2006-2009 Citrix Systems Inc.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation; version 2.1 only. with the special
7
* exception on linking described in file LICENSE.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License for more details.
14
(* Path fail-over time on FC multipath *)
22
let max_failover_time = 50. (* seconds *)
24
let run_fc rpc session =
27
let master = get_master rpc session in
28
if not(is_multipathing_enabled rpc session master) then enable_multipathing rpc session master;
30
let sr = get_fc_sr rpc session in
31
debug "Found FibreChannel SR: %s" (Ref.string_of sr);
32
let scsiid = get_fc_scsiid rpc session sr in
33
debug "SCSIid is %s" scsiid;
35
let num_paths = get_num_paths rpc session sr scsiid in
36
debug "PBD.other-config indicates that there is a maximum of %d paths to this SR" num_paths;
38
debug "Creating VDI in FibreChannel SR...";
39
let vdi = create_test_vdi rpc session sr in
42
debug "Attaching VDI to dom0...";
43
let vbd = plug_vdi_to_dom0 rpc session vdi in
45
let time1 = time_data_transfer rpc session master vbd in
46
debug " ** Duration of dd (with %d of %d paths) was %f seconds **" num_paths num_paths time1;
50
modify_fc_paths_manual rpc session master true;
54
let time2 = time_data_transfer rpc session master vbd in
55
debug " ** Duration of dd (with 1 of %d paths) was %f seconds **" num_paths time2;
56
let failover_time = time2 -. time1 in
57
debug "So failover time was about %.1f seconds" failover_time;
58
if failover_time > max_failover_time then failwith (Printf.sprintf "It took too long to failover between paths. It took %.1f secs, tolerance is %.1f secs" failover_time max_failover_time)
61
debug "Reinstating removed paths...";
62
modify_fc_paths_manual rpc session master false
66
debug "Unplugging VBD...";
67
Client.VBD.unplug ~rpc ~session_id:session ~self:vbd
71
debug "Removing test VDI...";
72
Client.VDI.destroy ~rpc ~session_id:session ~self:vdi