From: Tomáš Golembiovský <[email protected]>

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ý <[email protected]>
Signed-off-by: Richard W.M. Jones <[email protected]>
---
 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

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to