|
|
0d20ef |
From ea14134fc6b3305d28f317170e3c0daec00628ac Mon Sep 17 00:00:00 2001
|
|
|
0d20ef |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
0d20ef |
Date: Fri, 5 Dec 2014 13:52:25 +0000
|
|
|
0d20ef |
Subject: [PATCH] v2v: Fix missing loop device which breaks conversion of RHEL
|
|
|
0d20ef |
3 guests (RHBZ#1171130).
|
|
|
0d20ef |
|
|
|
0d20ef |
(cherry picked from commit 1bd779c983d62f36bf50ad613928cf209f98fbce)
|
|
|
0d20ef |
---
|
|
|
0d20ef |
v2v/convert_linux.ml | 26 +++++++++++++++++++++-----
|
|
|
0d20ef |
1 file changed, 21 insertions(+), 5 deletions(-)
|
|
|
0d20ef |
|
|
|
0d20ef |
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
|
|
|
0d20ef |
index 5852022..a4897ca 100644
|
|
|
0d20ef |
--- a/v2v/convert_linux.ml
|
|
|
0d20ef |
+++ b/v2v/convert_linux.ml
|
|
|
0d20ef |
@@ -883,14 +883,30 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
|
|
|
0d20ef |
(* loop is a module in RHEL 5. Try to load it. Doesn't matter
|
|
|
0d20ef |
* for other OSs if it doesn't exist, but RHEL 5 will complain:
|
|
|
0d20ef |
* "All of your loopback devices are in use."
|
|
|
0d20ef |
- *
|
|
|
0d20ef |
- * XXX RHEL 3 unfortunately will give this error anyway.
|
|
|
0d20ef |
- * mkinitrd runs the nash command `findlodev' which is
|
|
|
0d20ef |
- * essentially incompatible with modern kernels that don't
|
|
|
0d20ef |
- * have fixed /dev/loopN devices.
|
|
|
0d20ef |
*)
|
|
|
0d20ef |
(try g#modprobe "loop" with G.Error _ -> ());
|
|
|
0d20ef |
|
|
|
0d20ef |
+ (* On RHEL 3 we have to take extra gritty to get a working
|
|
|
0d20ef |
+ * loopdev. mkinitrd runs the nash command `findlodev'
|
|
|
0d20ef |
+ * which does this:
|
|
|
0d20ef |
+ *
|
|
|
0d20ef |
+ * for (devNum = 0; devNum < 256; devNum++) {
|
|
|
0d20ef |
+ * sprintf(devName, "/dev/loop%s%d", separator, devNum);
|
|
|
0d20ef |
+ * if ((fd = open(devName, O_RDONLY)) < 0) return 0;
|
|
|
0d20ef |
+ * if (ioctl(fd, LOOP_GET_STATUS, &loopInfo)) {
|
|
|
0d20ef |
+ * close(fd);
|
|
|
0d20ef |
+ * printf("%s\n", devName);
|
|
|
0d20ef |
+ * return 0;
|
|
|
0d20ef |
+ * // etc
|
|
|
0d20ef |
+ *
|
|
|
0d20ef |
+ * In a modern kernel, /dev/loop<N> isn't created until it is
|
|
|
0d20ef |
+ * used. But we can create /dev/loop0 manually. Note we have
|
|
|
0d20ef |
+ * to do this in the appliance /dev. (RHBZ#1171130)
|
|
|
0d20ef |
+ *)
|
|
|
0d20ef |
+ if family = `RHEL_family && inspect.i_major_version = 3 then
|
|
|
0d20ef |
+ ignore (g#debug "sh" [| "mknod"; "-m"; "0666";
|
|
|
0d20ef |
+ "/dev/loop0"; "b"; "7"; "0" |]);
|
|
|
0d20ef |
+
|
|
|
0d20ef |
(* RHEL 4 mkinitrd determines if the root filesystem is on LVM
|
|
|
0d20ef |
* by checking if the device name (after following symlinks)
|
|
|
0d20ef |
* starts with /dev/mapper. However, on recent kernels/udevs,
|
|
|
0d20ef |
--
|
|
|
0d20ef |
1.8.3.1
|
|
|
0d20ef |
|