[PATCHv3 0/2] Introduce vfs_min_size API to get minimum filesystem size.
by Maxim Perevedentsev
Tried to make it in accordance with your comments.
Difference to v1:
Added reply_with_error where necessary.
Changed name get_min_size -> vfs_min_size.
Difference to v2:
Changed name to vfs_minimum_size.
Changed parsing to xstrtol + STR* macros where possible.
Maxim Perevedentsev (2):
New API: vfs_min_size
Include resize2fs_P into vfs_min_size.
daemon/Makefile.am | 1 +
daemon/daemon.h | 2 ++
daemon/ext2.c | 62 ++++++++++++++++++++++++++++++++-----
daemon/fs-min-size.c | 49 +++++++++++++++++++++++++++++
daemon/ntfs.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 19 ++++++++----
po/POTFILES | 1 +
7 files changed, 207 insertions(+), 14 deletions(-)
create mode 100644 daemon/fs-min-size.c
--
1.8.3.1
9 years
[PATCHv3 0/2] Introduce vfs_min_size API to get minimum filesystem size.
by Maxim Perevedentsev
Tried to make it in accordance with your comments.
Difference to v1:
Added reply_with_error where necessary.
Changed name get_min_size -> vfs_min_size.
Difference to v2:
Changed name to vfs_minimum_size.
Changed parsing to xstrtol + STR* macros where possible.
Maxim Perevedentsev (2):
New API: vfs_min_size
Include resize2fs_P into vfs_min_size.
daemon/Makefile.am | 1 +
daemon/daemon.h | 2 ++
daemon/ext2.c | 62 ++++++++++++++++++++++++++++++++-----
daemon/fs-min-size.c | 49 +++++++++++++++++++++++++++++
daemon/ntfs.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 19 ++++++++----
po/POTFILES | 1 +
7 files changed, 207 insertions(+), 14 deletions(-)
create mode 100644 daemon/fs-min-size.c
--
1.8.3.1
9 years
[PATCHv2 0/2] Introduce vfs_min_size API to get minimum filesystem size.
by Maxim Perevedentsev
Tried to make it in accordance with your comments.
Difference to v1:
Added reply_with_error where necessary.
Changed name get_min_size -> vfs_min_size.
Maxim Perevedentsev (2):
New API: vfs_min_size
Include resize2fs_P into vfs_min_size.
daemon/Makefile.am | 1 +
daemon/daemon.h | 2 ++
daemon/ext2.c | 45 ++++++++++++++++++++++++++-----
daemon/fs-min-size.c | 49 ++++++++++++++++++++++++++++++++++
daemon/ntfs.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 16 ++++++-----
po/POTFILES | 1 +
7 files changed, 177 insertions(+), 12 deletions(-)
create mode 100644 daemon/fs-min-size.c
--
1.8.3.1
9 years
[PATCH] Add a regression test for RHBZ#1011907 / RHBZ#1165785
by Pino Toscano
Test case adapted from Hu Zhang's RHBZ#1242853, thanks.
---
tests/regressions/Makefile.am | 2 +
tests/regressions/rhbz1011907-1165785.sh | 66 ++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
create mode 100755 tests/regressions/rhbz1011907-1165785.sh
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index c4f60ae..026987b 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -37,6 +37,7 @@ EXTRA_DIST = \
rhbz957772.sh \
rhbz975797.sh \
rhbz1001875.sh \
+ rhbz1011907-1165785.sh \
rhbz1044014.sh \
rhbz1044014.in \
rhbz1044014.xml \
@@ -69,6 +70,7 @@ TESTS = \
rhbz1054761.sh \
rhbz1055452 \
rhbz1091803.sh \
+ rhbz1011907-1165785.sh \
rhbz1175196.sh \
rhbz1232192.sh \
test-big-heap \
diff --git a/tests/regressions/rhbz1011907-1165785.sh b/tests/regressions/rhbz1011907-1165785.sh
new file mode 100755
index 0000000..f45ae3c
--- /dev/null
+++ b/tests/regressions/rhbz1011907-1165785.sh
@@ -0,0 +1,66 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Regression test for:
+# https://bugzilla.redhat.com/show_bug.cgi?id=1011907
+# https://bugzilla.redhat.com/show_bug.cgi?id=1165785
+# i.e., mount-loop option, which means correct startup sequence and creation
+# of base devices (like /dev/loop-control for loopback setup)
+
+set -e
+export LANG=C
+
+if [ -n "$SKIP_TEST_RHBZ1011907_1165785_SH" ]; then
+ echo "$0: test skipped because environment variable is set."
+ exit 77
+fi
+
+rm -f rhbz1011907-1165785-loop.img rhbz1011907-1165785.img
+
+qemu-img create rhbz1011907-1165785-loop.img 100M
+qemu-img create rhbz1011907-1165785.img 300M
+
+guestfish -a rhbz1011907-1165785-loop.img <<EOF
+run
+part-disk /dev/sda mbr
+mkfs ext3 /dev/sda
+mount /dev/sda /
+touch /in-loop
+EOF
+
+output=$(
+guestfish -a rhbz1011907-1165785.img <<EOF
+run
+part-disk /dev/sda mbr
+mkfs ext3 /dev/sda1
+mount /dev/sda1 /
+upload rhbz1011907-1165785-loop.img /rhbz1011907-1165785-loop.img
+mkmountpoint /loop
+mount-loop /rhbz1011907-1165785-loop.img /loop/
+is-file /loop/in-loop
+EOF
+)
+
+if [ "$output" != \
+"true" ]; then
+ echo "$0: error: output of guestfish did not match expected output"
+ echo "$output"
+ exit 1
+fi
+
+rm rhbz1011907-1165785-loop.img rhbz1011907-1165785.img
--
2.1.0
9 years
virt-v2v : Import from vsphere 4
by Kevin COUSIN
Hi list,
Is it possible to import VM from vSphere 4 with virt-v2v ? I use the p2v ISO but I want to automate process.
Thanks a lot
------------------------
COUSIN Kevin
9 years
[Error] guestfsd: /usr/lib/libaugeas.so.0: version `AUGEAS_0.16.0' not found (required by guestfsd)
by Efstratios Skleparis
Dear all,
After successfully compiling libguestfs on XEN hypervisor [running
ubuntu server 12.04 x64bit] i tried to ./run libguestfs-test-tool but I
got this error:
guestfsd: /usr/lib/libaugeas.so.0: version `AUGEAS_0.16.0' not found
(required by guestfsd)
But I have already installed AUGEAS tool.. if I type on terminal for
example augtool it works
Please check the attached .txt file with whole libguestfs-test-tool ouput.
Thanks in advance.
9 years
guestfsd: /usr/lib/libaugeas.so.0: version `AUGEAS_0.16.0' not found (required by guestfsd)
by Efstratios Skleparis
Dear all,
After successfully compiling libguestfs on XEN hypervisor [running ubuntu
server 12.04 x64bit] i tried to ./run libguestfs-test-tool but I got this
error:
guestfsd: /usr/lib/libaugeas.so.0: version `AUGEAS_0.16.0' not found
(required by guestfsd)
But I have already installed AUGEAS tool.. if I type on terminal for
example augtool it works
Please check the attached .txt file with whole libguestfs-test-tool ouput.
Thanks in advance.
Efstratios
9 years
[PATCH 0/2] Introduce get_min_size API to get minimum filesystem size.
by Maxim Perevedentsev
Tried to make it in accordance with your comments.
Maybe you can suggest a better name for API?
Maxim Perevedentsev (2):
New API: get_min_size
Include resize2fs_P into get_min_size.
daemon/Makefile.am | 1 +
daemon/daemon.h | 2 ++
daemon/ext2.c | 37 ++++++++++++++++++++++++----
daemon/fs-min-size.c | 49 +++++++++++++++++++++++++++++++++++++
daemon/ntfs.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 15 +++++++-----
po/POTFILES | 1 +
7 files changed, 162 insertions(+), 11 deletions(-)
create mode 100644 daemon/fs-min-size.c
--
1.8.3.1
9 years
[PATCH v6 0/2] RFE: journal reader in guestfish
by Maros Zatko
Output is configurable, it's the same format as virt-log has, since both
uses same code.
First patch moves get_journal_field around and renames it to journal_view
and the next one reimplements it a bit and brings it to guestfish.
Maros Zatko (2):
cat: move get_journal_field to fish/journal.c
fish: add journal-view command (RHBZ#988100)
.gnulib | 2 +-
cat/Makefile.am | 1 +
cat/log.c | 114 +---------------------------------
fish/Makefile.am | 1 +
fish/journal.c | 151 +++++++++++++++++++++++++++++++++++++++++++++
fish/journal.h | 26 ++++++++
generator/Makefile.am | 6 +-
generator/actions.ml | 36 +++++++++++
generator/journalfields.ml | 87 ++++++++++++++++++++++++++
generator/main.ml | 3 +
po/POTFILES | 1 +
src/guestfs-internal.h | 5 ++
src/proto.c | 14 +++++
13 files changed, 333 insertions(+), 114 deletions(-)
create mode 100644 fish/journal.c
create mode 100644 fish/journal.h
create mode 100644 generator/journalfields.ml
--
1.9.3
9 years
[PATCH] New API: ntfsresize_info
by Maxim Perevedentsev
Get minimum size of NTFS filesystem in bytes. This is used primarily for shrinking images.
In case of a full images ntfsresize returns error code and does not print minimum size.
So we calculate it manually by rounding 'volume size' up to 'cluster size'.
---
daemon/ntfs.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 17 +++++++++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 1ead159..f0a8c3b 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -153,6 +153,74 @@ do_ntfsresize_size (const char *device, int64_t size)
return do_ntfsresize (device, size, 0);
}
+int64_t
+do_ntfsresize_info (const char *device)
+{
+ CLEANUP_FREE char *err = NULL, *out = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
+ int r;
+ size_t i;
+ char *p;
+ int64_t ret, volume_size = 0;
+ const char *size_pattern = "You might resize at ",
+ *full_pattern = "Volume is full",
+ *cluster_size_pattern = "Cluster size",
+ *volume_size_pattern = "Current volume size:";
+ int is_full = 0;
+ int32_t cluster_size = 0;
+
+ /* FS may be marked for check, so force ntfsresize */
+ r = command (&out, &err, str_ntfsresize, "--info", "-ff", device, NULL);
+
+ lines = split_lines (out);
+ if (lines == NULL)
+ return -1;
+
+ if (verbose) {
+ for (i = 0; lines[i] != NULL; ++i)
+ fprintf (stderr, "ntfsresize_info: lines[%zu] = \"%s\"\n", i, lines[i]);
+ }
+
+ if (r == -1) {
+ /* If volume is full, ntfsresize returns error. */
+ for (i = 0; lines[i] != NULL; ++i) {
+ if (strstr (lines[i], full_pattern))
+ is_full = 1;
+ else if ((p = strstr (lines[i], cluster_size_pattern))) {
+ if (sscanf (p + strlen(cluster_size_pattern),
+ "%*[ ]:%" SCNd32, &cluster_size) != 1)
+ return -1;
+ }
+ else if ((p = strstr (lines[i], volume_size_pattern))) {
+ if (sscanf (p + strlen(volume_size_pattern),
+ "%" SCNd64, &volume_size) != 1)
+ return -1;
+ }
+ }
+ if (is_full) {
+ /* Ceil to cluster size */
+ if (cluster_size == 0) {
+ reply_with_error("%s", "Bad cluster size");
+ return -1;
+ }
+ return (volume_size + cluster_size - 1) / cluster_size * cluster_size;
+ }
+
+ reply_with_error ("%s", err);
+ return -1;
+ }
+
+ for (i = 0; lines[i] != NULL; ++i) {
+ if ((p = strstr (lines[i], size_pattern))) {
+ if (sscanf (p + strlen(size_pattern), "%" SCNd64, &ret) != 1)
+ return -1;
+ return ret;
+ }
+ }
+
+ return -1;
+}
+
/* Takes optional arguments, consult optargs_bitmask. */
int
do_ntfsfix (const char *device, int clearbadsectors)
diff --git a/generator/actions.ml b/generator/actions.ml
index 274ef3f..ede6278 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12765,6 +12765,23 @@ Get the estimated minimum filesystem size of an ext2/3/4 filesystem in blocks.
See also L<resize2fs(8)>." };
+ { defaults with
+ name = "ntfsresize_info"; added = (1, 31, 17);
+ style = RInt64 "sizeinbytes", [Device "device"], [];
+ proc_nr = Some 458;
+ tests = [
+ InitPartition, Always, TestRun(
+ [["mkfs"; "ntfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
+ ["ntfsresize_info"; "/dev/sda1"]]), [];
+ ];
+ shortdesc = "get minimum NTFS filesystem size";
+ longdesc = "\
+Get the minimum size of NTFS filesystem in bytes.
+
+This number is expected to be safely passed as C<guestfs_ntfsresize> command parameter.
+
+See also L<ntfsresize(8)>." };
+
]
(* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index de2a00c..c92ddb6 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-457
+458
--
1.8.3.1
9 years