forked from pool/libguestfs
Accepting request 766138 from home:ldewey:branches:Virtualization
- 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
This commit is contained in:
parent
a76e53adc1
commit
71a7811fa9
44
4bb3c44-sparsify-ignore-read-only-devices.patch
Normal file
44
4bb3c44-sparsify-ignore-read-only-devices.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From 864c2ee371f65388b18e737136663986cfc9eb08 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pino Toscano <ptoscano@redhat.com>
|
||||||
|
Date: Mon, 2 Feb 2015 14:50:52 +0100
|
||||||
|
Subject: [PATCH] sparsify: ignore read-only btrfs snapshots (RHBZ#1079625)
|
||||||
|
|
||||||
|
In copy mode, make sure to not zero-free-space read-only btrfs
|
||||||
|
snapshots, as we cannot write to them.
|
||||||
|
---
|
||||||
|
sparsify/copying.ml | 28 +++++++++++++++++++++++++---
|
||||||
|
1 file changed, 25 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sparsify/copying.ml b/sparsify/copying.ml
|
||||||
|
index 165dd6e93..43f108bdc 100644
|
||||||
|
--- a/sparsify/copying.ml
|
||||||
|
+++ b/sparsify/copying.ml
|
||||||
|
@@ -208,6 +208,11 @@ You can ignore this warning or change it to a hard failure using the
|
||||||
|
* and selected swap partitions.
|
||||||
|
*)
|
||||||
|
let filesystems = g#list_filesystems () in
|
||||||
|
+ let btrfs_filesystems = List.filter (
|
||||||
|
+ fun (fs, fstype) ->
|
||||||
|
+ fstype = "btrfs"
|
||||||
|
+ ) filesystems in
|
||||||
|
+ let btrfs_filesystems = List.map fst btrfs_filesystems in
|
||||||
|
let filesystems = List.map fst filesystems in
|
||||||
|
let filesystems = List.sort compare filesystems in
|
||||||
|
|
||||||
|
@@ -218,6 +223,18 @@ You can ignore this warning or change it to a hard failure using the
|
||||||
|
|
||||||
|
let is_read_only_lv = is_read_only_lv g in
|
||||||
|
|
||||||
|
+ let is_readonly_btrfs_snapshot fs mp =
|
||||||
|
+ try
|
||||||
|
+ let is_btrfs = List.mem fs btrfs_filesystems in
|
||||||
|
+ if is_btrfs then (
|
||||||
|
+ try
|
||||||
|
+ let vol_info = g#btrfs_subvolume_show mp in
|
||||||
|
+ string_find (List.assoc "Flags" vol_info) "readonly" <> -1
|
||||||
|
+ with G.Error _ -> false
|
||||||
|
+ ) else false
|
||||||
|
+ with Not_found -> false
|
||||||
|
+ in
|
||||||
|
+
|
||||||
|
List.iter (
|
||||||
|
fun fs ->
|
||||||
|
if not (is_ignored fs) && not (is_read_only_lv fs) then (
|
||||||
|
@@ -232,10 +249,15 @@ You can ignore this warning or change it to a hard failure using the
|
||||||
|
with _ -> false in
|
||||||
|
|
||||||
|
if mounted then (
|
||||||
|
- if not quiet then
|
||||||
|
- printf (f_"Fill free space in %s with zero ...\n%!") fs;
|
||||||
|
+ 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 not quiet then
|
||||||
|
+ printf (f_"Fill free space in %s with zero ...\n%!") fs;
|
||||||
|
|
||||||
|
- g#zero_free_space "/"
|
||||||
|
+ g#zero_free_space "/"
|
||||||
|
+ )
|
||||||
|
) else (
|
||||||
|
let is_linux_x86_swap =
|
||||||
|
(* Look for the signature for Linux swap on i386.
|
||||||
|
--
|
||||||
|
2.24.1
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 21 18:54:11 UTC 2020 - Larry Dewey <ldewey@suse.com>
|
||||||
|
|
||||||
|
- Added patches to configure sparsify to ignore readonly images.
|
||||||
|
(bsc#1161169, rhbz#1064041)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 10 09:59:19 UTC 2019 - Christophe Giboudeaux <christophe@krop.fr>
|
Tue Sep 10 09:59:19 UTC 2019 - Christophe Giboudeaux <christophe@krop.fr>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libguestfs
|
# spec file for package libguestfs
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2020 SUSE LLC
|
||||||
# Copyright (c) 2011 Michal Hrusecky <mhrusecky@novell.com>
|
# Copyright (c) 2011 Michal Hrusecky <mhrusecky@novell.com>
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
@ -136,7 +136,7 @@ BuildRequires: hivex-devel
|
|||||||
BuildRequires: gtk2-devel
|
BuildRequires: gtk2-devel
|
||||||
%endif
|
%endif
|
||||||
#
|
#
|
||||||
Url: http://libguestfs.org/
|
URL: http://libguestfs.org/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Summary: Compatibility package for guestfs-tools
|
Summary: Compatibility package for guestfs-tools
|
||||||
# Upstream patches
|
# Upstream patches
|
||||||
@ -147,6 +147,9 @@ Patch1: 0a55098f-builder-repository-fix-compute_short_id-for-sles-X.0.pa
|
|||||||
Patch2: fd43730e-error-with-uninstall-option-on-SUSE.patch
|
Patch2: fd43730e-error-with-uninstall-option-on-SUSE.patch
|
||||||
Patch3: 70407cd622-inspection-Parse-os-release-opensuse-leap-as-opensus.patch
|
Patch3: 70407cd622-inspection-Parse-os-release-opensuse-leap-as-opensus.patch
|
||||||
Patch4: 28bd06227b-inspect-handle-os-release-opensuse-tumbleweed-as-ope.patch
|
Patch4: 28bd06227b-inspect-handle-os-release-opensuse-tumbleweed-as-ope.patch
|
||||||
|
Patch5: 864c2ee-sparsify-ignore-readonly-btrfs-snapshots-RHBZ-10796.patch
|
||||||
|
Patch6: 4bb3c44-sparsify-ignore-read-only-devices.patch
|
||||||
|
|
||||||
# Pending upstram review
|
# Pending upstram review
|
||||||
Patch50: 0001-Introduce-a-wrapper-around-xmlParseURI.patch
|
Patch50: 0001-Introduce-a-wrapper-around-xmlParseURI.patch
|
||||||
Patch51: 0002-common-extract-UTF-8-conversion-function.patch
|
Patch51: 0002-common-extract-UTF-8-conversion-function.patch
|
||||||
@ -566,6 +569,8 @@ It can import a variety of guest operating systems from libvirt-managed hosts.
|
|||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
%patch50 -p1
|
%patch50 -p1
|
||||||
%patch51 -p1
|
%patch51 -p1
|
||||||
%patch52 -p1
|
%patch52 -p1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user