[Libguestfs] [PATCH v2] v2v: linux: accept 'sr' devices in fstab
Tomáš Golembiovský
tgolembi at redhat.com
Thu Aug 11 10:44:29 UTC 2016
On Thu, 11 Aug 2016 09:02:29 +0100
"Richard W.M. Jones" <rjones at redhat.com> wrote:
> 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
>
Yes, that's much better. LGTM
--
Tomáš Golembiovský <tgolembi at redhat.com>
More information about the Libguestfs
mailing list