|
|
e76f14 |
From 180a681da1f2ffa7be27a854b60a5c556288f567 Mon Sep 17 00:00:00 2001
|
|
|
e76f14 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
e76f14 |
Date: Sat, 2 Apr 2016 11:03:33 +0100
|
|
|
e76f14 |
Subject: [PATCH] tests/qemu: boot-analysis: Don't force backend direct.
|
|
|
e76f14 |
|
|
|
e76f14 |
Current libvirt overhead is 220ms. That didn't matter when our launch
|
|
|
e76f14 |
time was 4000ms. Now we're launching in 900ms, it really does.
|
|
|
e76f14 |
|
|
|
e76f14 |
(cherry picked from commit 03b68d436c61e9e0baac7c4fb305b62f41185173)
|
|
|
e76f14 |
---
|
|
|
e76f14 |
tests/qemu/boot-analysis-timeline.c | 65 ++++++++++++++++++++++++++++---------
|
|
|
e76f14 |
tests/qemu/boot-analysis.c | 11 ++-----
|
|
|
e76f14 |
2 files changed, 51 insertions(+), 25 deletions(-)
|
|
|
e76f14 |
|
|
|
e76f14 |
diff --git a/tests/qemu/boot-analysis-timeline.c b/tests/qemu/boot-analysis-timeline.c
|
|
|
e76f14 |
index 8753805..d35fb49 100644
|
|
|
e76f14 |
--- a/tests/qemu/boot-analysis-timeline.c
|
|
|
e76f14 |
+++ b/tests/qemu/boot-analysis-timeline.c
|
|
|
e76f14 |
@@ -176,28 +176,61 @@ construct_timeline (void)
|
|
|
e76f14 |
"finished building supermin appliance"));
|
|
|
e76f14 |
|
|
|
e76f14 |
/* Find where we invoke qemu to test features. */
|
|
|
e76f14 |
- FIND ("qemu:feature-detect", 0,
|
|
|
e76f14 |
- data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
- strstr (data->events[j].message,
|
|
|
e76f14 |
- "begin testing qemu features"),
|
|
|
e76f14 |
- data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
- strstr (data->events[k].message,
|
|
|
e76f14 |
- "finished testing qemu features"));
|
|
|
e76f14 |
+ FIND_OPTIONAL ("qemu:feature-detect", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message,
|
|
|
e76f14 |
+ "begin testing qemu features"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[k].message,
|
|
|
e76f14 |
+ "finished testing qemu features"));
|
|
|
e76f14 |
|
|
|
e76f14 |
/* Find where we run qemu. */
|
|
|
e76f14 |
- FIND ("qemu", LONG_ACTIVITY,
|
|
|
e76f14 |
- data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
- strstr (data->events[j].message, "-nodefconfig"),
|
|
|
e76f14 |
- data->events[k].source == GUESTFS_EVENT_CLOSE);
|
|
|
e76f14 |
+ FIND_OPTIONAL ("qemu", LONG_ACTIVITY,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "-nodefconfig"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_CLOSE);
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+ /* For the libvirt backend, connecting to libvirt, getting
|
|
|
e76f14 |
+ * capabilities, parsing capabilities etc.
|
|
|
e76f14 |
+ */
|
|
|
e76f14 |
+ FIND_OPTIONAL ("libvirt:connect", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "connect to libvirt"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, "successfully opened libvirt handle"));
|
|
|
e76f14 |
+ FIND_OPTIONAL ("libvirt:get-libvirt-capabilities", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "get libvirt capabilities"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, "parsing capabilities XML"));
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+ FIND_OPTIONAL ("libguestfs:parse-libvirt-capabilities", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "parsing capabilities XML"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, "get_backend_setting"));
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+ FIND_OPTIONAL ("libguestfs:create-libvirt-xml", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "create libvirt XML"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, "libvirt XML:"));
|
|
|
e76f14 |
|
|
|
e76f14 |
#define SGABIOS_STRING "\033[1;256r\033[256;256H\033[6n"
|
|
|
e76f14 |
|
|
|
e76f14 |
+ /* For the libvirt backend, find the overhead of libvirt. */
|
|
|
e76f14 |
+ FIND_OPTIONAL ("libvirt:overhead", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_LIBRARY &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "launch libvirt guest"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, SGABIOS_STRING));
|
|
|
e76f14 |
+
|
|
|
e76f14 |
/* From starting qemu up to entering the BIOS is the qemu overhead. */
|
|
|
e76f14 |
- FIND ("qemu:overhead", 0,
|
|
|
e76f14 |
- data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
- strstr (data->events[j].message, "-nodefconfig"),
|
|
|
e76f14 |
- data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
- strstr (data->events[k].message, SGABIOS_STRING));
|
|
|
e76f14 |
+ FIND_OPTIONAL ("qemu:overhead", 0,
|
|
|
e76f14 |
+ data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
+ strstr (data->events[j].message, "-nodefconfig"),
|
|
|
e76f14 |
+ data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
|
|
|
e76f14 |
+ strstr (data->events[k].message, SGABIOS_STRING));
|
|
|
e76f14 |
|
|
|
e76f14 |
/* From entering the BIOS to starting the kernel is the BIOS overhead. */
|
|
|
e76f14 |
FIND_OPTIONAL ("bios:overhead", 0,
|
|
|
e76f14 |
diff --git a/tests/qemu/boot-analysis.c b/tests/qemu/boot-analysis.c
|
|
|
e76f14 |
index f4c1d6c..37d8b3c 100644
|
|
|
e76f14 |
--- a/tests/qemu/boot-analysis.c
|
|
|
e76f14 |
+++ b/tests/qemu/boot-analysis.c
|
|
|
e76f14 |
@@ -292,14 +292,6 @@ create_handle (void)
|
|
|
e76f14 |
g = guestfs_create ();
|
|
|
e76f14 |
if (!g) error (EXIT_FAILURE, errno, "guestfs_create");
|
|
|
e76f14 |
|
|
|
e76f14 |
- /* We always run these tests using LIBGUESTFS_BACKEND=direct. It
|
|
|
e76f14 |
- * may be in future we need to test libvirt as well, in case
|
|
|
e76f14 |
- * performance issues are suspected there, but so far libvirt has
|
|
|
e76f14 |
- * not been a bottleneck.
|
|
|
e76f14 |
- */
|
|
|
e76f14 |
- if (guestfs_set_backend (g, "direct") == -1)
|
|
|
e76f14 |
- exit (EXIT_FAILURE);
|
|
|
e76f14 |
-
|
|
|
e76f14 |
if (memsize != 0)
|
|
|
e76f14 |
if (guestfs_set_memsize (g, memsize) == -1)
|
|
|
e76f14 |
exit (EXIT_FAILURE);
|
|
|
e76f14 |
@@ -622,7 +614,8 @@ check_pass_data (void)
|
|
|
e76f14 |
assert (pass_data[i].events[j].source != 0);
|
|
|
e76f14 |
message = pass_data[i].events[j].message;
|
|
|
e76f14 |
assert (message != NULL);
|
|
|
e76f14 |
- assert (strchr (message, '\n') == NULL);
|
|
|
e76f14 |
+ assert (pass_data[i].events[j].source != GUESTFS_EVENT_APPLIANCE ||
|
|
|
e76f14 |
+ strchr (message, '\n') == NULL);
|
|
|
e76f14 |
len = strlen (message);
|
|
|
e76f14 |
assert (len == 0 || message[len-1] != '\r');
|
|
|
e76f14 |
}
|
|
|
e76f14 |
--
|
|
|
7af31e |
1.8.3.1
|
|
|
e76f14 |
|