[Libguestfs] [PATCH v2] v2v: linux: accept 'sr' devices in fstab

Richard W.M. Jones rjones at redhat.com
Thu Aug 11 08:02:29 UTC 2016


From: Tomáš Golembiovský <tgolembi at redhat.com>

Do not print warning for 'sr' devices when converting fstab. Not all
systems create the /dev/cdrom symlink for SCSI CD-ROM devices. Moreover,
on systems with multiple CD-ROMs, having entries for /dev/sr* devices
may be inevitable.

RWMJ: Use String.is_prefix instead of String.find, to more accurately
match on the device name.

Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
Signed-off-by: Richard W.M. Jones <rjones at redhat.com>
---
 v2v/convert_linux.ml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 4b1ce99..f9aa334 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -1329,8 +1329,10 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
       let replace device =
         try List.assoc device map
         with Not_found ->
-          if String.find device "md" = -1 && String.find device "fd" = -1 &&
-            device <> "cdrom" then
+          if not (String.is_prefix device "md") &&
+             not (String.is_prefix device "fd") &&
+             not (String.is_prefix device "sr") &&
+             device <> "cdrom" then
             warning (f_"%s references unknown device \"%s\".  You may have to fix this entry manually after conversion.")
               path device;
           device
-- 
2.7.4




More information about the Libguestfs mailing list