- Added patches to configure sparsify to ignore readonly images. (bsc#1161169, rhbz#1064041) OBS-URL: https://build.opensuse.org/request/show/766138 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=448
45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From 4bb3c44a286beb0dd8cdf337d64d8ce71e361dd6 Mon Sep 17 00:00:00 2001
|
|
From: Pino Toscano <ptoscano@redhat.com>
|
|
Date: Mon, 2 Feb 2015 15:02:31 +0100
|
|
Subject: [PATCH] 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 43f108bdc..9f788b94c 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;
|
|
--
|
|
2.24.1
|
|
|