[Pkg-libvirt-commits] [libguestfs] 225/384: sparsify: ignore read-only devices

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:57:19 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 4bb3c44a286beb0dd8cdf337d64d8ce71e361dd6
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Mon Feb 2 15:02:31 2015 +0100

    sparsify: ignore read-only devices
    
    In copy mode, make sure to not zero-free-space devices mounted as
    read-only, as we cannot write to them.
    
    Related to RHBZ#1079625.
---
 sparsify/copying.ml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sparsify/copying.ml b/sparsify/copying.ml
index 43f108b..9f788b9 100644
--- a/sparsify/copying.ml
+++ b/sparsify/copying.ml
@@ -235,6 +235,13 @@ You can ignore this warning or change it to a hard failure using the
     with Not_found -> false
   in
 
+  let is_readonly_device mp =
+    let statvfs = g#statvfs mp in
+    let flags = statvfs.G.flag in
+    (* 0x01 is ST_RDONLY in Linux' GNU libc. *)
+    flags <> -1_L && (flags &^ 0x1_L) <> 0_L
+  in
+
   List.iter (
     fun fs ->
       if not (is_ignored fs) && not (is_read_only_lv fs) then (
@@ -252,6 +259,9 @@ You can ignore this warning or change it to a hard failure using the
             if is_readonly_btrfs_snapshot fs "/" then (
               if not quiet then
                 printf (f_"Skipping %s, as it is a read-only btrfs snapshot.\n%!") fs;
+            ) else if is_readonly_device "/" then (
+              if not quiet then
+                printf (f_"Skipping %s, as it is a read-only device.\n%!") fs;
             ) else (
               if not quiet then
                 printf (f_"Fill free space in %s with zero ...\n%!") fs;

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