Richard W.M. Jones
2018-Mar-22 16:05 UTC
[Libguestfs] [PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
When parsing OVA files we have to work backwards to whether the
original VMware object was a network or a bridge. It seems as if the
presence of <rasd:Connection> is sufficient. I dropped the use of
<rasd:ElementName> since it is literally just an internal name for the
network element, and is not significant in how the network is used.
Also update documentation because you must use ‘--bridge’ when
converting VMware guests to RHV.
For a full explanation see:
https://bugzilla.redhat.com/show_bug.cgi?id=1559027#c2
---
v2v/parse_ovf_from_ova.ml | 9 +++++----
v2v/virt-v2v.pod | 31 +++++++++++++------------------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml
index d8de0cea1..82d7adf8c 100644
--- a/v2v/parse_ovf_from_ova.ml
+++ b/v2v/parse_ovf_from_ova.ml
@@ -230,16 +230,17 @@ let parse_ovf_from_ova ovf_filename for i = 0 to
nr_nodes-1 do
let n = Xml.xpathobj_node obj i in
Xml.xpathctx_set_current_context xpathctx n;
- let vnet - Option.default (sprintf"eth%d" i)
- (xpath_string "rasd:ElementName/text()") in
+ let vnet, vnet_type + match xpath_string
"rasd:Connection/text()" with
+ | Some connection -> connection, Bridge
+ | None -> sprintf"eth%d" i, Network in
let mac = xpath_string "rasd:Address/text()" in
let nic = {
s_mac = mac;
s_nic_model = None;
s_vnet = vnet;
s_vnet_orig = vnet;
- s_vnet_type = Network;
+ s_vnet_type = vnet_type;
} in
List.push_front nic nics
done;
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index caf9c983e..097bab453 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -16,7 +16,7 @@ virt-v2v - Convert a guest to use KVM
-o rhv-upload -oc https://ovirt-engine.example.com/ovirt-engine/api \
-os ovirt-data -op /tmp/ovirt-admin-password \
-oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \
- --network ovirtmgmt
+ --bridge ovirtmgmt
virt-v2v -ic qemu:///system qemu_guest --in-place
@@ -62,7 +62,7 @@ interface(s) are connected to the target network called
C<ovirtmgmt>.
-o rhv-upload -oc https://ovirt-engine.example.com/ovirt-engine/api \
-os ovirt-data -op /tmp/ovirt-admin-password \
-oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \
- --network ovirtmgmt
+ --bridge ovirtmgmt
In this case the host running virt-v2v acts as a B<conversion server>.
@@ -1134,27 +1134,22 @@ guest’s Network Interface Cards (NICs):
NICs:
Network "default" mac: 52:54:00:d0:cf:0e
-This is typical of a libvirt guest: It has a single network interface
-connected to a network called C<default>.
-
-To map a specific network to a target network, for example C<default>
-on the source to C<ovirtmgmt> on the target, use:
-
- virt-v2v [...] --network default:ovirtmgmt
-
-To map every network to a target network, use:
-
- virt-v2v [...] --network ovirtmgmt
-
-Bridges are handled in the same way, but you have to use the
-I<--bridge> option instead. For example:
+Bridges are special classes of network devices which are attached to a
+named external network on the source hypervisor, for example:
$ virt-v2v [-i ...] --print-source name
[...]
NICs:
Bridge "br0"
-
- $ virt-v2v [...] --bridge br0:targetbr
+
+To map a specific bridge to a target network, for example C<br0> on
+the source to C<ovirtmgmt> on the target, use:
+
+ virt-v2v [...] --bridge br0:ovirtmgmt
+
+To map every bridge to a target network, use:
+
+ virt-v2v [...] --bridge ovirtmgmt
=head1 INPUT FROM VMWARE VCENTER SERVER
--
2.13.2
Pino Toscano
2018-Mar-23 09:40 UTC
Re: [Libguestfs] [PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
On Thursday, 22 March 2018 17:05:27 CET Richard W.M. Jones wrote:> When parsing OVA files we have to work backwards to whether the > original VMware object was a network or a bridge. It seems as if the > presence of <rasd:Connection> is sufficient. I dropped the use of > <rasd:ElementName> since it is literally just an internal name for the > network element, and is not significant in how the network is used. > > Also update documentation because you must use ‘--bridge’ when > converting VMware guests to RHV. > > For a full explanation see: > > https://bugzilla.redhat.com/show_bug.cgi?id=1559027#c2 > ---Please update the .expected files in the test suite, since the output of --print-source changed for some: FAIL: test-v2v-i-ova-gz.sh FAIL: test-v2v-i-ova-formats.sh FAIL: test-v2v-i-ova-subfolders.sh FAIL: test-v2v-i-ova-tar.sh FAIL: test-v2v-i-ova-two-disks.sh FAIL: test-v2v-i-ova.sh> diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml > index d8de0cea1..82d7adf8c 100644 > --- a/v2v/parse_ovf_from_ova.ml > +++ b/v2v/parse_ovf_from_ova.ml > @@ -230,16 +230,17 @@ let parse_ovf_from_ova ovf_filename > for i = 0 to nr_nodes-1 do > let n = Xml.xpathobj_node obj i in > Xml.xpathctx_set_current_context xpathctx n; > - let vnet > - Option.default (sprintf"eth%d" i) > - (xpath_string "rasd:ElementName/text()") in > + let vnet, vnet_type > + match xpath_string "rasd:Connection/text()" with > + | Some connection -> connection, Bridge > + | None -> sprintf"eth%d" i, Network inMissing space here ^ (Yes, it is missing in the current code too, but since it is shuffled by your patch...) The rest of the patch LGTM. -- Pino Toscano
Seemingly Similar Threads
- [PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)
- [PATCH] v2v: ova: convert E1000 network interfaces as such
- [PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
- Re: [PATCH] v2v: ova: convert E1000 network interfaces as such
- [PATCH v2 0/9] v2v: -i ova: Handle OVAs containing snapshots.