[PATCH v3 0/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
by Chen Hanxiao
As Pino's comment, we should take advantage of
macro CLEANUP_FREE_STRING_LIST
v3: fix test case failure
v2: properly initialize lines
Chen Hanxiao (3):
do_btrfs_qgroup_show: fix a bad return value
do_btrfs_subvolume_list: fix a bad return value
btrfs: use CLEANUP_FREE_STRING_LIST for list free
daemon/btrfs.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--
2.1.0
9 years, 5 months
[PATCH] btrfs: use calloc instead of malloc+memset
by Pino Toscano
Small optimization, and eases the code.
---
daemon/btrfs.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index f02acb1..7b14bac 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1723,12 +1723,11 @@ do_btrfs_balance_status (const char *path)
nlines = count_strings (lines);
- ret = malloc(sizeof *ret);
+ ret = calloc (1, sizeof *ret);
if (ret == NULL) {
- reply_with_perror ("malloc");
+ reply_with_perror ("calloc");
goto error;
}
- memset (ret, 0, sizeof(*ret));
/* Output of `btrfs balance status' is like:
*
@@ -1850,12 +1849,11 @@ do_btrfs_scrub_status (const char *path)
return NULL;
}
- ret = malloc (sizeof *ret);
+ ret = calloc (1, sizeof *ret);
if (ret == NULL) {
- reply_with_perror ("malloc");
+ reply_with_perror ("calloc");
return NULL;
}
- memset (ret, 0, sizeof(*ret));
/* Output of `btrfs scrub -R status' is like:
*
--
2.1.0
9 years, 5 months
[PATCH] btrfs: remove unused 'out' variables
by Pino Toscano
If we are not interested in output of a command being run, then there's
no need to still capture it in a (automatically freed, but still)
variable.
If any of those outputs is needed, a variable for it can be easily added
back.
---
daemon/btrfs.c | 60 ++++++++++++++++++++--------------------------------------
1 file changed, 20 insertions(+), 40 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..f02acb1 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1049,7 +1049,6 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable)
size_t i = 0;
char *fs_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r = -1;
fs_buf = mount (fs);
@@ -1065,7 +1064,7 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable)
ADD_ARG (argv, i, fs_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", fs_buf, err);
goto error;
@@ -1085,7 +1084,6 @@ do_btrfs_quota_rescan (const mountable_t *fs)
size_t i = 0;
char *fs_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r = -1;
fs_buf = mount (fs);
@@ -1098,7 +1096,7 @@ do_btrfs_quota_rescan (const mountable_t *fs)
ADD_ARG (argv, i, fs_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", fs_buf, err);
goto error;
@@ -1118,7 +1116,6 @@ do_btrfs_qgroup_limit (const char *subvolume, int64_t size)
size_t i = 0;
CLEANUP_FREE char *subvolume_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
char size_str[32];
int r;
@@ -1136,7 +1133,7 @@ do_btrfs_qgroup_limit (const char *subvolume, int64_t size)
ADD_ARG (argv, i, subvolume_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", subvolume, err);
return -1;
@@ -1153,7 +1150,6 @@ do_btrfs_qgroup_create (const char *qgroupid, const char *subvolume)
size_t i = 0;
CLEANUP_FREE char *subvolume_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
subvolume_buf = sysroot_path (subvolume);
@@ -1169,7 +1165,7 @@ do_btrfs_qgroup_create (const char *qgroupid, const char *subvolume)
ADD_ARG (argv, i, subvolume_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", subvolume, err);
return -1;
@@ -1186,7 +1182,6 @@ do_btrfs_qgroup_destroy (const char *qgroupid, const char *subvolume)
size_t i = 0;
CLEANUP_FREE char *subvolume_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
subvolume_buf = sysroot_path (subvolume);
@@ -1202,7 +1197,7 @@ do_btrfs_qgroup_destroy (const char *qgroupid, const char *subvolume)
ADD_ARG (argv, i, subvolume_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", subvolume, err);
return -1;
@@ -1343,7 +1338,6 @@ do_btrfs_qgroup_assign (const char *src, const char *dst, const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1360,7 +1354,7 @@ do_btrfs_qgroup_assign (const char *src, const char *dst, const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1377,7 +1371,6 @@ do_btrfs_qgroup_remove (const char *src, const char *dst, const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1394,7 +1387,7 @@ do_btrfs_qgroup_remove (const char *src, const char *dst, const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1411,7 +1404,6 @@ do_btrfs_scrub_start (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1426,7 +1418,7 @@ do_btrfs_scrub_start (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1443,7 +1435,6 @@ do_btrfs_scrub_cancel (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1458,7 +1449,7 @@ do_btrfs_scrub_cancel (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1475,7 +1466,6 @@ do_btrfs_scrub_resume (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1490,7 +1480,7 @@ do_btrfs_scrub_resume (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1507,7 +1497,6 @@ do_btrfs_balance_pause (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1522,7 +1511,7 @@ do_btrfs_balance_pause (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1539,7 +1528,6 @@ do_btrfs_balance_cancel (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1554,7 +1542,7 @@ do_btrfs_balance_cancel (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1571,7 +1559,6 @@ do_btrfs_balance_resume (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1586,7 +1573,7 @@ do_btrfs_balance_resume (const char *path)
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1604,7 +1591,6 @@ do_btrfs_filesystem_defragment (const char *path, int flush, const char *compres
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
path_buf = sysroot_path (path);
@@ -1635,7 +1621,7 @@ do_btrfs_filesystem_defragment (const char *path, int flush, const char *compres
ADD_ARG (argv, i, path_buf);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return -1;
@@ -1651,7 +1637,6 @@ do_btrfs_rescue_chunk_recover (const char *device)
const char *argv[MAX_ARGS];
size_t i = 0;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
ADD_ARG (argv, i, str_btrfs);
@@ -1661,7 +1646,7 @@ do_btrfs_rescue_chunk_recover (const char *device)
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -1677,7 +1662,6 @@ do_btrfs_rescue_super_recover (const char *device)
const char *argv[MAX_ARGS];
size_t i = 0;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
ADD_ARG (argv, i, str_btrfs);
@@ -1687,7 +1671,7 @@ do_btrfs_rescue_super_recover (const char *device)
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -1973,7 +1957,6 @@ do_btrfstune_seeding (const char *device, int svalue)
const char *argv[MAX_ARGS];
size_t i = 0;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
const char *s_value = svalue ? "1" : "0";
@@ -1985,7 +1968,7 @@ do_btrfstune_seeding (const char *device, int svalue)
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -2001,7 +1984,6 @@ do_btrfstune_enable_extended_inode_refs (const char *device)
const char *argv[MAX_ARGS];
size_t i = 0;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
ADD_ARG (argv, i, str_btrfstune);
@@ -2009,7 +1991,7 @@ do_btrfstune_enable_extended_inode_refs (const char *device)
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -2025,7 +2007,6 @@ do_btrfstune_enable_skinny_metadata_extent_refs (const char *device)
const char *argv[MAX_ARGS];
size_t i = 0;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
int r;
ADD_ARG (argv, i, str_btrfstune);
@@ -2033,7 +2014,7 @@ do_btrfstune_enable_skinny_metadata_extent_refs (const char *device)
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -2051,7 +2032,6 @@ do_btrfs_image (char *const *sources, const char *image,
const char *argv[MAX_ARGS];
size_t i = 0, j;
CLEANUP_FREE char *err = NULL;
- CLEANUP_FREE char *out = NULL;
char compresslevel_s[64];
int r;
@@ -2075,7 +2055,7 @@ do_btrfs_image (char *const *sources, const char *image,
ADD_ARG (argv, i, image);
ADD_ARG (argv, i, NULL);
- r = commandv (&out, &err, argv);
+ r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s %s: %s", sources[0], image, err);
return -1;
--
2.1.0
9 years, 5 months
[PATCH 0/5] Add support for thread-safe handle.
by Richard W.M. Jones
This patch isn't ready to go upstream. In fact, I think we might do a
quick 1.30 release soon, and save this patch, and also the extensive
changes proposed for the test suite[1], to after 1.30.
Currently it is not safe to use the same handle from multiple threads,
unless you implement your own mutexes. See:
http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads
These patches add support for a thread-safe handle, so you can use the
same handle concurrently from multiple threads without requiring the
caller to perform any special locking.
The implementation is fairly straightforward: a recursive lock is
added to the handle (using the gnulib gl_recursive_lock so it should
be fairly portable beyond POSIX threads). The recursive lock is
required because libguestfs extensively calls itself. Also a
recursive lock allows callbacks back to program code to work -- we
don't want to release the lock before a callback since that would
allow other threads to enter libguestfs using the same handle.
I studied the libvirt implementation which doesn't use a recursive
lock, but does use conditions to achieve the same thing more
efficiently. It is considerably more complex.
The difficult part of the implementation is error handling (see
description of patch 3/5). This patch causes an API change, which is
one reason why it cannot go upstream at the moment.
The tests pass, but apart from running the tests standalone and under
valgrind, and adding a (not very satisfactory) new test, I have not
tested the patches any further.
Comments welcome,
Rich.
[1] https://www.redhat.com/archives/libguestfs/2014-October/msg00208.html
9 years, 5 months
[PATCH v3 00/11] virt-resize: add support for resizing MBR logical partitions
by Chen Hanxiao
In current virt-resize, only primary partitions(including
extended partition) are supported. They are collected in an
array for resize operations. Logical partitions are not
supported.
This series add support for resizing logical partitions.
v3:
1) rewrite partitions/logical_partitions/extended_partition section
by the comments from Rich and Pino.
2) in 03/11 introduce logical_align for reserve enough space
when resizing logical/extended partitions.
v2:
1) Add 3 variables to describe relationship of logical and extended partitions:
- partitions
flat list of primary partitions (as now, the global 'partitions').
extended partitions is essentially primary partition
- logical_partitions
flat list of logical partitions
- extended_partition
one MBR extended partition
2) reserve enough size when resizing logical partitions
Original patches by Hu Tao at:
https://www.redhat.com/archives/libguestfs/2014-October/msg00238.html
Chen Hanxiao (11):
resize: move loop check from find_partitions
resize: add logical_partitions and extended_partition
resize: calculate max alignment of logical partitions
resize: add support for logical partitions for calculate_surplus
resize: handle resize of logical partitions
resize: add support for logical partitions of
calculate_target_partitions
resize: calculate_target_partitions for logical partitions
resize: parted and copy logical partitions
resize: more misc ops on logical partition
resize: add support resize extended partition
resize: test: add support for resizing extended and logical partitions
resize/resize.ml | 220 +++++++++++++++++++++++++++++++++++----------
resize/test-virt-resize.pl | 32 ++-----
2 files changed, 179 insertions(+), 73 deletions(-)
--
2.1.0
9 years, 5 months
[PATCH RFC][Resend] New API: btrfs_convert
by Pino Tsao
Disable the test case temporarily for 2 reasons:
1. Because the default test disk size is 500M, while btrfs convert command think it is too small to convert it(actually, just add 10M or 20M more is enough).
2. Btrfs-progs has may have a tiny bug, when execute the command in guestfish, it report some error, but convert the filesystem to btrfs successfully.
Signed-off-by: Pino Tsao <caoj.fnst(a)cn.fujitsu.com>
---
daemon/btrfs.c | 29 +++++++++++++++++++++++++++++
generator/actions.ml | 18 ++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..fd679cf 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -38,6 +38,7 @@ GUESTFSD_EXT_CMD(str_btrfsck, btrfsck);
GUESTFSD_EXT_CMD(str_mkfs_btrfs, mkfs.btrfs);
GUESTFSD_EXT_CMD(str_umount, umount);
GUESTFSD_EXT_CMD(str_btrfsimage, btrfs-image);
+GUESTFSD_EXT_CMD(str_btrfsconvert, btrfs-convert);
int
optgroup_btrfs_available (void)
@@ -2083,3 +2084,31 @@ do_btrfs_image (char *const *sources, const char *image,
return 0;
}
+
+int
+do_btrfs_convert (const char *device, int rollback)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
+ int r;
+
+ ADD_ARG (argv, i, str_btrfsconvert);
+ ADD_ARG (argv, i, device);
+
+ if ((optargs_bitmask & GUESTFS_BTRFS_CONVERT_ROLLBACK_BITMASK) && rollback)
+ ADD_ARG (argv, i, "-r");
+
+ ADD_ARG (argv, i, NULL);
+
+ r = commandv (&out, &err, argv);
+ if (r == -1) {
+ reply_with_error ("%s: %s", device, err);
+ return -1;
+ }
+
+ return 0;
+}
+
diff --git a/generator/actions.ml b/generator/actions.ml
index 1a89869..e42f02d 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12579,6 +12579,24 @@ numbered C<partnum> on device C<device>.
It returns C<primary>, C<logical>, or C<extended>." };
+ { defaults with
+ name = "btrfs_convert";
+ style = RErr, [Device "device"], [OBool "rollback"];
+ proc_nr = Some 455;
+ optional = Some "btrfs"; camel_name = "BTRFSConvert";
+ tests = [
+ InitEmpty, Disabled, TestRun (
+ [["mkfs"; "ext2"; "/dev/sda"; ""; "NOARG"; ""; ""; "NOARG"];
+ ["btrfs_convert"; "/dev/sda"; ""];
+ ["btrfs_convert"; "/dev/sda"; "true"]]), []
+ ];
+ shortdesc = "convert from ext2/3/4 filesystem to btrfs or rollback";
+ longdesc = "\
+This is used to convert existed ext2/3/4 to btrfs filesystem, and the original
+filesystem image is accessible as from separate subvolume named ext2_saved as file image.
+
+If you want to rollback to ext2/3/4, set rollback to true." };
+
]
(* Non-API meta-commands available only in guestfish.
--
2.1.0
9 years, 5 months
[PATCH] guestfs.pod: fix a typo
by Chen Hanxiao
s/caling/calling
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/guestfs.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/guestfs.pod b/src/guestfs.pod
index fa04c86..5ceef92 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -586,7 +586,7 @@ The logical volume(s) can now be mounted in the usual way.
Use the reverse process to close a LUKS device. Unmount
any logical volumes on it, deactivate the volume groups
-by caling C<guestfs_vg_activate (g, 0, ["/dev/VG"])>.
+by calling C<guestfs_vg_activate (g, 0, ["/dev/VG"])>.
Then close the mapper device by calling
L</guestfs_luks_close> on the F</dev/mapper/mapname>
device (I<not> the underlying encrypted block device).
--
2.1.0
9 years, 5 months
[PATCH] resize: make available expand method warnings more prominent
by Pino Toscano
When hitting a filesystem which we cannot or don't know how to expand,
instead of print a warning in verbose mode only, print it always when
showing the summary of the changes.
In the virt-resize documentation, add a paragraph about this warning.
---
resize/resize.ml | 30 +++++++++++++++++++++++-------
resize/virt-resize.pod | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/resize/resize.ml b/resize/resize.ml
index 602a583..9ea5f8a 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -575,11 +575,7 @@ read the man page virt-resize(1).
| ContentFS (("ntfs"), _) when !ntfs_available -> true
| ContentFS (("btrfs"), _) when !btrfs_available -> true
| ContentFS (("xfs"), _) when !xfs_available -> true
- | ContentFS (fs, _) ->
- if verbose () then
- warning (f_"unknown/unavailable method for expanding filesystem %s")
- fs;
- false
+ | ContentFS (fs, _) -> false
| ContentExtendedPartition -> false
else
fun _ -> false
@@ -863,7 +859,17 @@ read the man page virt-resize(1).
p.p_name
(string_of_expand_content_method
(expand_content_method p.p_type))
- ) else "" in
+ ) else (
+ (match p.p_type with
+ | ContentUnknown
+ | ContentPV _
+ | ContentExtendedPartition -> ()
+ | ContentFS (fs, _) ->
+ warning (f_"unknown/unavailable method for expanding the %s filesystem on %s")
+ fs p.p_name;
+ );
+ ""
+ ) in
wrap (text ^ "\n\n") in
@@ -883,7 +889,17 @@ read the man page virt-resize(1).
name
(string_of_expand_content_method
(expand_content_method lv.lv_type))
- ) else "" in
+ ) else (
+ (match lv.lv_type with
+ | ContentUnknown
+ | ContentPV _
+ | ContentExtendedPartition -> ()
+ | ContentFS (fs, _) ->
+ warning (f_"unknown/unavailable method for expanding the %s filesystem on %s")
+ fs name;
+ );
+ ""
+ ) in
wrap (text ^ "\n\n")
) lvs;
diff --git a/resize/virt-resize.pod b/resize/virt-resize.pod
index d8da02f..26fd136 100644
--- a/resize/virt-resize.pod
+++ b/resize/virt-resize.pod
@@ -727,6 +727,45 @@ the disk before.
If you have to reuse a target which contains data already, you should
use the I<--no-sparse> option. Note this can be much slower.
+=head2 "unknown/unavailable method for expanding the TYPE filesystem on DEVICE/LV"
+
+Virt-resize was asked to expand a partition or a logical volume
+containing a filesystem with the type C<TYPE>, but there is no
+available nor known expanding method for that filesystem.
+
+This may be due to either of the following:
+
+=over 4
+
+=item 1.
+
+There corresponding filesystem is not available in libguestfs,
+because there is no proper package in the host with utilities for it.
+This is usually the case for C<btrfs>, C<ntfs>, and C<xfs>
+filesystems.
+
+Check the results of:
+
+ virt-resize --machine-readable
+ guestfish -a /dev/null run : available
+ guestfish -a /dev/null run : filesystem_available TYPE
+
+In this case, it is enough to install the proper packages
+adding support for them. For example, C<libguestfs-xfs> on
+Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, and distributions
+derived from them, for supporting the C<xfs> filesystem.
+
+=item 2.
+
+Virt-resize has no support for expanding that type of filesystem.
+
+In this case, there's nothing that can be done to let virt-resize
+expand that type of filesystem.
+
+=back
+
+In both cases, virt-resize will not expand the mentioned filesystem.
+
=head1 ALTERNATIVE TOOLS
There are several proprietary tools for resizing partitions. We
--
2.1.0
9 years, 5 months
[PATCH] Improve fixed appliance documentation
by Pino Toscano
Move the "FIXED APPLIANCE" section from
libguestfs-make-fixed-appliance(1) to the general guestfs(3), so it's
more visible and less hidden in the documentation of a rarely-used tool.
Expand the FAQ question about libguestfs without supermin, mentioning
the build options needed and pointing to the aforementioned new section.
---
appliance/libguestfs-make-fixed-appliance.pod | 28 ++-------------------------
examples/guestfs-faq.pod | 11 ++++++++++-
src/guestfs.pod | 24 +++++++++++++++++++++++
3 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/appliance/libguestfs-make-fixed-appliance.pod b/appliance/libguestfs-make-fixed-appliance.pod
index 3242afc..9eb8644 100644
--- a/appliance/libguestfs-make-fixed-appliance.pod
+++ b/appliance/libguestfs-make-fixed-appliance.pod
@@ -38,8 +38,8 @@ L<guestfs-performance(1)>).
=back
-For deeper understanding of why you might need this tool, read the
-section L</FIXED APPLIANCE> below.
+For deeper understanding of why you might need this tool, read
+L<guestfs(3)/FIXED APPLIANCE>.
Instead of running this tool, you can download fixed appliances from
L<http://libguestfs.org/download/binaries/appliance/>. These
@@ -120,30 +120,6 @@ completely silent when it is running.
=back
-=head1 FIXED APPLIANCE
-
-When libguestfs (or libguestfs tools) are run, they search a path
-looking for an appliance. The path is built into libguestfs, or can
-be set using the C<LIBGUESTFS_PATH> environment variable.
-
-Normally a supermin appliance is located on this path (see
-L<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
-into a full appliance by running C<supermin --build>.
-
-However, a simpler "fixed appliance" can also be used. libguestfs
-detects this by looking for a directory on the path containing four
-files called C<kernel>, C<initrd>, C<root> and C<README.fixed> (note
-the C<README.fixed> file must be present as well).
-
-If the fixed appliance is found, libguestfs skips supermin entirely
-and just runs qemu with the kernel, initrd and root disk from the
-fixed appliance.
-
-Thus the fixed appliance can be used when a platform or Linux distro
-does not support supermin. You build the fixed appliance on a
-platform that does support supermin, and copy it over, and use that
-to run libguestfs.
-
=head1 LICENSING
The fixed appliance is a complete Linux binary distro. If you
diff --git a/examples/guestfs-faq.pod b/examples/guestfs-faq.pod
index 4862f65..7e1f34d 100644
--- a/examples/guestfs-faq.pod
+++ b/examples/guestfs-faq.pod
@@ -431,7 +431,16 @@ enough supermin installed, then see the previous question.
If supermin 5 doesn't support your distro at all, you will need to use
the "fixed appliance method" where you use a pre-compiled binary
-appliance. See: L<http://libguestfs.org/download/binaries/appliance/>
+appliance. To build libguestfs without supermin, you need to pass
+C<--disable-appliance --disable-daemon> to either F<./autogen.sh> or
+F<./configure> (depending whether you are building from git or from
+tarballs). Then, when using libguestfs, you B<must> set the
+C<LIBGUESTFS_PATH> environment variable to the directory of a
+pre-compiled appliance, as also described in
+L<guestfs(3)/FIXED APPLIANCE>.
+
+For pre-compiled appliances, see also:
+L<http://libguestfs.org/download/binaries/appliance/>.
Patches to port supermin to more Linux distros are welcome.
diff --git a/src/guestfs.pod b/src/guestfs.pod
index e2ee1b5..eebab53 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -3540,6 +3540,30 @@ Finally, the child process sends asynchronous messages back to the
main program, such as kernel log messages. You can register a
callback to receive these messages.
+=head1 FIXED APPLIANCE
+
+When libguestfs (or libguestfs tools) are run, they search a path
+looking for an appliance. The path is built into libguestfs, or can
+be set using the C<LIBGUESTFS_PATH> environment variable.
+
+Normally a supermin appliance is located on this path (see
+L<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
+into a full appliance by running C<supermin --build>.
+
+However, a simpler "fixed appliance" can also be used. libguestfs
+detects this by looking for a directory on the path containing four
+files called F<kernel>, F<initrd>, F<root> and F<README.fixed> (note
+the F<README.fixed> file must be present as well).
+
+If the fixed appliance is found, libguestfs skips supermin entirely
+and just runs qemu with the kernel, initrd and root disk from the
+fixed appliance.
+
+Thus the fixed appliance can be used when a platform or Linux distro
+does not support supermin. You build the fixed appliance on a
+platform that does support supermin, and copy it over, and use that
+to run libguestfs.
+
=head1 INTERNALS
=head2 APPLIANCE BOOT PROCESS
--
2.1.0
9 years, 5 months