[PATCH] p2v: require a non-interative sudo (RHBZ#1340809)
by Pino Toscano
Run sudo with -n (non-interactive), so it will fail right away when not
configured to not require a password. This will avoid the connection to
time out.
---
p2v/ssh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/p2v/ssh.c b/p2v/ssh.c
index b432cbd..c6bf306 100644
--- a/p2v/ssh.c
+++ b/p2v/ssh.c
@@ -490,7 +490,7 @@ test_connection (struct config *config)
*/
if (mexp_printf (h,
"%svirt-v2v --version\n",
- config->sudo ? "sudo " : "") == -1) {
+ config->sudo ? "sudo -n " : "") == -1) {
set_ssh_error ("mexp_printf: %m");
mexp_close (h);
return -1;
--
2.5.5
8 years, 6 months
[PATCH v3] p2v: Allow virt-p2v to be built with Gtk 2 or 3.
by Richard W.M. Jones
This version of the Gtk 2/3 patch gets alignment and padding mostly
right. I still can't work out how to vertically align labels in the
middle of a cell in a GtkGrid. The GtkTextView in the final dialog is
still broken.
Rich.
8 years, 6 months
[PATCH v2 0/3] p2v: Allow virt-p2v to be built with Gtk 2 or 3.
by Richard W.M. Jones
This is basically the same as what I posted earlier today. The main
difference is I split out the GDK thread sychronization (removal of)
changes from the other Gtk 2/3 changes, which should make it a bit
easier to review.
Gtk 3 is still not quite perfect. Apart from the problem with the
GtkTextView noted before, there are also vertical alignment and
padding problems with labels in GtkGrid widgets.
Rich.
8 years, 6 months
[PATCH 0/2] p2v: Allow virt-p2v to be built with Gtk 2 or 3.
by Richard W.M. Jones
... and a small initial patch which makes it easier to test virt-p2v
without having to start up a virtual machine.
There is still a bug in Gtk 3 where the GtkTextView on the final
(running) dialog ignores gtk_widget_set_size_request and so the window
appears just a single pixel high.
Rich.
8 years, 6 months
Re: [Libguestfs] supermin init segfaults when kernel has large modules
by Richard W.M. Jones
Continuing the discussion from:
https://bugzilla.redhat.com/show_bug.cgi?id=1339691#c17
[Luiz: There's no need to subscribe to the mailing list, once I've
moderated your first message the others will go through.]
> IMO, supermin should use the kernel the host is running as a hint and
> try that one first. This shouldn't be hard to do.
>
> This BZ should be enough evidence that picking up the highest numbered
> kernel is not a good design decision. My kernel was a test kernel with
> custom patches, I was just lucky it didn't blow at boot.
What we really want is to pick a kernel that will definitely boot on
qemu. It's not clear this is always going to be either the highest
numbered kernel (for reasons you outline) nor the running kernel
(because the host kernel may not include virtio drivers - a problem on
Ubuntu sometimes because it has special virt kernels).
This is a tough problem, but we could do better than we are doing now.
For example we could check the kernels to ensure they have virtio and
the other devices we need enabled (eg. using /boot/config-*) and
discard any kernels from the list which do not.
We might also consider excluding kernels based on a blacklist of
version numbers, since kernels are sometimes released which simply
don't boot on qemu.
The current code has been picking the highest numbered non-Xen kernel
for the last 7 years, and while it generally works fine it does
occasionally cause trouble like this.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
8 years, 6 months
[PATCH] lib: qemu: use guestfs_int_version_from_x_y for qemu version parsing
by Pino Toscano
Make use of the common version code, and avoid a separate regexp.
---
src/qemu.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/src/qemu.c b/src/qemu.c
index 11bf5cf..844c3f0 100644
--- a/src/qemu.c
+++ b/src/qemu.c
@@ -37,16 +37,12 @@
#include <libxml/uri.h>
-#include <pcre.h>
-
#include "ignore-value.h"
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs_protocol.h"
-COMPILE_REGEXP (re_major_minor, "(\\d+)\\.(\\d+)", 0)
-
struct qemu_data {
char *qemu_help; /* Output of qemu -help. */
char *qemu_devices; /* Output of qemu -device ? */
@@ -265,29 +261,15 @@ static void
parse_qemu_version (guestfs_h *g, const char *qemu_help,
struct version *qemu_version)
{
- CLEANUP_FREE char *major_s = NULL, *minor_s = NULL;
- int major_i, minor_i;
-
version_init_null (qemu_version);
- if (!match2 (g, qemu_help, re_major_minor, &major_s, &minor_s)) {
- parse_failed:
+ if (guestfs_int_version_from_x_y (g, qemu_version, qemu_help) < 1) {
debug (g, "%s: failed to parse qemu version string from the first line of the output of '%s -help'. When reporting this bug please include the -help output.",
__func__, g->hv);
return;
}
- major_i = guestfs_int_parse_unsigned_int (g, major_s);
- if (major_i == -1)
- goto parse_failed;
-
- minor_i = guestfs_int_parse_unsigned_int (g, minor_s);
- if (minor_i == -1)
- goto parse_failed;
-
- guestfs_int_version_from_values (qemu_version, major_i, minor_i, 0);
-
- debug (g, "qemu version %d.%d", major_i, minor_i);
+ debug (g, "qemu version %d.%d", qemu_version->v_major, qemu_version->v_minor);
}
static void
--
2.5.5
8 years, 7 months
[PATCH] osinfo: use guestfs_int_version_from_x_y to parse the os version
by Pino Toscano
Make use of the common version code, and avoid a separate regexp.
---
src/osinfo.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/osinfo.c b/src/osinfo.c
index 4a4cbfc..f4e2c71 100644
--- a/src/osinfo.c
+++ b/src/osinfo.c
@@ -65,8 +65,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
-COMPILE_REGEXP (re_major_minor, "(\\d+)\\.(\\d+)", 0)
-
gl_lock_define_initialized (static, osinfo_db_lock);
static ssize_t osinfo_db_size = 0; /* 0 = unread, -1 = error, >= 1 = #records */
static struct osinfo *osinfo_db = NULL;
@@ -436,17 +434,16 @@ static int
parse_version (guestfs_h *g, xmlNodePtr node, struct osinfo *osinfo)
{
CLEANUP_FREE char *content = NULL;
- CLEANUP_FREE char *major = NULL, *minor = NULL;
content = (char *) xmlNodeGetContent (node);
if (content) {
- if (match2 (g, content, re_major_minor, &major, &minor)) {
- osinfo->major_version = guestfs_int_parse_unsigned_int (g, major);
- if (osinfo->major_version == -1)
- return -1;
- osinfo->minor_version = guestfs_int_parse_unsigned_int (g, minor);
- if (osinfo->minor_version == -1)
- return -1;
+ struct version version;
+ int res = guestfs_int_version_from_x_y (g, &version, content);
+ if (res < 0)
+ return -1;
+ else if (res > 0) {
+ osinfo->major_version = version.v_major;
+ osinfo->minor_version = version.v_minor;
}
}
--
2.5.5
8 years, 7 months
[PATCH] aarch64: launch: Only pass gic-version=host when KVM is likely to be enabled.
by Richard W.M. Jones
See:
https://bugzilla.redhat.com/show_bug.cgi?id=1339977
---
src/launch-direct.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/launch-direct.c b/src/launch-direct.c
index 20f6471..6450d7e 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -382,9 +382,12 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
MACHINE_TYPE ","
#endif
#ifdef __aarch64__
- "gic-version=host,"
+ "%s" /* gic-version */
#endif
"accel=%s",
+#ifdef __aarch64__
+ has_kvm && !force_tcg ? "gic-version=host," : "",
+#endif
!force_tcg ? "kvm:tcg" : "tcg");
cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
--
2.7.4
8 years, 7 months
[PATCH] customize: random_seed: avoid one file checking for existing files
by Pino Toscano
When the random-seed file is found, then avoid checking its existance
again.
---
customize/random_seed.ml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/customize/random_seed.ml b/customize/random_seed.ml
index e4c955e..1633aed 100644
--- a/customize/random_seed.ml
+++ b/customize/random_seed.ml
@@ -35,7 +35,7 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
List.iter (
fun file ->
if g#is_file file then (
- make_random_seed_file g file;
+ make_random_seed_file g file ~exists:true;
created := true
)
) files;
@@ -71,8 +71,11 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
!created
-and make_random_seed_file g file =
- let file_exists = g#is_file file in
+and make_random_seed_file ?exists g file =
+ let file_exists =
+ match exists with
+ | None -> g#is_file file
+ | Some b -> b in
let n =
if file_exists then (
let n = Int64.to_int (g#filesize file) in
--
2.5.5
8 years, 7 months