[Libguestfs] [PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)

Richard W.M. Jones rjones at redhat.com
Thu Nov 2 12:28:18 UTC 2017


On Thu, Nov 02, 2017 at 11:31:46AM +0100, Pino Toscano wrote:
> Read the MAC address of the network interfaces from the <rasd:Address>
> tag of the OVF.  This seems to be one of the possible ways used in OVFs.
> ---
>  v2v/parse_ovf_from_ova.ml | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml
> index fe8228dcc..4ee6bc901 100644
> --- a/v2v/parse_ovf_from_ova.ml
> +++ b/v2v/parse_ovf_from_ova.ml
> @@ -232,8 +232,9 @@ let parse_ovf_from_ova ovf_filename =
>        let vnet =
>          Option.default (sprintf"eth%d" i)
>                         (xpath_string "rasd:ElementName/text()") in
> +      let mac = xpath_string "rasd:Address/text()" in
>        let nic = {
> -        s_mac = None;
> +        s_mac = mac;
>          s_nic_model = None;
>          s_vnet = vnet;
>          s_vnet_orig = vnet;
> -- 

I tested this with Nisim's test OVA file and it works for me.

‘--print-source’ shows the MAC:

...
NICs:
	Network "Network adapter 1" mac: 00:0c:29:72:1e:79
...

Libvirt output contains the MAC:

...
    <interface type='network'>
      <source network='Network adapter 1'/>
      <model type='virtio'/>
      <mac address='00:0c:29:72:1e:79'/>
    </interface>
...

I'm vaguely worried we might see a form of the MAC with dashes instead
of colons, but let's not worry about that until someone provides a
real sample of one.

Therefore:

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list