Skip to content

Commit dd9c643

Browse files
author
Jon Ludlam
committed
Merge pull request #2598 from simonjbeaumont/ca-201117
CA-201117: quicktest: Use VDI.is_tools_iso instead of name_label
2 parents ce0c4d8 + b945109 commit dd9c643

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

ocaml/xapi/cancel_tests.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,19 @@ let _ =
411411
| [ v ] ->
412412
let net = Client.Network.get_by_name_label ~rpc ~session_id ~label:"Host internal management network" in
413413
if List.length net = 0 then failwith "Failed to find the host internal management network";
414-
let vdi = Client.VDI.get_by_name_label ~rpc ~session_id ~label:"xs-tools.iso" in
415-
if List.length vdi = 0 then failwith "Failed to find the xs-tools.iso";
414+
let vdi =
415+
let tools_iso_filter = "field \"is_tools_iso\"=\"true\"" in
416+
begin match Client.VDI.get_all_records_where !rpc session_id tools_iso_filter with
417+
| (vdi, _)::_ -> vdi
418+
| [] -> failwith "Failed to find the tools ISO";
419+
end
420+
in
416421
let env = {
417422
session_id = session_id;
418423
vm = v;
419424
id = Client.VM.get_uuid ~rpc ~session_id ~self:v;
420425
net = List.hd net;
421-
vdi = List.hd vdi;
426+
vdi;
422427
} in
423428
run env
424429
| _ ->

ocaml/xapi/quicktest.ml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,14 @@ let setup_export_test_vm session_id =
310310
debug test (Printf.sprintf "Template has uuid: %s%!" uuid);
311311
let vm = vm_install test session_id uuid "quicktest-export" in
312312
debug test (Printf.sprintf "Installed new VM");
313-
let cd = List.hd (Client.VDI.get_by_name_label !rpc session_id "xs-tools.iso") in
313+
let cd =
314+
let tools_iso_filter = "field \"is_tools_iso\"=\"true\"" in
315+
match Client.VDI.get_all_records_where !rpc session_id tools_iso_filter with
316+
| (vdi, _)::_ -> vdi
317+
| [] ->
318+
failed test "Failed to find tools ISO VDI";
319+
failwith "setup_export_test_vm";
320+
in
314321
debug test "Looking for the SR which supports the smallest disk size";
315322
let all_srs = all_srs_with_vdi_create session_id in
316323
let smallest : int64 option list = List.map (fun sr -> Quicktest_storage.find_smallest_disk_size session_id sr) all_srs in
@@ -320,12 +327,13 @@ let setup_export_test_vm session_id =
320327
| sr, None -> debug test (Printf.sprintf "SR %s has no minimum disk size!" sr)
321328
) (List.combine sr_names smallest);
322329
let minimum = List.fold_left min (1L ** gib) (List.map (fun x -> Opt.default (1L ** gib) x) smallest) in
323-
let possible_srs = List.filter (fun (sr, size) -> size = Some minimum) (List.combine all_srs smallest) in
324-
if List.length possible_srs = 0 then begin
325-
failed test "Failed to find an SR which can create a VDI";
326-
failwith "setup_export_test_vm";
327-
end;
328-
let sr = fst (List.hd possible_srs) in
330+
let sr =
331+
match List.filter (fun (_, size) -> size = Some minimum) (List.combine all_srs smallest) with
332+
| (sr, _)::_ -> sr
333+
| [] ->
334+
failed test "Failed to find an SR which can create a VDI";
335+
failwith "setup_export_test_vm";
336+
in
329337
debug test (Printf.sprintf "Using a disk size of: %Ld on SR: %s" minimum (Quicktest_storage.name_of_sr session_id sr));
330338
let vdi = Client.VDI.create !rpc session_id "small"
331339
"description" sr 4194304L `user false false [] [] [] [] in

ocaml/xe-cli/rt/tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ let cd_guest_verified (cli : Util.t_cli) vmid =
233233
log Info "Test: VM NAME='%s'" domainname;
234234
log Info "Test: Testing CD operations";
235235
ensure_vm_down cli vmid 0;
236-
let cd1 = ("xs-tools.iso",get_vdi_uuid_from_name cli "xs-tools.iso","2","xenlegacy.exe") in
237-
let cd2 = ("xs-tools.iso",get_vdi_uuid_from_name cli "xs-tools.iso","3","xenlegacy.exe") in
236+
let cd1 = ("guest-tools.iso",get_vdi_uuid_from_name cli "guest-tools.iso","2","xenlegacy.exe") in
237+
let cd2 = ("guest-tools.iso",get_vdi_uuid_from_name cli "guest-tools.iso","3","xenlegacy.exe") in
238238

239239
let checkcdset cdset =
240240
let missingcds = List.filter (fun (name,uuid,device,file) -> uuid="") cdset in

scripts/scalability-tests/provision-vm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if [ $# -le 1 ]; then
1111
echo "Usage: ${0} vm_per_host host1 [host2 ... hostN]"
1212
echo "${0} provisions <vm_per_host> debiant-etch VMs on each host and installs them on a local VHD disk. Moreover, all the hosts join a common pool."
13-
echo "if PROVISION_VM_WITH_CD is set to 1, then attach xs-tools.iso CD-ROM to the initial Debian Etch VM before cloning it."
13+
echo "if PROVISION_VM_WITH_CD is set to 1, then attach guest tools ISO CD-ROM to the initial Debian Etch VM before cloning it."
1414
exit 1
1515
fi
1616

@@ -68,9 +68,10 @@ install () {
6868
echo "[${HOST}] Set."
6969

7070
if [ "${PROVISION_VM_WITH_CD}" == "1" ]; then
71-
echo "[${HOST}] Attaching a CD-ROM."
72-
${XE} vm-cd-add vm=${DEB} cd-name=xs-tools.iso device=3
73-
echo "[${HOST}] Attached."
71+
echo "[${HOST}] Attaching a CD-ROM."
72+
TOOLS_ISO=`${XE} vdi-list is-tools-iso=ture params=name-label --minimal`
73+
${XE} vm-cd-add vm=${DEB} cd-name=${TOOLS_ISO} device=3
74+
echo "[${HOST}] Attached."
7475
fi
7576

7677
}

0 commit comments

Comments
 (0)