[Pkg-libvirt-commits] [libguestfs] 30/40: v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946).

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:44:53 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.44-1
in repository libguestfs.

commit 73c1f1cf7e1c4aa4e70407feff49ba847f7ebb63
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Sep 12 19:37:03 2014 +0100

    v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946).
---
 v2v/input_libvirtxml.ml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
index 1745ec4..9f806c5 100644
--- a/v2v/input_libvirtxml.ml
+++ b/v2v/input_libvirtxml.ml
@@ -138,6 +138,12 @@ let parse_libvirt_xml ~verbose
         | "" -> None
         | format -> Some format in
 
+      (* Local files should be readable.  This just avoids calling
+       * qemu-img with a bad backing file and then getting an
+       * impenetrable error from qemu-img (RHBZ#1140946).
+       *)
+      let error_if_file_not_readable path = Unix.access path [Unix.R_OK] in
+
       (* The <disk type='...'> attribute may be 'block', 'file' or
        * 'network'.  We ignore any other types.
        *)
@@ -145,12 +151,14 @@ let parse_libvirt_xml ~verbose
       | "block" ->
         let path = xpath_to_string "source/@dev" "" in
         if path <> "" then (
+          error_if_file_not_readable path;
           let path, format = map_source_dev path format in
           add_disk path format target_dev
         )
       | "file" ->
         let path = xpath_to_string "source/@file" "" in
         if path <> "" then (
+          error_if_file_not_readable path;
           let path, format = map_source_file path format in
           add_disk path format target_dev
         )

-- 
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