Remove upstream patches.
This commit is contained in:
parent
43d7bb7114
commit
8e8b81878f
@ -1,99 +0,0 @@
|
|||||||
From 5ac87b975fef867663402743d79e1b693d485bb8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
||||||
Date: Fri, 20 Mar 2015 12:14:42 +0000
|
|
||||||
Subject: [PATCH] v2v: test-harness: Add support for OVA.
|
|
||||||
|
|
||||||
This makes VMware testing easier, since it means you don't need to
|
|
||||||
test against a live server.
|
|
||||||
---
|
|
||||||
v2v/test-harness/v2v_test_harness.ml | 62 ++++++++++++++++++++++--------------
|
|
||||||
1 file changed, 38 insertions(+), 24 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
index fe09d6f..67a49d8 100644
|
|
||||||
--- a/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
+++ b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
@@ -62,10 +62,6 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
|
|
||||||
match input_disk with
|
|
||||||
| None -> test ^ ".img.xz"
|
|
||||||
| Some input_disk -> input_disk in
|
|
||||||
- let input_xml =
|
|
||||||
- match input_xml with
|
|
||||||
- | None -> test ^ ".xml"
|
|
||||||
- | Some input_xml -> input_xml in
|
|
||||||
|
|
||||||
let inspect_and_mount_disk filename =
|
|
||||||
let g = new G.guestfs () in
|
|
||||||
@@ -332,31 +328,49 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
|
|
||||||
|
|
||||||
printf "v2v_test_harness: starting test: %s\n%!" test;
|
|
||||||
|
|
||||||
- (* Check we are started in the correct directory, ie. the input_disk
|
|
||||||
- * and input_xml files should exist, and they should be local files.
|
|
||||||
+ (* Check we are started in the correct directory.
|
|
||||||
*)
|
|
||||||
- if not (Sys.file_exists input_disk) || not (Sys.file_exists input_xml) then
|
|
||||||
- failwithf "cannot find input files: %s, %s: you are probably running the test script from the wrong directory" input_disk input_xml;
|
|
||||||
+ if not (Sys.file_exists input_disk) then
|
|
||||||
+ failwith "cannot find input files: you are probably running the test script from the wrong directory";
|
|
||||||
|
|
||||||
- (* Uncompress the input, if it doesn't exist already. *)
|
|
||||||
- let input_disk =
|
|
||||||
- if Filename.check_suffix input_disk ".xz" then (
|
|
||||||
- let input_disk_uncomp = Filename.chop_suffix input_disk ".xz" in
|
|
||||||
- if not (Sys.file_exists input_disk_uncomp) then (
|
|
||||||
- let cmd = sprintf "unxz --keep %s" (quote input_disk) in
|
|
||||||
- printf "%s\n%!" cmd;
|
|
||||||
- if Sys.command cmd <> 0 then
|
|
||||||
- failwith "unxz command failed"
|
|
||||||
- );
|
|
||||||
- input_disk_uncomp
|
|
||||||
+ (* How we run virt-v2v depends on the extension of the input_disk. *)
|
|
||||||
+ let v2v_method =
|
|
||||||
+ (* Uncompress the input, if the uncompressed file doesn't exist already. *)
|
|
||||||
+ let input_disk =
|
|
||||||
+ if Filename.check_suffix input_disk ".xz" then (
|
|
||||||
+ let input_disk_uncomp = Filename.chop_suffix input_disk ".xz" in
|
|
||||||
+ if not (Sys.file_exists input_disk_uncomp) then (
|
|
||||||
+ let cmd = sprintf "unxz --keep %s" (quote input_disk) in
|
|
||||||
+ printf "%s\n%!" cmd;
|
|
||||||
+ if Sys.command cmd <> 0 then
|
|
||||||
+ failwith "unxz command failed"
|
|
||||||
+ );
|
|
||||||
+ input_disk_uncomp
|
|
||||||
+ )
|
|
||||||
+ else input_disk in
|
|
||||||
+
|
|
||||||
+ if Filename.check_suffix input_disk ".img" then (
|
|
||||||
+ let input_xml =
|
|
||||||
+ match input_xml with
|
|
||||||
+ | None -> test ^ ".xml"
|
|
||||||
+ | Some input_xml -> input_xml in
|
|
||||||
+ `V2v_method_libvirtxml input_xml
|
|
||||||
)
|
|
||||||
- else input_disk in
|
|
||||||
- ignore input_disk;
|
|
||||||
+ else if Filename.check_suffix input_disk ".ova" then
|
|
||||||
+ `V2v_method_ova input_disk
|
|
||||||
+ else
|
|
||||||
+ failwithf "don't know what to do with input disk '%s'" input_disk in
|
|
||||||
|
|
||||||
(* Run virt-v2v. *)
|
|
||||||
- let cmd = sprintf
|
|
||||||
- "virt-v2v -i libvirtxml %s -o local -of qcow2 -os . -on %s"
|
|
||||||
- (quote input_xml) (quote (test ^ "-converted")) in
|
|
||||||
+ let cmd_input =
|
|
||||||
+ match v2v_method with
|
|
||||||
+ | `V2v_method_libvirtxml input_xml ->
|
|
||||||
+ sprintf "-i libvirtxml %s" (quote input_xml)
|
|
||||||
+ | `V2v_method_ova input_disk ->
|
|
||||||
+ sprintf "-i ova %s" (quote input_disk) in
|
|
||||||
+ let cmd =
|
|
||||||
+ sprintf "virt-v2v %s -o local -of qcow2 -os . -on %s"
|
|
||||||
+ cmd_input (quote (test ^ "-converted")) in
|
|
||||||
printf "%s\n%!" cmd;
|
|
||||||
if Sys.command cmd <> 0 then
|
|
||||||
failwith "virt-v2v command failed";
|
|
||||||
--
|
|
||||||
2.3.1
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
|||||||
From a3beda8b77363e13f652104b06efaee33ecfe67c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
||||||
Date: Wed, 11 Mar 2015 15:02:58 +0000
|
|
||||||
Subject: [PATCH 1/2] v2v: test-harness: Measure similarity between images when
|
|
||||||
comparing screenshots.
|
|
||||||
|
|
||||||
Since wallclock time differs between boots, we cannot just compare two
|
|
||||||
screenshots by checking if they are identical -- if the screenshot
|
|
||||||
contains any time information, then that will be different, and it
|
|
||||||
turns out that VMs print the current time at boot.
|
|
||||||
|
|
||||||
Therefore parse out and use the "similarity" metric printed by the
|
|
||||||
ImageMagick "compare" command when it compares the screenshots, and
|
|
||||||
allow a small epsilon for the case where a few oixels are different.
|
|
||||||
---
|
|
||||||
v2v/test-harness/v2v_test_harness.ml | 26 +++++++++++++++++++++-----
|
|
||||||
1 file changed, 21 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
index cd08cd0..998903a 100644
|
|
||||||
--- a/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
+++ b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
@@ -196,13 +196,29 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
|
|
||||||
|
|
||||||
let display_matches_screenshot screenshot1 screenshot2 =
|
|
||||||
let cmd =
|
|
||||||
- sprintf "compare -metric MAE %s %s null:"
|
|
||||||
+ (* Grrr compare sends its normal output to stderr. *)
|
|
||||||
+ sprintf "compare -metric MAE %s %s null: 2>&1"
|
|
||||||
(quote screenshot1) (quote screenshot2) in
|
|
||||||
printf "%s\n%!" cmd;
|
|
||||||
- let r = Sys.command cmd in
|
|
||||||
- if r < 0 || r > 1 then
|
|
||||||
- failwith "compare command failed";
|
|
||||||
- r = 0
|
|
||||||
+ let chan = Unix.open_process_in cmd in
|
|
||||||
+ let lines = ref [] in
|
|
||||||
+ (try while true do lines := input_line chan :: !lines done
|
|
||||||
+ with End_of_file -> ());
|
|
||||||
+ let lines = List.rev !lines in
|
|
||||||
+ let stat = Unix.close_process_in chan in
|
|
||||||
+ let similarity =
|
|
||||||
+ match stat with
|
|
||||||
+ | Unix.WEXITED 0 -> 0.0 (* exact match *)
|
|
||||||
+ | Unix.WEXITED 1 ->
|
|
||||||
+ Scanf.sscanf (List.hd lines) "%f" (fun f -> f)
|
|
||||||
+ | Unix.WEXITED i ->
|
|
||||||
+ failwithf "external command '%s' exited with error %d" cmd i
|
|
||||||
+ | Unix.WSIGNALED i ->
|
|
||||||
+ failwithf "external command '%s' killed by signal %d" cmd i
|
|
||||||
+ | Unix.WSTOPPED i ->
|
|
||||||
+ failwithf "external command '%s' stopped by signal %d" cmd i in
|
|
||||||
+ printf "%s %s have similarity %f\n" screenshot1 screenshot2 similarity;
|
|
||||||
+ similarity <= 60.0
|
|
||||||
in
|
|
||||||
|
|
||||||
let dom_is_alive () =
|
|
||||||
--
|
|
||||||
2.3.1
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
|||||||
From 0827b006e4943a670dbe193dd8b522d7cc3b4bf5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
||||||
Date: Wed, 11 Mar 2015 15:05:13 +0000
|
|
||||||
Subject: [PATCH 2/2] v2v: test-harness: Fix boot loop so it detects disk
|
|
||||||
inactivity properly.
|
|
||||||
|
|
||||||
---
|
|
||||||
v2v/test-harness/v2v_test_harness.ml | 50 +++++++++++++++++++-----------------
|
|
||||||
1 file changed, 27 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
index 998903a..fe09d6f 100644
|
|
||||||
--- a/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
+++ b/v2v/test-harness/v2v_test_harness.ml
|
|
||||||
@@ -280,30 +280,34 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
|
|
||||||
if active then (
|
|
||||||
printf "%s: disk activity detected\n" (timestamp t);
|
|
||||||
loop start t stats
|
|
||||||
- ) else if t -. last_activity <= float test_plan.boot_idle_time then (
|
|
||||||
- let screenshot = take_screenshot t in
|
|
||||||
- (* Reached the final screenshot? *)
|
|
||||||
- let done_ =
|
|
||||||
- match test_plan.boot_plan with
|
|
||||||
- | Boot_to_screenshot final_screenshot ->
|
|
||||||
- if display_matches_screenshot screenshot final_screenshot then (
|
|
||||||
- printf "%s: guest reached final screenshot\n" (timestamp t);
|
|
||||||
- true
|
|
||||||
- ) else false
|
|
||||||
- | _ -> false in
|
|
||||||
- if not done_ then (
|
|
||||||
- (* A screenshot matching one of the screenshots in the set
|
|
||||||
- * resets the timeout.
|
|
||||||
- *)
|
|
||||||
- let waiting_in_known_good_state =
|
|
||||||
- List.exists (display_matches_screenshot screenshot)
|
|
||||||
- test_plan.boot_known_good_screenshots in
|
|
||||||
- if waiting_in_known_good_state then (
|
|
||||||
- printf "%s: guest at known-good screenshot\n" (timestamp t);
|
|
||||||
- loop t last_activity stats
|
|
||||||
- ) else
|
|
||||||
- loop start last_activity stats
|
|
||||||
+ ) else (
|
|
||||||
+ if t -. last_activity <= float test_plan.boot_idle_time then (
|
|
||||||
+ let screenshot = take_screenshot t in
|
|
||||||
+ (* Reached the final screenshot? *)
|
|
||||||
+ let done_ =
|
|
||||||
+ match test_plan.boot_plan with
|
|
||||||
+ | Boot_to_screenshot final_screenshot ->
|
|
||||||
+ if display_matches_screenshot screenshot final_screenshot then (
|
|
||||||
+ printf "%s: guest reached final screenshot\n" (timestamp t);
|
|
||||||
+ true
|
|
||||||
+ ) else false
|
|
||||||
+ | _ -> false in
|
|
||||||
+ if not done_ then (
|
|
||||||
+ (* A screenshot matching one of the screenshots in the set
|
|
||||||
+ * resets the timeouts.
|
|
||||||
+ *)
|
|
||||||
+ let waiting_in_known_good_state =
|
|
||||||
+ List.exists (display_matches_screenshot screenshot)
|
|
||||||
+ test_plan.boot_known_good_screenshots in
|
|
||||||
+ if waiting_in_known_good_state then (
|
|
||||||
+ printf "%s: guest at known-good screenshot\n" (timestamp t);
|
|
||||||
+ loop t t stats
|
|
||||||
+ ) else
|
|
||||||
+ loop start last_activity stats
|
|
||||||
+ )
|
|
||||||
)
|
|
||||||
+ else
|
|
||||||
+ bootfail t "guest timed out with no disk activity before reaching final state"
|
|
||||||
)
|
|
||||||
in
|
|
||||||
loop start last_activity stats;
|
|
||||||
--
|
|
||||||
2.3.1
|
|
||||||
|
|
@ -25,18 +25,13 @@ Summary: Access and modify virtual machine disk images
|
|||||||
Name: libguestfs
|
Name: libguestfs
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 1.29.31
|
Version: 1.29.31
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
|
|
||||||
# Source and patches.
|
# Source and patches.
|
||||||
URL: http://libguestfs.org/
|
URL: http://libguestfs.org/
|
||||||
Source0: http://libguestfs.org/download/1.29-development/%{name}-%{version}.tar.gz
|
Source0: http://libguestfs.org/download/1.29-development/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
# Upstream patches to add/fix the virt-v2v test harness.
|
|
||||||
Patch1: 0001-v2v-test-harness-Measure-similarity-between-images-w.patch
|
|
||||||
Patch2: 0002-v2v-test-harness-Fix-boot-loop-so-it-detects-disk-in.patch
|
|
||||||
Patch3: 0001-v2v-test-harness-Add-support-for-OVA.patch
|
|
||||||
|
|
||||||
# Basic build requirements:
|
# Basic build requirements:
|
||||||
BuildRequires: perl(Pod::Simple)
|
BuildRequires: perl(Pod::Simple)
|
||||||
BuildRequires: perl(Pod::Man)
|
BuildRequires: perl(Pod::Man)
|
||||||
@ -808,9 +803,7 @@ for %{name}.
|
|||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
# Apply patches, if any, here.
|
# Apply patches, if any, here.
|
||||||
%patch1 -p1
|
# (no patches)
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
|
|
||||||
# For Python 3 we must build libguestfs twice. This creates:
|
# For Python 3 we must build libguestfs twice. This creates:
|
||||||
# %{name}-%{version}/
|
# %{name}-%{version}/
|
||||||
@ -1373,8 +1366,9 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Mar 24 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.31-1
|
* Tue Mar 24 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.31-2
|
||||||
- New upstream version 1.29.31.
|
- New upstream version 1.29.31.
|
||||||
|
- Remove upstream patches.
|
||||||
|
|
||||||
* Fri Mar 20 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.30-5
|
* Fri Mar 20 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.30-5
|
||||||
- More upstream patches to fix virt-v2v test harness.
|
- More upstream patches to fix virt-v2v test harness.
|
||||||
|
Loading…
Reference in New Issue
Block a user