[PATCH 0/2] Improve OVA manifest parsing
by Tomáš Golembiovský
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
Tomáš Golembiovský (2):
v2v: ova: fix checking of the manifest file
v2v: ova: support SHA256 hashes in manifest
v2v/input_ova.ml | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
--
2.10.0
8 years, 1 month
[PATCH] daemon: Choose /usr/sbin first for the daemon (debian bug 838995).
by Richard W.M. Jones
Debian is also doing a UsrMove/UsrMerge:
https://wiki.debian.org/UsrMerge
However it is not finalized that Debian will actually make this
change.
Since some Debian systems have /sbin as a symlink and other have /sbin
as a real directory, and we should avoid choosing a symlinked
directory for the daemon, the easiest fix is simply to probe /usr/sbin
before /sbin since under all scenarios (and Fedora too) /usr/sbin is a
real directory.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838995
---
m4/guestfs_daemon.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/guestfs_daemon.m4 b/m4/guestfs_daemon.m4
index 192583b..12123df 100644
--- a/m4/guestfs_daemon.m4
+++ b/m4/guestfs_daemon.m4
@@ -42,7 +42,7 @@ if test "x$enable_daemon" = "xyes"; then
dnl install directory for libguestfs live. Since Fedora 17
dnl /sbin is a symlink to /usr/sbin. We have to put the
dnl daemon into a real (non-symlink) directory.
- dirs="/sbin /usr/sbin /bin /usr/bin"
+ dirs="/usr/sbin /sbin /usr/bin /bin"
AC_MSG_CHECKING([which of $dirs is a real directory])
for dir in $dirs; do
parent=`dirname $dir`
--
2.9.3
8 years, 1 month
[PATCH v2 0/7] v2v: first bits of Debian/Ubuntu guests supports
by Pino Toscano
Hi,
this series implements the first bits in v2v to convert Debian/Ubuntu
(and derived) guests. The series does not complete the support (see
known issues below), but all the patches here should be fit for review
and inclusion. The series does not enable the conversion, yet.
Known issues:
* there is no grubby nor Bootloader::Tools Perl module available in
Debian, so there is no way to know what is the default kernel;
parsing the Grub2 configuration is not exactly an easy task either
* currently tested with simple local guest images, hence needs testing
with real guests on libvirt/VMware/Xen/VirtualBox/etc (which have
various tools to be removed/tweaked)
* is tweaking the "enterprise-linux" module the correct/wanted way?
should it be renamed to just "linux" then?
* surely something else I'm missing
Changes from v1:
- rebased on master
- dropped patch #8, will be solved in a different way
- adapted patch #4 to the Linux_bootloaders module
Thanks,
Pino Toscano (7):
v2v: refactor Linux.remove
v2v: add basic support for the "deb" package manager
v2v: linux: identify Debian-based distros as `Debian_family
v2v: add /boot/grub/grub.cfg as Grub2 config
v2v: linux: check also kernel config for modules
v2v: linux: check the kernel package name for Debian
v2v: linux: adapt initrd name for Debian
v2v/convert_linux.ml | 34 ++++++++++++++++++++++----
v2v/linux.ml | 62 ++++++++++++++++++++++++++++++++++++++----------
v2v/linux_bootloaders.ml | 1 +
3 files changed, 79 insertions(+), 18 deletions(-)
--
2.7.4
8 years, 1 month
[PATCH] fish: drop leading '/' in nbd paths (RHBZ#1379585)
by Pino Toscano
When parsing the URI, drop the leading '/' from the path also when the
protocol is 'nbd': in this case, the path represents the export name,
which does not need the '/' coming from the URI format.
Improve the coverage for nbd in test-add-uri.sh, adding a couple of
tests, and adjusting the result of an existing one.
---
fish/test-add-uri.sh | 8 +++++++-
fish/uri.c | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
index 07b68c4..0264829 100755
--- a/fish/test-add-uri.sh
+++ b/fish/test-add-uri.sh
@@ -49,14 +49,20 @@ grep -sq 'add_drive "disk" "protocol:gluster" "server:tcp:example.com"' test-add
$VG guestfish -x -a nbd://example.com </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
+$VG guestfish -x -a nbd://example.com/export </dev/null >test-add-uri.out 2>&1
+grep -sq 'add_drive "export" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
+
$VG guestfish -x -a nbd://example.com:3000 </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com:3000"' test-add-uri.out || fail
+$VG guestfish -x -a nbd://example.com:3000/export </dev/null >test-add-uri.out 2>&1
+grep -sq 'add_drive "export" "protocol:nbd" "server:tcp:example.com:3000"' test-add-uri.out || fail
+
$VG guestfish -x -a 'nbd://?socket=/sk' </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
$VG guestfish -x -a 'nbd:///export?socket=/sk' </dev/null >test-add-uri.out 2>&1
-grep -sq 'add_drive "/export" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
+grep -sq 'add_drive "export" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
# rbd
$VG guestfish -x -a rbd://example.com:6789/pool/disk </dev/null >test-add-uri.out 2>&1
diff --git a/fish/uri.c b/fish/uri.c
index ae30bce..4ae34af 100644
--- a/fish/uri.c
+++ b/fish/uri.c
@@ -194,6 +194,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
if (path && path[0] == '/' &&
(STREQ (uri->scheme, "gluster") ||
STREQ (uri->scheme, "iscsi") ||
+ STREQ (uri->scheme, "nbd") ||
STREQ (uri->scheme, "rbd") ||
STREQ (uri->scheme, "sheepdog")))
path++;
--
2.7.4
8 years, 1 month
Re: [Libguestfs] [Nbd] Testing NBD server implementations for correctness
by Carl-Daniel Hailfinger
Hi,
On 26.09.2016 09:53, Wouter Verhelst wrote:
> On Mon, Sep 26, 2016 at 03:22:52AM +0200, Carl-Daniel Hailfinger wrote:
>> Running nbd-tester-client against nbdkit with oldstyle negotiation was fun.
>> I managed to segfault nbdkit
Side note: I'm going to try and get a backtrace from the nbdkit segfault
and submit a bug report there.
>> and noticed that nbd-tester-client speaks
>> the oldstyle protocol incorrectly, ignoring flags sent by the server.
>> Patch follows.
> Whoops.
>
> Honestly though, the oldstyle protocol shouldn't be used anymore, but
> yeah, I know there are still implementations out in the wild that do
> (and there isn't much I can do to fix that, other than discouraging).
Well, nbdkit supports both, and the protocol style has to be specified
on the command line. I just happened to leave out the switch telling
nbdkit to use newstyle protocol. Admittedly nbdkit also has some
implementation bugs in oldstyle negotiation, but they cancel each other
out internally.
Lots of documentation out there does not mention that the oldstyle
protocol should not be used, and I fear most of that documentation
hasn't been touched in years, so changing it would be impractical.
Maybe it would make sense to have nbdkit print some diagnostics that
it's using the (default) oldstyle protocol?
> In
> that light, I guess it does make sense to fix bugs in the test client,
> even if we won't be using it ourselves.
Thanks.
>> diff -r e691aad45ed2 tests/run/nbd-tester-client.c
>> --- a/tests/run/nbd-tester-client.c Thu Sep 15 13:25:47 2016 +0100
>> +++ b/tests/run/nbd-tester-client.c Mon Sep 26 03:18:26 2016 +0200
>> @@ -384,7 +384,12 @@
>> READ_ALL_ERRCHK(sock, &size, sizeof(size), err,
>> "Could not read size: %s", strerror(errno));
>> size = ntohll(size);
>> - READ_ALL_ERRCHK(sock, buf, 128, err, "Could not read data: %s",
>> + uint32_t flags;
>> + READ_ALL_ERRCHK(sock, &flags, sizeof(uint32_t), err,
>> + "Could not read flags: %s", strerror(errno));
>> + flags = ntohl(flags);
>> + *serverflags = flags;
>> + READ_ALL_ERRCHK(sock, buf, 124, err, "Could not read data: %s",
>> strerror(errno));
>> goto end;
>> }
>>
>>
>> Without this patch, oldstyle connections of nbd-tester-client to any
>> server will cause the message "Server did not supply flush capability
>> flags" if flush is requested by nbd-tester-client, even if it is
>> supported by the server.
> Thanks, applied.
Wow, that was quick! Thank you.
I stumbled upon another problem: Apparently nbd-tester-client and nbdkit
disagree on what constitutes a valid flush request.
nbd-tester-client complains:
./flush
15901: Requests: 3536
** (process:15901): WARNING **: Could not run test: Received error from
server: 22 (0x16). Handle is -9223372036854764544 (0x8000000000002C00).
nbdkit complains:
nbdkit: python[7]: error: invalid flush request: expecting offset and
length == 0
Not sure where that bug is, nbdkit or nbd-tester-client.
- Is the request correct and should have been accepted?
- Is the reject correct, but the response is screwed up?
Regards,
Carl-Daniel
8 years, 2 months
[PATCH] Improve memory management of nbdkit python plugin example
by Carl-Daniel Hailfinger
Hi,
the nbdkit python plugin example has suboptimal memory management:
- it creates the disk image as a string on init
- it casts the string to bytearray on every read
- it copies the string before and the string after the written region,
then reassembles those pieces together with the written region to a new
disk image string
This is not a problem as long as the image is small, but in my tests
with a 5 GB sized image nbdkit already used 15 GB RAM directly after
startup, and even more (20-25 GB) on the first write.
This changes the code to use bytearray everywhere and use the proper
methods to change bytearray objects directly. With the patch applied,
nbdkit with a 5 GB image will still only use 5 GB RAM even during heavy
read/write activity.
Regards,
Carl-Daniel
diff -r 521366d1854b -r d7d5078d08c7 plugins/python/example.py
--- a/plugins/python/example.py Sun Jul 10 17:10:30 2016 +0100
+++ b/plugins/python/example.py Sun Sep 25 05:04:02 2016 +0200
@@ -29,7 +29,7 @@
# reconnect to the same server you should see the same disk. You
# could also put this into the handle, so there would be a fresh disk
# per handle.
-disk = "\0" * (1024*1024);
+disk = bytearray(1024 * 1024)
# This just prints the extra command line parameters, but real plugins
# should parse them and reject any unknown parameters.
@@ -50,9 +50,9 @@
def pread(h, count, offset):
global disk
- return bytearray (disk[offset:offset+count])
+ return disk[offset:offset+count]
def pwrite(h, buf, offset):
global disk
end = offset + len (buf)
- disk = disk[:offset] + buf + disk[end:]
+ disk[offset:end] = buf
8 years, 2 months
[PATCH] nbdkit: Talk about Python in the Python plugin
by Carl-Daniel Hailfinger
diff -r 3decebe747cb -r fc247aa26d12 plugins/python/python.c
--- a/plugins/python/python.c Sat Sep 24 14:46:25 2016 +0200
+++ b/plugins/python/python.c Sat Sep 24 15:03:05 2016 +0200
@@ -437,7 +437,7 @@
Py_DECREF (r);
return ret;
}
- /* No Perl can_write callback, but there's a Perl pwrite callback
+ /* No Python can_write callback, but there's a Python pwrite callback
* defined, so return 1. (In C modules, nbdkit would do this).
*/
else if (callback_defined ("pwrite", NULL))
@@ -470,7 +470,7 @@
Py_DECREF (r);
return ret;
}
- /* No Perl can_flush callback, but there's a Perl flush callback
+ /* No Python can_flush callback, but there's a Python flush callback
* defined, so return 1. (In C modules, nbdkit would do this).
*/
else if (callback_defined ("flush", NULL))
@@ -531,7 +531,7 @@
Py_DECREF (r);
return ret;
}
- /* No Perl can_trim callback, but there's a Perl trim callback
+ /* No Python can_trim callback, but there's a Python trim callback
* defined, so return 1. (In C modules, nbdkit would do this).
*/
else if (callback_defined ("trim", NULL))
8 years, 2 months
[PATCH] p2v: add mnemonics to labels and buttons (RHBZ#1379289)
by Pino Toscano
Set mnemonics for all the labels with a text entry or combo box next to
them, and for all the buttons, and check boxes.
---
p2v/gui.c | 56 ++++++++++++++++++++++++++++++++++----------------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/p2v/gui.c b/p2v/gui.c
index 36bb655..dee8b83 100644
--- a/p2v/gui.c
+++ b/p2v/gui.c
@@ -285,13 +285,14 @@ create_connection_dialog (struct config *config)
set_padding (intro, 10, 10);
table_new (table, 5, 2);
- server_label = gtk_label_new (_("Conversion server:"));
+ server_label = gtk_label_new_with_mnemonic (_("Conversion _server:"));
table_attach (table, server_label,
0, 1, 0, 1, GTK_FILL, GTK_FILL, 4, 4);
set_alignment (server_label, 1., 0.5);
hbox_new (server_hbox, FALSE, 4);
server_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (server_label), server_entry);
if (config->server != NULL)
gtk_entry_set_text (GTK_ENTRY (server_entry), config->server);
port_colon_label = gtk_label_new (":");
@@ -305,11 +306,12 @@ create_connection_dialog (struct config *config)
table_attach (table, server_hbox,
1, 2, 0, 1, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
- username_label = gtk_label_new (_("User name:"));
+ username_label = gtk_label_new_with_mnemonic (_("_User name:"));
table_attach (table, username_label,
0, 1, 1, 2, GTK_FILL, GTK_FILL, 4, 4);
set_alignment (username_label, 1., 0.5);
username_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (username_label), username_entry);
if (config->username != NULL)
gtk_entry_set_text (GTK_ENTRY (username_entry), config->username);
else
@@ -317,11 +319,12 @@ create_connection_dialog (struct config *config)
table_attach (table, username_entry,
1, 2, 1, 2, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
- password_label = gtk_label_new (_("Password:"));
+ password_label = gtk_label_new_with_mnemonic (_("_Password:"));
table_attach (table, password_label,
0, 1, 2, 3, GTK_FILL, GTK_FILL, 4, 4);
set_alignment (password_label, 1., 0.5);
password_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (password_label), password_entry);
gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE);
#ifdef GTK_INPUT_PURPOSE_PASSWORD
gtk_entry_set_input_purpose (GTK_ENTRY (password_entry),
@@ -332,25 +335,26 @@ create_connection_dialog (struct config *config)
table_attach (table, password_entry,
1, 2, 2, 3, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
- identity_label = gtk_label_new (_("SSH Identity URL:"));
+ identity_label = gtk_label_new_with_mnemonic (_("SSH _Identity URL:"));
table_attach (table, identity_label,
0, 1, 3, 4, GTK_FILL, GTK_FILL, 4, 4);
set_alignment (identity_label, 1., 0.5);
identity_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (identity_label), identity_entry);
if (config->identity_url != NULL)
gtk_entry_set_text (GTK_ENTRY (identity_entry), config->identity_url);
table_attach (table, identity_entry,
1, 2, 3, 4, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
sudo_button =
- gtk_check_button_new_with_label (_("Use sudo when running virt-v2v"));
+ gtk_check_button_new_with_mnemonic (_("Use su_do when running virt-v2v"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sudo_button),
config->sudo);
table_attach (table, sudo_button,
1, 2, 4, 5, GTK_FILL, GTK_FILL, 4, 4);
hbox_new (test_hbox, FALSE, 0);
- test = gtk_button_new_with_label (_("Test connection"));
+ test = gtk_button_new_with_mnemonic (_("_Test connection"));
gtk_box_pack_start (GTK_BOX (test_hbox), test, TRUE, FALSE, 0);
hbox_new (spinner_hbox, FALSE, 10);
@@ -376,10 +380,10 @@ create_connection_dialog (struct config *config)
/* Buttons. */
gtk_dialog_add_buttons (GTK_DIALOG (conn_dlg),
- _("Configure network ..."), 1,
- _("XTerm ..."), 2,
- _("About virt-p2v " PACKAGE_VERSION " ..."), 3,
- _("Next"), 4,
+ _("_Configure network ..."), 1,
+ _("_XTerm ..."), 2,
+ _("_About virt-p2v " PACKAGE_VERSION " ..."), 3,
+ _("_Next"), 4,
NULL);
next_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 4);
@@ -786,21 +790,23 @@ create_conversion_dialog (struct config *config)
vbox_new (target_vbox, FALSE, 1);
table_new (target_tbl, 3, 3);
- guestname_label = gtk_label_new (_("Name:"));
+ guestname_label = gtk_label_new_with_mnemonic (_("_Name:"));
table_attach (target_tbl, guestname_label,
0, 1, 0, 1, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (guestname_label, 1., 0.5);
guestname_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (guestname_label), guestname_entry);
if (config->guestname != NULL)
gtk_entry_set_text (GTK_ENTRY (guestname_entry), config->guestname);
table_attach (target_tbl, guestname_entry,
1, 2, 0, 1, GTK_FILL, GTK_FILL, 1, 1);
- vcpus_label = gtk_label_new (_("# vCPUs:"));
+ vcpus_label = gtk_label_new_with_mnemonic (_("# _vCPUs:"));
table_attach (target_tbl, vcpus_label,
0, 1, 1, 2, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (vcpus_label, 1., 0.5);
vcpus_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (vcpus_label), vcpus_entry);
snprintf (vcpus_str, sizeof vcpus_str, "%d", config->vcpus);
gtk_entry_set_text (GTK_ENTRY (vcpus_entry), vcpus_str);
table_attach (target_tbl, vcpus_entry,
@@ -810,11 +816,12 @@ create_conversion_dialog (struct config *config)
table_attach (target_tbl, vcpus_warning,
2, 3, 1, 2, 0, 0, 1, 1);
- memory_label = gtk_label_new (_("Memory (MB):"));
+ memory_label = gtk_label_new_with_mnemonic (_("_Memory (MB):"));
table_attach (target_tbl, memory_label,
0, 1, 2, 3, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (memory_label, 1., 0.5);
memory_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (memory_label), memory_entry);
snprintf (memory_str, sizeof memory_str, "%" PRIu64,
config->memory / 1024 / 1024);
gtk_entry_set_text (GTK_ENTRY (memory_entry), memory_str);
@@ -842,54 +849,59 @@ create_conversion_dialog (struct config *config)
vbox_new (output_vbox, FALSE, 1);
table_new (output_tbl, 5, 2);
- o_label = gtk_label_new (_("Output to (-o):"));
+ o_label = gtk_label_new_with_mnemonic (_("Output _to (-o):"));
table_attach (output_tbl, o_label,
0, 1, 0, 1, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (o_label, 1., 0.5);
o_combo = gtk_combo_box_text_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (o_label), o_combo);
gtk_widget_set_tooltip_markup (o_combo, _("<b>libvirt</b> means send the converted guest to libvirt-managed KVM on the conversion server. <b>local</b> means put it in a directory on the conversion server. <b>rhev</b> means write it to RHEV-M/oVirt. <b>glance</b> means write it to OpenStack Glance. See the virt-v2v(1) manual page for more information about output options."));
repopulate_output_combo (config);
table_attach (output_tbl, o_combo,
1, 2, 0, 1, GTK_FILL, GTK_FILL, 1, 1);
- oc_label = gtk_label_new (_("Output conn. (-oc):"));
+ oc_label = gtk_label_new_with_mnemonic (_("Output _conn. (-oc):"));
table_attach (output_tbl, oc_label,
0, 1, 1, 2, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (oc_label, 1., 0.5);
oc_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (oc_label), oc_entry);
gtk_widget_set_tooltip_markup (oc_entry, _("For <b>libvirt</b> only, the libvirt connection URI, or leave blank to add the guest to the default libvirt instance on the conversion server. For others, leave this field blank."));
if (config->output_connection != NULL)
gtk_entry_set_text (GTK_ENTRY (oc_entry), config->output_connection);
table_attach (output_tbl, oc_entry,
1, 2, 1, 2, GTK_FILL, GTK_FILL, 1, 1);
- os_label = gtk_label_new (_("Output storage (-os):"));
+ os_label = gtk_label_new_with_mnemonic (_("Output _storage (-os):"));
table_attach (output_tbl, os_label,
0, 1, 2, 3, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (os_label, 1., 0.5);
os_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (os_label), os_entry);
gtk_widget_set_tooltip_markup (os_entry, _("For <b>local</b>, put the directory name on the conversion server. For <b>rhev</b>, put the Export Storage Domain (server:/mountpoint). For others, leave this field blank."));
if (config->output_storage != NULL)
gtk_entry_set_text (GTK_ENTRY (os_entry), config->output_storage);
table_attach (output_tbl, os_entry,
1, 2, 2, 3, GTK_FILL, GTK_FILL, 1, 1);
- of_label = gtk_label_new (_("Output format (-of):"));
+ of_label = gtk_label_new_with_mnemonic (_("Output _format (-of):"));
table_attach (output_tbl, of_label,
0, 1, 3, 4, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (of_label, 1., 0.5);
of_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (of_label), of_entry);
gtk_widget_set_tooltip_markup (of_entry, _("The output disk format, typically <b>raw</b> or <b>qcow2</b>. If blank, defaults to <b>raw</b>."));
if (config->output_format != NULL)
gtk_entry_set_text (GTK_ENTRY (of_entry), config->output_format);
table_attach (output_tbl, of_entry,
1, 2, 3, 4, GTK_FILL, GTK_FILL, 1, 1);
- oa_label = gtk_label_new (_("Output allocation (-oa):"));
+ oa_label = gtk_label_new_with_mnemonic (_("Output _allocation (-oa):"));
table_attach (output_tbl, oa_label,
0, 1, 4, 5, GTK_FILL, GTK_FILL, 1, 1);
set_alignment (oa_label, 1., 0.5);
oa_combo = gtk_combo_box_text_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (oa_label), oa_combo);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (oa_combo),
"sparse");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (oa_combo),
@@ -970,8 +982,8 @@ create_conversion_dialog (struct config *config)
/* Buttons. */
gtk_dialog_add_buttons (GTK_DIALOG (conv_dlg),
- _("Back"), 1,
- _("Start conversion"), 2,
+ _("_Back"), 1,
+ _("_Start conversion"), 2,
NULL);
back = gtk_dialog_get_widget_for_response (GTK_DIALOG (conv_dlg), 1);
start_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conv_dlg), 2);
@@ -1703,8 +1715,8 @@ create_running_dialog (void)
/* Buttons. */
gtk_dialog_add_buttons (GTK_DIALOG (run_dlg),
- _("Cancel conversion ..."), 1,
- _("Reboot"), 2,
+ _("_Cancel conversion ..."), 1,
+ _("_Reboot"), 2,
NULL);
cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (run_dlg), 1);
gtk_widget_set_sensitive (cancel_button, FALSE);
--
2.7.4
8 years, 2 months
[PATCH 1/3] build: remove extra libconfig linkage
by Pino Toscano
Some of the C tools were building also config.c as part of the shared
sources from guestfish, and thus bringing a dependency on libconfig.
Since none of them actually read the libguestfs configuration at all,
then exclude fish/config.c from their build, and stop linking to
libconfig.
---
align/Makefile.am | 3 ---
df/Makefile.am | 3 ---
edit/Makefile.am | 3 ---
format/Makefile.am | 3 ---
inspector/Makefile.am | 5 +----
5 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/align/Makefile.am b/align/Makefile.am
index eb44263..13f8812 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -32,7 +32,6 @@ SHARED_SOURCE_FILES = \
../df/estimate-max-threads.h \
../df/parallel.c \
../df/parallel.h \
- ../fish/config.c \
../fish/decrypt.c \
../fish/display-options.h \
../fish/display-options.c \
@@ -59,12 +58,10 @@ virt_alignment_scan_CPPFLAGS = \
virt_alignment_scan_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
- $(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \
- $(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
diff --git a/df/Makefile.am b/df/Makefile.am
index 6efc1dc..f4a8602 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -27,7 +27,6 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-df
SHARED_SOURCE_FILES = \
- ../fish/config.c \
../fish/decrypt.c \
../fish/display-options.h \
../fish/display-options.c \
@@ -62,12 +61,10 @@ virt_df_CPPFLAGS = \
virt_df_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
- $(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_df_LDADD = \
- $(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
diff --git a/edit/Makefile.am b/edit/Makefile.am
index dc9fbb0..48ad52f 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -25,7 +25,6 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-edit
SHARED_SOURCE_FILES = \
- ../fish/config.c \
../fish/decrypt.c \
../fish/display-options.h \
../fish/display-options.c \
@@ -54,11 +53,9 @@ virt_edit_CPPFLAGS = \
virt_edit_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
- $(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS)
virt_edit_LDADD = \
- $(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
diff --git a/format/Makefile.am b/format/Makefile.am
index 0e881a5..6c22beb 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -25,7 +25,6 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-format
SHARED_SOURCE_FILES = \
- ../fish/config.c \
../fish/decrypt.c \
../fish/display-options.h \
../fish/display-options.c \
@@ -50,12 +49,10 @@ virt_format_CPPFLAGS = \
virt_format_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
- $(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_format_LDADD = \
- $(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index 760e810..a872f4b 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -53,7 +53,6 @@ dist_doc_DATA = \
bin_PROGRAMS = virt-inspector
SHARED_SOURCE_FILES = \
- ../fish/config.c \
../fish/decrypt.c \
../fish/display-options.h \
../fish/display-options.c \
@@ -79,11 +78,9 @@ virt_inspector_CPPFLAGS = \
virt_inspector_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
- $(LIBXML2_CFLAGS) \
- $(LIBCONFIG_CFLAGS)
+ $(LIBXML2_CFLAGS)
virt_inspector_LDADD = \
- $(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
--
2.7.4
8 years, 2 months
[PATCH 1/2] mllib: move remove_duplicates from v2v
by Pino Toscano
Simple code motion.
---
mllib/common_utils.ml | 9 +++++++++
mllib/common_utils.mli | 6 ++++++
v2v/utils.ml | 9 ---------
v2v/utils.mli | 3 ---
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 81d8202..78618f5 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -297,6 +297,15 @@ let sort_uniq ?(cmp = Pervasives.compare) xs =
let xs = uniq ~cmp xs in
xs
+let remove_duplicates xs =
+ let h = Hashtbl.create (List.length xs) in
+ let rec loop = function
+ | [] -> []
+ | x :: xs when Hashtbl.mem h x -> xs
+ | x :: xs -> Hashtbl.add h x true; x :: loop xs
+ in
+ loop xs
+
let push_back xsp x = xsp := !xsp @ [x]
let push_front x xsp = xsp := x :: !xsp
let pop_back xsp =
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 68c0d54..ad43345 100644
--- a/mllib/common_utils.mli
+++ b/mllib/common_utils.mli
@@ -147,6 +147,12 @@ val uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list
(** Sort and uniquify a list. *)
+val remove_duplicates : 'a list -> 'a list
+(** Remove duplicates from an unsorted list; useful when the order
+ of the elements matter.
+
+ Please use [sort_uniq] when the order does not matter. *)
+
val push_back : 'a list ref -> 'a -> unit
val push_front : 'a -> 'a list ref -> unit
val pop_back : 'a list ref -> 'a
diff --git a/v2v/utils.ml b/v2v/utils.ml
index d1ddee7..fb0b802 100644
--- a/v2v/utils.ml
+++ b/v2v/utils.ml
@@ -81,15 +81,6 @@ let compare_app2_versions app1 app2 =
compare_version app1.Guestfs.app2_release app2.Guestfs.app2_release
)
-let remove_duplicates xs =
- let h = Hashtbl.create (List.length xs) in
- let rec loop = function
- | [] -> []
- | x :: xs when Hashtbl.mem h x -> xs
- | x :: xs -> Hashtbl.add h x true; x :: loop xs
- in
- loop xs
-
let du filename =
(* There's no OCaml binding for st_blocks, so run coreutils 'du'. *)
let cmd =
diff --git a/v2v/utils.mli b/v2v/utils.mli
index 97d98ff..2bd1329 100644
--- a/v2v/utils.mli
+++ b/v2v/utils.mli
@@ -46,9 +46,6 @@ val find_uefi_firmware : string -> Uefi.uefi_firmware
val compare_app2_versions : Guestfs.application2 -> Guestfs.application2 -> int
(** Compare two app versions. *)
-val remove_duplicates : 'a list -> 'a list
-(** Remove duplicates from a list. *)
-
val du : string -> int64
(** Return the true size of a file in bytes, including any wasted
space caused by internal fragmentation (the overhead of using
--
2.7.4
8 years, 2 months