[Pkg-libvirt-commits] [libguestfs] 144/384: v2v: -i libvirtxml: Only handle NBD source with host 'localhost', for virt-p2v.
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 29 16:56:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 70c28f3d5e9cb90a7d1124b5cf61e72809d327b3
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Dec 24 17:46:08 2014 +0000
v2v: -i libvirtxml: Only handle NBD source with host 'localhost', for virt-p2v.
We only care/support virt-p2v for network disks. Give a warning about
anything else.
This avoids a potential quoting issue.
---
v2v/TODO | 1 -
v2v/input_libvirtxml.ml | 28 ++++++++++++----------------
2 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/v2v/TODO b/v2v/TODO
index cae756a..f41d56e 100644
--- a/v2v/TODO
+++ b/v2v/TODO
@@ -23,7 +23,6 @@ v2v/convert_windows.ml: * guests. Unclear if this is correct. XXX
v2v/input_libvirt_vcenter_https.ml: * XXX Old virt-v2v could also handle snapshots, ie:
v2v/input_libvirt_vcenter_https.ml: * XXX Need to handle templates. The file is called "-delta.vmdk" in
v2v/input_libvirt_vcenter_https.ml: (* XXX only works if the query string is not URI-quoted *)
-v2v/input_libvirtxml.ml: * XXX Quoting, although it's not needed for virt-p2v.
v2v/input_ova.ml: (* XXX We assume the OVF lists these in order.
v2v/input_ova.ml: (* XXX We assume the OVF lists these in order.
v2v/input_ova.ml: s_features = []; (* XXX *)
diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
index fa30a67..b0430b2 100644
--- a/v2v/input_libvirtxml.ml
+++ b/v2v/input_libvirtxml.ml
@@ -165,23 +165,19 @@ let parse_libvirt_xml ~verbose xml =
add_disk path format controller (P_source_file path)
| "network" ->
(* We only handle <source protocol="nbd"> here, and that is
- * intended only for virt-p2v. Any other network disk is
- * currently ignored.
+ * intended only for virt-p2v.
*)
- (match xpath_to_string "source/@protocol" "" with
- | "nbd" ->
- let host = xpath_to_string "source/host/@name" "" in
- let port = xpath_to_int "source/host/@port" 0 in
- if host <> "" && port > 0 then (
- (* Generate a qemu nbd URL.
- * XXX Quoting, although it's not needed for virt-p2v.
- *)
- let path = sprintf "nbd:%s:%d" host port in
- add_disk path format controller P_dont_rewrite
- )
- | "" -> ()
- | protocol ->
- warning (f_"network <disk> with <source protocol='%s'> was ignored")
+ (match (xpath_to_string "source/@protocol" "",
+ xpath_to_string "source/host/@name" "",
+ xpath_to_int "source/host/@port" 0) with
+ | "", _, _ ->
+ warning (f_"<disk type=network> was ignored")
+ | "nbd", ("localhost" as host), port when port > 0 ->
+ (* virt-p2v: Generate a qemu nbd URL. *)
+ let path = sprintf "nbd:%s:%d" host port in
+ add_disk path format controller P_dont_rewrite
+ | protocol, _, _ ->
+ warning (f_"<disk type='network'> with <source protocol='%s'> was ignored")
protocol
)
| disk_type ->
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list