[Pkg-libvirt-commits] [libguestfs] 04/66: v2v: Clean the RPM database early on (RHBZ#1143866).

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:47:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.54-1
in repository libguestfs.

commit 4aa38bba2ca77cf0ff7271a8f419182c57f59f7a
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Sep 19 12:14:21 2014 +0100

    v2v: Clean the RPM database early on (RHBZ#1143866).
    
    If the RPM database in the source guest is corrupt, then subsequent
    operations will fail randomly.
    
    Old virt-v2v appears to have avoided this by cleaning the RPM database
    very early on.  When translating the code I inadvertantly moved this
    cleanup to a later stage -- in particular, after inspection of kernels
    was done which requires running rpm commands.  Move this back to the
    start.
---
 v2v/convert_linux.ml | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 675ccb7..e0ba28c 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -82,6 +82,11 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
   (* We use Augeas for inspection and conversion, so initialize it early. *)
   Lib_linux.augeas_init verbose g;
 
+  (* Clean RPM database.  This must be done early to avoid RHBZ#1143866. *)
+  let dbfiles = g#glob_expand "/var/lib/rpm/__db.00?" in
+  let dbfiles = Array.to_list dbfiles in
+  List.iter g#rm_f dbfiles;
+
   (* What grub is installed? *)
   let grub_config, grub =
     try
@@ -394,13 +399,6 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
 
     | `Grub2 -> () (* Not necessary for grub2. *)
 
-  and clean_rpmdb () =
-    (* Clean RPM database. *)
-    assert (inspect.i_package_format = "rpm");
-    let dbfiles = g#glob_expand "/var/lib/rpm/__db.00?" in
-    let dbfiles = Array.to_list dbfiles in
-    List.iter g#rm_f dbfiles
-
   and autorelabel () =
     (* Only do autorelabel if load_policy binary exists.  Actually
      * loading the policy is problematic.
@@ -1333,7 +1331,6 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
   in
 
   augeas_grub_configuration ();
-  clean_rpmdb ();
   autorelabel ();
 
   unconfigure_xen ();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list