Pino Toscano
2017-Nov-02 10:31 UTC
[Libguestfs] [PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)
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; -- 2.13.6
Richard W.M. Jones
2017-Nov-02 12:28 UTC
[Libguestfs] [PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)
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
Reasonably Related Threads
- [PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
- [PATCH] v2v: ova: convert E1000 network interfaces as such
- [PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
- [PATCH v2 4/4] common/mltools: xpath_helpers: Get rid of xpath_*_default functions.
- Re: [PATCH] v2v: ova: convert E1000 network interfaces as such