[PATCH] TODO: remove the implemented command blkid
by Wanlong Gao
Remove the implemented command blkid from TODO lists.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
TODO | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/TODO b/TODO
index 15660cc..3adb740 100644
--- a/TODO
+++ b/TODO
@@ -94,7 +94,6 @@ Ideas for extra commands
chattr
lsattr
badblocks
- blkid
debugfs
dumpe2fs
e2image
--
1.7.8.rc4
12 years, 11 months
[PATCH] NEW API: add blkid command to print the attributes of the device
by Wanlong Gao
A NEW API blkid.
It can print the device attributes.
Use it after list-devices, we can list ower devices and the attributes
of each device.
Use it like:
blkid <device>
It's should be a usefull function, and needed no test case for it.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
daemon/blkid.c | 75 ++++++++++++++++++++++++++++++++++++++++
generator/generator_actions.ml | 73 ++++++++++++++++++++++++++++++++++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 149 insertions(+), 1 deletions(-)
diff --git a/daemon/blkid.c b/daemon/blkid.c
index 6d395c1..a7fd6bc 100644
--- a/daemon/blkid.c
+++ b/daemon/blkid.c
@@ -83,3 +83,78 @@ do_vfs_uuid (const char *device)
{
return get_blkid_tag (device, "UUID");
}
+
+char **
+do_blkid(const char *device)
+{
+ int r;
+ char *out = NULL, *err = NULL;
+ char **lines = NULL;
+
+ char **ret = NULL;
+ int size = 0, alloc = 0;
+
+ const char *blkid[] = {"blkid", "-p", "-i", "-o", "export", device, NULL};
+ r = commandv(&out, &err, blkid);
+ if (r == -1) {
+ reply_with_error("%s", err);
+ goto error;
+ }
+
+ /* Split the command output into lines */
+ lines = split_lines(out);
+ if (lines == NULL) {
+ reply_with_perror("malloc");
+ goto error;
+ }
+
+ /* Parse the output of blkid -p -i -o export:
+ * UUID=b6d83437-c6b4-4bf0-8381-ef3fc3578590
+ * VERSION=1.0
+ * TYPE=ext2
+ * USAGE=filesystem
+ * MINIMUM_IO_SIZE=512
+ * PHYSICAL_SECTOR_SIZE=512
+ * LOGICAL_SECTOR_SIZE=512
+ * PART_ENTRY_SCHEME=dos
+ * PART_ENTRY_TYPE=0x83
+ * PART_ENTRY_NUMBER=6
+ * PART_ENTRY_OFFSET=642875153
+ * PART_ENTRY_SIZE=104857600
+ * PART_ENTRY_DISK=8:0
+ */
+ for (char **i = lines; *i != NULL; i++) {
+ char *line = *i;
+
+ /* Skip blank lines (shouldn't happen) */
+ if (line[0] == '\0') continue;
+
+ /* Split the line in 2 at the equals sign */
+ char *eq = strchr(line, '=');
+ if (eq) {
+ *eq = '\0'; eq++;
+
+ /* Add the key/value pair to the output */
+ if (add_string(&ret, &size, &alloc, line) == -1 ||
+ add_string(&ret, &size, &alloc, eq) == -1) goto error;
+ } else {
+ fprintf(stderr, "blkid: unexpected blkid output ignored: %s", line);
+ }
+ }
+
+ free(out);
+ free(err);
+ free(lines);
+
+ if (add_string(&ret, &size, &alloc, NULL) == -1) return NULL;
+
+ return ret;
+
+error:
+ free(out);
+ free(err);
+ if (lines) free(lines);
+ if (ret) free_strings(ret);
+
+ return NULL;
+}
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index 0e39e2f..d624f9b 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -6538,6 +6538,79 @@ The name of the MD device.
This command deactivates the MD array named C<md>. The
device is stopped, but it is not destroyed or zeroed.");
+ ("blkid", (RHashtable "info", [Device "device"], []), 303, [],
+ [],
+ "print block device attributes",
+ "\
+This command exposes the output of 'blkid -p -i -o export <device>'. The following
+fields are usually present in the returned hash. Other fields may also be present.
+
+C<device> should be a block device or patition, for example C</dev/sda> or C</dev/sdb1>.
+
+=over
+
+=item C<UUID>
+
+The uuid of this device.
+
+=item C<UUID_SUB>
+
+The sub uuid of this device.
+
+=item C<LABEL>
+
+The label of this device.
+
+=item C<VERSION>
+
+The version of blkid command.
+
+=item C<TYPE>
+
+The filesystem type or RAID of this device.
+
+=item C<USAGE>
+
+The usage of this device, for example C<filesystem> or C<raid>.
+
+=item C<MINIMUM_IO_SIZE>
+
+The minimum io size of this device.
+
+=item C<PHYSICAL_SECTOR_SIZE>
+
+The pyhsical sector size of this device.
+
+=item C<LOGICAL_SECTOR_SIZE>
+
+The logical sector size of this device.
+
+=item C<PART_ENTRY_SCHEME>
+
+The scheme entry of this partition(only presented when it's a partition).
+
+=item C<PART_ENTRY_TYPE>
+
+The device type of this partition(only presented when it's a partition).
+
+=item C<PART_ENTRY_NUMBER>
+
+The partition number(only presented when it's a partition).
+
+=item C<PART_ENTRY_OFFSET>
+
+This partition's offset(only presented when it's a partition).
+
+=item C<PART_ENTRY_SIZE>
+
+The size of this partition(only presented when it's a partition).
+
+=item C<PART_ENTRY_DISK>
+
+The major:minor number of this partition(only presented when it's a partition).
+
+=back");
+
]
let all_functions = non_daemon_functions @ daemon_functions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 274f714..8160622 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-302
+303
--
1.7.8.rc4
12 years, 11 months
[PATCH 1/3] build: Add more suppressions for valgrind tests
by Matthew Booth
---
extratests/suppressions | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/extratests/suppressions b/extratests/suppressions
index 97d4b78..78ca4ab 100644
--- a/extratests/suppressions
+++ b/extratests/suppressions
@@ -3,19 +3,19 @@
Memcheck:Cond
fun:*
fun:numa_node_size64
- fun:numa_init
+ obj:/usr/lib64/libnuma.so.1
}
{
libnuma_numa_node_size64_cond_2
Memcheck:Cond
fun:numa_node_size64
- fun:numa_init
+ obj:/usr/lib64/libnuma.so.1
}
{
libnuma_numa_node_size64_value8
Memcheck:Value8
fun:numa_node_size64
- fun:numa_init
+ obj:/usr/lib64/libnuma.so.1
}
{
@@ -44,7 +44,6 @@
fun:calloc
fun:add_proto_name
}
-
{
libnl1_malloc_leak
Memcheck:Leak
@@ -53,11 +52,24 @@
obj:/usr/lib/libnl.so.1.1
}
{
+ libnl1_malloc_leak_2
+ Memcheck:Leak
+ fun:malloc
+ fun:strdup
+ obj:/lib64/libnl.so.1.1
+}
+{
libnl1_calloc_leak
Memcheck:Leak
fun:calloc
obj:/usr/lib/libnl.so.1.1
}
+{
+ libnl1_calloc_leak_2
+ Memcheck:Leak
+ fun:calloc
+ obj:/lib64/libnl.so.1.1
+}
# OCaml, by design, doesn't bother to free the major heap before
# calling exit. Ignore that leak.
--
1.7.7.3
12 years, 12 months
[PATCH] mkfs: enable to make xfs filesystems when the device already has a filesystem
by Wanlong Gao
Just add the -f option to mkfs.xfs to make sure we can
make a xfs filesystem when the device already has a
filesystem on it.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
daemon/mkfs.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index f3975dc..a2c2366 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c
@@ -85,6 +85,9 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize,
if (STREQ (fstype, "jfs"))
ADD_ARG (argv, i, "-f");
+ if (STREQ (fstype, "xfs"))
+ ADD_ARG (argv, i, "-f");
+
/* For GFS, GFS2, assume a single node. */
if (STREQ (fstype, "gfs") || STREQ (fstype, "gfs2")) {
ADD_ARG (argv, i, "-p");
--
1.7.8.rc3
12 years, 12 months
[PATCH] build: Make valgrind tests append all output into a single log file
by Matthew Booth
---
extratests/Makefile.am | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/extratests/Makefile.am b/extratests/Makefile.am
index bf6b3f9..519d0b9 100644
--- a/extratests/Makefile.am
+++ b/extratests/Makefile.am
@@ -52,12 +52,16 @@
EXTRA_DIST = suppressions
+VG_FIFO=$(abs_builddir)/valgrind.fifo
+VG_LOG=$(abs_builddir)/valgrind.log
VG = valgrind \
- --log-file=$(abs_builddir)/valgrind.log \
+ --log-file=$(VG_FIFO) \
--leak-check=full \
--error-exitcode=119 \
--suppressions=$(abs_srcdir)/suppressions
-RUN_VG = $(abs_top_builddir)/run $(VG)
+RUN_VG = [ ! -p $(VG_FIFO) ] && mkfifo $(VG_FIFO); \
+ ( cat $(VG_FIFO) >> $(VG_LOG)) & \
+ $(abs_top_builddir)/run $(VG)
export LIBVIRT_DEFAULT_URI = \
qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro
--
1.7.7.3
12 years, 12 months
P2Vs seem to require a very robust Ethernet
by Greg Scott
Now that we can gather diagnostic info, I think I know why our P2Vs kept
failing last week. Another one just died right in front of my eyes. I
think either the Ethernet or NFS server at this site occasionally
"blips" offline when it gets busy and that messes up P2V migrations.
The RHEV export domain is an NFS share offered by an old Storagetek NAS,
connected over a 10/100 Ethernet. All of us would prefer a gb Ethernet
but this is what we have available.
First, an extract from /var/log/messages showing the start and end times
for virt-p2v-server, about 3 1/2 hours.
[root@Fedora16-64P2V log]# tail /var/log/messages -c 1000
16-64P2V systemd-logind[704]: Removed session 16.
Nov 22 19:04:46 Fedora16-64P2V systemd-logind[704]: New session 17 of
user root.
Nov 22 19:04:48 Fedora16-64P2V virt-v2v[1733]: p2v-server started.
Nov 22 20:01:01 Fedora16-64P2V systemd-logind[704]: New session 18 of
user root.
Nov 22 20:01:02 Fedora16-64P2V systemd-logind[704]: Removed session 18.
Nov 22 21:01:01 Fedora16-64P2V systemd-logind[704]: New session 19 of
user root.
Nov 22 21:01:01 Fedora16-64P2V systemd-logind[704]: Removed session 19.
Nov 22 22:01:02 Fedora16-64P2V systemd-logind[704]: New session 20 of
user root.
Nov 22 22:01:02 Fedora16-64P2V systemd-logind[704]: Removed session 20.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: FATAL: Error receiving
data:
Nov 22 22:33:44 Fedora16-64P2V systemd-logind[704]: Removed session 17.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: WARNING: Error messages
were written to /var/log/virt-p2v-server.1322010288.log.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: p2v-server exited.
[root@Fedora16-64P2V log]#
Next, the output from the trace log file from virt-p2v-server:
[root@Fedora16-64P2V log]# more virt-p2v-server.1322010288.log
virt-v2v: Error receiving data:
[root@Fedora16-64P2V log]#
Before it blew up, I was watching network usage of my RHEV host with the
Fedora migration server VM and it consistently pegged above 90%+. I've
never seen an Ethernet that saturated before. The iftop utility on my
Fedora guest migration server showed data consistently flying at 69-90+
Mb per second.
- Greg Scott
12 years, 12 months
[PATCH] libguestfs: Added gnulib includes from builddir, as suggested by the Gnulib documentation
by Hilko Bengen
Since some modules (`getopt', for example) may copy files
into the build directory, `top_builddir/lib' is needed as well as
`top_srcdir/lib'. -- GNU Gnulib manual, section 2.2 Initial import
---
capitests/Makefile.am | 1 +
daemon/Makefile.am | 2 +-
src/Makefile.am | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/capitests/Makefile.am b/capitests/Makefile.am
index cb9188e..d32b7fc 100644
--- a/capitests/Makefile.am
+++ b/capitests/Makefile.am
@@ -129,6 +129,7 @@ test_debug_to_file_SOURCES = test-debug-to-file.c
test_debug_to_file_CFLAGS = \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
test_debug_to_file_LDADD = \
$(top_builddir)/src/libguestfs.la \
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index c4a30bc..71d6a63 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -176,7 +176,7 @@ guestfsd_LDADD = \
$(LIBINTL) \
$(SERVENT_LIB)
-guestfsd_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
+guestfsd_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
.PHONY: force
diff --git a/src/Makefile.am b/src/Makefile.am
index 761fcb6..82a4004 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -165,7 +165,7 @@ libguestfs_la_CFLAGS = \
$(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
-libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
+libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
if HAVE_RPCGEN
guestfs_protocol.c: guestfs_protocol.x
--
1.7.7.3
12 years, 12 months
[PATCH] hivex: Added gnulib includes from builddir, as suggested by the Gnulib documentation; link hivexml against libgnu.
by Hilko Bengen
Since some modules (`getopt', for example) may copy files
into the build directory, `top_builddir/lib' is needed as well as
`top_srcdir/lib'. -- GNU Gnulib manual, section 2.2 Initial import
This fixes an in-tree build failure on a Debian/sid system (see
below). hivexml could be built out-of-tree, but it turned out that due
to a missing include path, in this case the system's getopt
implementation was used insted of Gnulib's.
make[2]: Entering directory `«SRCDIR»/xml'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DLOCALEBASEDIR=\""/usr/local/share/locale"\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -MT hivexml-hivexml.o -MD -MP -MF .deps/hivexml-hivexml.Tpo -c -o hivexml-hivexml.o `test -f 'hivexml.c' || echo './'`hivexml.c
mv -f .deps/hivexml-hivexml.Tpo .deps/hivexml-hivexml.Po
/bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -DLOCALEBASEDIR=\""/usr/local/share/locale"\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -o hivexml hivexml-hivexml.o ../lib/libhivex.la -lxml2
libtool: link: gcc -std=gnu99 -DLOCALEBASEDIR=\"/usr/local/share/locale\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -o .libs/hivexml hivexml-hivexml.o ../lib/.libs/libhivex.so /usr/lib/libxml2.so
hivexml-hivexml.o: In function `main':
«SRCDIR»/xml/hivexml.c:96: undefined reference to `rpl_getopt'
«SRCDIR»/xml/hivexml.c:110: undefined reference to `rpl_optind'
«SRCDIR»/xml/hivexml.c:154: undefined reference to `rpl_optind'
collect2: ld returned 1 exit status
make[2]: *** [hivexml] Error 1
make[2]: Leaving directory `«SRCDIR»/xml'
---
lib/Makefile.am | 5 ++++-
sh/Makefile.am | 1 +
xml/Makefile.am | 3 ++-
xml/hivexml.c | 2 ++
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index cfd2e05..a339a00 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -39,7 +39,10 @@ libhivex_la_LDFLAGS = \
$(LTLIBINTL) \
$(LTLIBTHREAD)
libhivex_la_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(srcdir)
+libhivex_la_CPPFLAGS = \
+ -I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
+ -I$(srcdir)
include_HEADERS = hivex.h
diff --git a/sh/Makefile.am b/sh/Makefile.am
index 0898370..a6f5ae6 100644
--- a/sh/Makefile.am
+++ b/sh/Makefile.am
@@ -38,6 +38,7 @@ hivexsh_SOURCES = \
hivexsh_LDADD = ../lib/libhivex.la ../gnulib/lib/libgnu.la $(LIBREADLINE)
hivexsh_CFLAGS = \
-I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/xml/Makefile.am b/xml/Makefile.am
index b2af45d..67ba248 100644
--- a/xml/Makefile.am
+++ b/xml/Makefile.am
@@ -23,10 +23,11 @@ bin_PROGRAMS = hivexml
hivexml_SOURCES = \
hivexml.c
-hivexml_LDADD = ../lib/libhivex.la $(LIBXML2_LIBS)
+hivexml_LDADD = ../lib/libhivex.la ../gnulib/lib/libgnu.la $(LIBXML2_LIBS)
hivexml_CFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib \
$(LIBXML2_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/xml/hivexml.c b/xml/hivexml.c
index 5030c24..d38e9d4 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -32,6 +32,8 @@
#include <libintl.h>
#endif
+#include <getopt.h>
+
#include <libxml/xmlwriter.h>
#include "hivex.h"
--
1.7.7.3
12 years, 12 months