[Libguestfs] [PATCH v2v v2 2/2] v2v: Copy static IP address information.

Richard W.M. Jones rjones at redhat.com
Tue Apr 16 08:57:44 UTC 2019


On Tue, Apr 16, 2019 at 09:55:38AM +0100, Richard W.M. Jones wrote:
> Essentially identical to v1 except that it now uses (overloads?)
> the --mac option to supply this data.

There's a small parsing problem in v2 which I discovered when I
started the test.  Fixed by applying the attached patch on top.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
-------------- next part --------------
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 82f9a7da6..ae7d80284 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -137,11 +137,11 @@ let parse_cmdline () =
                           if_prefix_length; if_nameservers }
        in
        (match String.nsplit "," out with
-        | [] | [_] ->
+        | [] ->
            error (f_"invalid --mac ip option")
-        | [mac; ip] -> add mac ip None None []
-        | [mac; ip; gw] -> add mac ip (Some gw) None []
-        | mac :: ip :: gw :: len :: nameservers ->
+        | [ip] -> add mac ip None None []
+        | [ip; gw] -> add mac ip (Some gw) None []
+        | ip :: gw :: len :: nameservers ->
            let len =
              try int_of_string len with
              | Failure _ -> error (f_"cannot parse --mac ip prefix length field as an integer: %s") len in


More information about the Libguestfs mailing list