|
|
0d20ef |
From 9849e04550f0b5a5c96972bfbe0933c5d57ebbc6 Mon Sep 17 00:00:00 2001
|
|
|
0d20ef |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
0d20ef |
Date: Thu, 6 Nov 2014 09:47:21 +0000
|
|
|
0d20ef |
Subject: [PATCH] v2v: Ignore small filesystems when checking for sufficient
|
|
|
0d20ef |
free space.
|
|
|
0d20ef |
|
|
|
0d20ef |
(cherry picked from commit 918dd3705d3d34f28eb3cf30cd79d16358d525e3)
|
|
|
0d20ef |
---
|
|
|
0d20ef |
v2v/v2v.ml | 48 +++++++++++++++++++++++++++---------------------
|
|
|
0d20ef |
1 file changed, 27 insertions(+), 21 deletions(-)
|
|
|
0d20ef |
|
|
|
0d20ef |
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
|
|
|
0d20ef |
index 48fb8c6..8639482 100644
|
|
|
0d20ef |
--- a/v2v/v2v.ml
|
|
|
0d20ef |
+++ b/v2v/v2v.ml
|
|
|
0d20ef |
@@ -542,27 +542,33 @@ and inspect_source g root_choice =
|
|
|
0d20ef |
*)
|
|
|
0d20ef |
and check_free_space mpstats =
|
|
|
0d20ef |
List.iter (
|
|
|
0d20ef |
- fun { mp_path = mp; mp_statvfs = { G.bfree = bfree; bsize = bsize } } ->
|
|
|
0d20ef |
- (* bfree = free blocks for root user *)
|
|
|
0d20ef |
- let free_bytes = bfree *^ bsize in
|
|
|
0d20ef |
- let needed_bytes =
|
|
|
0d20ef |
- match mp with
|
|
|
0d20ef |
- | "/" ->
|
|
|
0d20ef |
- (* We may install some packages, and they would usually go
|
|
|
0d20ef |
- * on the root filesystem.
|
|
|
0d20ef |
- *)
|
|
|
0d20ef |
- 20_000_000L
|
|
|
0d20ef |
- | "/boot" ->
|
|
|
0d20ef |
- (* We usually regenerate the initramfs, which has a typical size
|
|
|
0d20ef |
- * of 20-30MB. Hence:
|
|
|
0d20ef |
- *)
|
|
|
0d20ef |
- 50_000_000L
|
|
|
0d20ef |
- | _ ->
|
|
|
0d20ef |
- (* For everything else, just make sure there is some free space. *)
|
|
|
0d20ef |
- 10_000_000L in
|
|
|
0d20ef |
- if free_bytes < needed_bytes then
|
|
|
0d20ef |
- error (f_"not enough free space for conversion on filesystem '%s'. %Ld bytes free < %Ld bytes needed")
|
|
|
0d20ef |
- mp free_bytes needed_bytes
|
|
|
0d20ef |
+ fun { mp_path = mp;
|
|
|
0d20ef |
+ mp_statvfs = { G.bfree = bfree; blocks = blocks; bsize = bsize } } ->
|
|
|
0d20ef |
+ (* Ignore small filesystems. *)
|
|
|
0d20ef |
+ let total_size = blocks *^ bsize in
|
|
|
0d20ef |
+ if total_size > 100_000_000L then (
|
|
|
0d20ef |
+ (* bfree = free blocks for root user *)
|
|
|
0d20ef |
+ let free_bytes = bfree *^ bsize in
|
|
|
0d20ef |
+ let needed_bytes =
|
|
|
0d20ef |
+ match mp with
|
|
|
0d20ef |
+ | "/" ->
|
|
|
0d20ef |
+ (* We may install some packages, and they would usually go
|
|
|
0d20ef |
+ * on the root filesystem.
|
|
|
0d20ef |
+ *)
|
|
|
0d20ef |
+ 20_000_000L
|
|
|
0d20ef |
+ | "/boot" ->
|
|
|
0d20ef |
+ (* We usually regenerate the initramfs, which has a
|
|
|
0d20ef |
+ * typical size of 20-30MB. Hence:
|
|
|
0d20ef |
+ *)
|
|
|
0d20ef |
+ 50_000_000L
|
|
|
0d20ef |
+ | _ ->
|
|
|
0d20ef |
+ (* For everything else, just make sure there is some free space. *)
|
|
|
0d20ef |
+ 10_000_000L in
|
|
|
0d20ef |
+
|
|
|
0d20ef |
+ if free_bytes < needed_bytes then
|
|
|
0d20ef |
+ error (f_"not enough free space for conversion on filesystem '%s'. %Ld bytes free < %Ld bytes needed")
|
|
|
0d20ef |
+ mp free_bytes needed_bytes
|
|
|
0d20ef |
+ )
|
|
|
0d20ef |
) mpstats
|
|
|
0d20ef |
|
|
|
0d20ef |
(* Perform the fstrim. The trimming bit is easy. Dealing with the
|
|
|
0d20ef |
--
|
|
|
0d20ef |
1.8.3.1
|
|
|
0d20ef |
|