[Libguestfs] [PATCH] v2v: More accurately match root choice specified as a specific device

Richard W.M. Jones rjones at redhat.com
Thu Apr 21 16:38:25 UTC 2011


On Thu, Apr 21, 2011 at 05:28:08PM +0100, Matthew Booth wrote:
> We could potentially have matched a logical volume /dev/ddd/lv_root as a
> physical block device, and tried to do fuzzy matching on its interface.
> ---
>  v2v/virt-v2v.pl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
> index 7c0d7d6..fe07ae9 100755
> --- a/v2v/virt-v2v.pl
> +++ b/v2v/virt-v2v.pl
> @@ -604,7 +604,7 @@ sub inspect_guest
>              # Choose the first one.
>              $root_dev = $roots[0];
>          }
> -        elsif ($root_choice =~ m|^/dev/[hsv]d(.*)|) {
> +        elsif ($root_choice =~ m|^/dev/[hsv]d([a-z]+[0-9]*)$|) {
>              # Choose the named root.
>              my $partnum = $1;
>              foreach (@roots) {

As discussed, ACK.

Probably [^/]+ would do too; device naming on Linux is pretty random
and it wasn't the greatest idea in the world to make our API depend
upon it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list