how to clear <defunct> qemu-system-x86 processes
by cyliu7
Hi all,
I have a long term running program which call libguestfs to check VM
images. but i found that each time after i call guestfs_close(), the
qeum-system-x86 process which is forked by libguestfs changes to
<defunct> process.
as docs of guestfs_close said "This closes the connection handle and
frees up all resources used.", so this is a bug or is there any other
way to clear them.
thanks a lot!
------------------------
Chunyang Liu
15 years, 3 months
[PATCH virt-v2v] make most of "make distcheck" pass
by Jim Meyering
Hi Matt,
You need to "git add" Makefile.PL.in to the repo.
Once you do that, and apply the following patch,
most of "make distcheck" will work.
The only remaining failure seems to be that these
files are not removed by "make uninstall":
ERROR: files left after uninstall:
./lib64/perl5/5.10.0/x86_64-linux-thread-multi/perllocal.pod
./lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/auto/virtv2v/.packlist
which I haven't investigated yet.
>From 7d8369f1191e5c9ef3a7f3c977eb25e046c2ad1a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 20 Aug 2009 17:01:08 +0200
Subject: [PATCH] make most of "make distcheck" pass
---
configure.ac | 1 +
v2v/Makefile.am | 6 +++++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index aa5c665..3e057d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,7 @@ fi
AC_CONFIG_FILES([Makefile
perl/Makefile
+ perl/Makefile.PL
v2v/Makefile
po/Makefile.in])
AC_OUTPUT
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 65ac778..49dac50 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -41,4 +41,8 @@ virt-v2v.1: virt-v2v.pl
install-data-hook:
mkdir -p $(DESTDIR)$(bindir)
- install -m 0755 virt-v2v.pl $(DESTDIR)$(bindir)/virt-v2v
+ install -m 0755 $(srcdir)/virt-v2v.pl $(DESTDIR)$(bindir)/virt-v2v
+
+uninstall-hook:
+ rm -f $(DESTDIR)$(bindir)/virt-v2v
+ -rmdir $(DESTDIR)$(bindir)
--
1.6.4.378.g88f2f
15 years, 3 months
[PATCH libguestfs] daemon: diagnose socket write failure
by Jim Meyering
On principle, we shouldn't ignore write failure:
>From 56317a61bc22e935dc750cf669a164bacc12cf12 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 20 Aug 2009 12:29:46 +0200
Subject: [PATCH libguestfs] daemon: diagnose socket write failure
* daemon/proto.c (send_chunk): Don't ignore socket-write error.
---
daemon/proto.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/daemon/proto.c b/daemon/proto.c
index 9b33902..c2dd50c 100644
--- a/daemon/proto.c
+++ b/daemon/proto.c
@@ -495,8 +495,10 @@ send_chunk (const guestfs_chunk *chunk)
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
- (void) xwrite (sock, lenbuf, 4);
- (void) xwrite (sock, buf, len);
+ int err = (xwrite (sock, lenbuf, 4) == 0
+ && xwrite (sock, buf, len) == 0 ? 0 : -1);
+ if (err)
+ fprintf (stderr, "send_chunk: write failed\n");
- return 0;
+ return err;
}
--
1.6.4.378.g88f2f
15 years, 3 months
[PATCH] Export inspect_linux_kernel in Lib.pm
by Matthew Booth
---
perl/lib/Sys/Guestfs/Lib.pm | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 1f84bc6..dfa79af 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -66,7 +66,8 @@ use vars qw(@EXPORT_OK @ISA);
@ISA = qw(Exporter);
@EXPORT_OK = qw(open_guest get_partitions resolve_windows_path
inspect_all_partitions inspect_partition
- inspect_operating_systems mount_operating_system inspect_in_detail);
+ inspect_operating_systems mount_operating_system inspect_in_detail
+ inspect_linux_kernel);
=head2 open_guest
@@ -1551,10 +1552,19 @@ sub _check_for_kernels
}
$config{cmdline} = join(' ', @args) if(scalar(@args) > 0);
- my $kernel = _inspect_linux_kernel($g, $os, "$path");
+ my $kernel =
+ inspect_linux_kernel($g, $path, $os->{package_format});
# Check the kernel was recognised
if(defined($kernel)) {
+ # Put this kernel on the top level kernel list
+ my $kernels = $os->{kernels};
+ if(!defined($kernels)) {
+ $kernels = [];
+ $os->{kernels} = $kernels;
+ }
+ push(@$kernels, $kernel);
+
$config{kernel} = $kernel;
# Look for an initrd entry
@@ -1599,9 +1609,19 @@ sub _check_for_kernels
}
}
-sub _inspect_linux_kernel
+=head2 inspect_linux_kernel
+
+ my $kernel_hash = inspect_linux_kernel($g, $vmlinuz_path, $package_format);
+
+inspect_linux_kernel returns a hash describing the target linux kernel. For the
+contents of the hash, see the I<kernels> structure described under
+L</inspect_in_detail>.
+
+=cut
+
+sub inspect_linux_kernel
{
- my ($g, $os, $path) = @_;
+ my ($g, $path, $package_format) = @_;
my %kernel = ();
@@ -1610,7 +1630,7 @@ sub _inspect_linux_kernel
# If this is a packaged kernel, try to work out the name of the package
# which installed it. This lets us know what to install to replace it with,
# e.g. kernel, kernel-smp, kernel-hugemem, kernel-PAE
- if($os->{package_format} eq "rpm") {
+ if($package_format eq "rpm") {
my $package;
eval { $package = $g->command(['rpm', '-qf', '--qf',
'%{NAME}', $path]); };
@@ -1667,14 +1687,6 @@ sub _inspect_linux_kernel
# of any kernel module.
$kernel{arch} = file_architecture ($g, $any_module);
- # Put this kernel on the top level kernel list
- my $kernels = $os->{kernels};
- if(!defined($kernels)) {
- $kernels = [];
- $os->{kernels} = $kernels;
- }
- push(@$kernels, \%kernel);
-
return \%kernel;
}
--
1.6.2.5
15 years, 3 months
[PATCH libguestfs] avoid build failure due to Haskell keyword clash
by Jim Meyering
I got this build failure:
Guestfs.hs:1941:11: parse error on input `module'
where that (generated) file looked like this:
1940 modprobe :: GuestfsH -> String -> IO ()
1941 modprobe h module = do
1942 r <- withCString module $ \module -> withForeignPtr h (\p -> c_modprobe p module)
1943 if (r == -1)
1944 then do
1945 err <- last_error h
1946 fail err
1947 else return ()
That's because "module" is a reserved word in Haskell.
The following adds a list of nearly all Haskell, OCaml and C
reserved words, and ensures that we don't use them as parameter
or return value names when generating code.
>From 9c799cb1a58b46b7d01f3d4862d1b37b8bcf65c1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 19 Aug 2009 14:30:02 +0200
Subject: [PATCH libguestfs] avoid build failure due to Haskell keyword clash
* src/generator.ml: Fix this particular problem by
renaming the "module" parameter to "modulename".
Avoid the general problem by ensuring that no parameter name is
in the set of nearly all Haskell, OCaml and C reserved words.
(zfile): Adjust one more offender: s/method/meth/.
---
src/generator.ml | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/generator.ml b/src/generator.ml
index 230be80..cd19f12 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -2968,7 +2968,7 @@ were rarely if ever used anyway.
See also C<guestfs_sfdisk> and the L<sfdisk(8)> manpage.");
- ("zfile", (RString "description", [String "method"; Pathname "path"]), 140, [DeprecatedBy "file"],
+ ("zfile", (RString "description", [String "meth"; Pathname "path"]), 140, [DeprecatedBy "file"],
[],
"determine file type inside a compressed file",
"\
@@ -3560,7 +3560,7 @@ an external journal on the journal with UUID C<uuid>.
See also C<guestfs_mke2journal_U>.");
- ("modprobe", (RErr, [String "module"]), 194, [],
+ ("modprobe", (RErr, [String "modulename"]), 194, [],
[InitNone, Always, TestRun [["modprobe"; "ext2"]]],
"load a kernel module",
"\
@@ -4050,7 +4050,35 @@ let check_functions () =
if n = "i" || n = "n" then
failwithf "%s has a param/ret called 'i' or 'n', which will cause some conflicts in the generated code" name;
if n = "argv" || n = "args" then
- failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name
+ failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name;
+
+ (* List Haskell, OCaml and C keywords here.
+ * http://www.haskell.org/haskellwiki/Keywords
+ * http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#operator-char
+ * http://en.wikipedia.org/wiki/C_syntax#Reserved_keywords
+ * Formatted via: cat c haskell ocaml|sort -u|grep -v _ \
+ * |perl -pe 's/(.*)/"$1";/'|fmt -70
+ * Omitting the OCaml reserved word, "val", is ok,
+ * and saves us from renaming several parameters.
+ *)
+ let reserved = [
+ "and"; "as"; "asr"; "assert"; "auto"; "begin"; "break"; "case";
+ "char"; "class"; "const"; "constraint"; "continue"; "data";
+ "default"; "deriving"; "do"; "done"; "double"; "downto"; "else";
+ "end"; "enum"; "exception"; "extern"; "external"; "false"; "float";
+ "for"; "forall"; "foreign"; "fun"; "function"; "functor"; "goto";
+ "hiding"; "if"; "import"; "in"; "include"; "infix"; "infixl";
+ "infixr"; "inherit"; "initializer"; "inline"; "instance"; "int";
+ "land"; "lazy"; "let"; "long"; "lor"; "lsl"; "lsr"; "lxor";
+ "match"; "mdo"; "method"; "mod"; "module"; "mutable"; "new";
+ "newtype"; "object"; "of"; "open"; "or"; "private"; "qualified";
+ "rec"; "register"; "restrict"; "return"; "short"; "sig"; "signed";
+ "sizeof"; "static"; "struct"; "switch"; "then"; "to"; "true"; "try";
+ "type"; "typedef"; "union"; "unsigned"; "val"; "virtual"; "void";
+ "volatile"; "when"; "where"; "while";
+ ] in
+ if List.mem n reserved then
+ failwithf "%s has param/ret using reserved word %s" name n;
in
(match fst style with
--
1.6.4.378.g88f2f
15 years, 3 months