[Pkg-libvirt-commits] [libguestfs] 49/384: v2v: Fix missing loop device which breaks conversion of RHEL 3 guests (RHBZ#1171130).

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:55:20 UTC 2015


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

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 1bd779c983d62f36bf50ad613928cf209f98fbce
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Dec 5 13:52:25 2014 +0000

    v2v: Fix missing loop device which breaks conversion of RHEL 3 guests (RHBZ#1171130).
---
 v2v/convert_linux.ml | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index c1e5be7..3d6a369 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -890,14 +890,30 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
         (* loop is a module in RHEL 5. Try to load it. Doesn't matter
          * for other OSs if it doesn't exist, but RHEL 5 will complain:
          *   "All of your loopback devices are in use."
-         *
-         * XXX RHEL 3 unfortunately will give this error anyway.
-         * mkinitrd runs the nash command `findlodev' which is
-         * essentially incompatible with modern kernels that don't
-         * have fixed /dev/loopN devices.
          *)
         (try g#modprobe "loop" with G.Error _ -> ());
 
+        (* On RHEL 3 we have to take extra gritty to get a working
+         * loopdev.  mkinitrd runs the nash command `findlodev'
+         * which does this:
+         *
+         * for (devNum = 0; devNum < 256; devNum++) {
+         *   sprintf(devName, "/dev/loop%s%d", separator, devNum);
+         *   if ((fd = open(devName, O_RDONLY)) < 0) return 0;
+         *   if (ioctl(fd, LOOP_GET_STATUS, &loopInfo)) {
+         *     close(fd);
+         *     printf("%s\n", devName);
+         *     return 0;
+         * // etc
+         *
+         * In a modern kernel, /dev/loop<N> isn't created until it is
+         * used.  But we can create /dev/loop0 manually.  Note we have
+         * to do this in the appliance /dev.  (RHBZ#1171130)
+         *)
+        if family = `RHEL_family && inspect.i_major_version = 3 then
+          ignore (g#debug "sh" [| "mknod"; "-m"; "0666";
+                                  "/dev/loop0"; "b"; "7"; "0" |]);
+
         (* RHEL 4 mkinitrd determines if the root filesystem is on LVM
          * by checking if the device name (after following symlinks)
          * starts with /dev/mapper. However, on recent kernels/udevs,

-- 
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