[PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
by Pino Toscano
ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to
uninstall open-vm-tools then dpkg will (rightfully) fail with a
dependency issue.
Since open-vm-tools is harmless after the conversion anyway (it will
not even run), then do not attempt to uninstall it if ubuntu-server is
installed too.
Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129.
---
v2v/convert_linux.ml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 3d61400b5..b4b2f24c4 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -289,6 +289,18 @@ let convert (g : G.guestfs) inspect source output rcaps =
(* Uninstall VMware Tools. *)
let remove = ref [] and libraries = ref [] in
+ (* On Ubuntu, the ubuntu-server metapackage depends on
+ * open-vm-tools, and thus any attempt to remove it will cause
+ * dependency issues. Hence, special case this situation, and
+ * leave open-vm-tools installed in this case.
+ *)
+ let has_ubuntu_server =
+ if family = `Debian_family then
+ List.exists (
+ fun { G.app2_name = name } ->
+ name = "ubuntu-server"
+ ) inspect.i_apps
+ else false in
List.iter (
fun { G.app2_name = name } ->
if String.is_prefix name "vmware-tools-libraries-" then
@@ -301,7 +313,7 @@ let convert (g : G.guestfs) inspect source output rcaps =
List.push_front name remove
else if String.is_prefix name "open-vm-tools-" then
List.push_front name remove
- else if name = "open-vm-tools" then
+ else if name = "open-vm-tools" && not has_ubuntu_server then
List.push_front name remove
) inspect.i_apps;
let libraries = !libraries in
--
2.20.1
5 years, 8 months
virt-v2v: default graphics driver for SUSE guests
by Pino Toscano
Hi Mike,
in 2013 you added the support for SUSE guests in the old virt-v2v (the
one written in Perl); the commit doing it is attached, since the old
virt-v2v was hosted on fedorahosted.org, which is no more.
As part of that change, the default graphics driver was changed to be
cirrus for SUSE guests, and qxl (as before) for any other.
When Rich Jones rewrote virt-v2v in 2014 in OCaml, he kept the same
logic [1]; this is still there today [2], and none of the other
SUSE-related changes that were done (mostly by another SUSE guy,
Cédric Bosdonnat) changed that in any way.
My question is: is using cirrus still the best choice for SUSE guests?
If not, what about using qxl as well, as done for any non-SUSE guest?
(We can also do that depending on the version of the guest, in case
only newer SUSE versions work fine with qxl).
[1] https://github.com/libguestfs/libguestfs/commit/3d1cb74b3eee51c5d015032ad...
[2] https://github.com/libguestfs/libguestfs/blob/master/v2v/convert_linux.ml...
Thanks,
--
Pino Toscano
5 years, 8 months
[PATCH] inspect: return osinfo short IDs for recent Windows versions
by Pino Toscano
Return the right osinfo short IDs for the majority of Windows versions
since Windows XP.
---
lib/inspect-osinfo.c | 60 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c
index 816d317f1..f93f7ac52 100644
--- a/lib/inspect-osinfo.c
+++ b/lib/inspect-osinfo.c
@@ -69,6 +69,66 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root)
if (STREQ (distro, "msdos"))
return safe_strdup (g, "msdos6.22");
}
+ else if (STREQ (type, "windows")) {
+ CLEANUP_FREE char *product_name = NULL;
+ CLEANUP_FREE char *product_variant = NULL;
+
+ product_name = guestfs_inspect_get_product_name (g, root);
+ if (!product_name)
+ return NULL;
+ product_variant = guestfs_inspect_get_product_variant (g, root);
+ if (!product_variant)
+ return NULL;
+
+ switch (major) {
+ case 5:
+ switch (minor) {
+ case 1:
+ return safe_strdup (g, "winxp");
+ case 2:
+ if (strstr (product_name, "XP"))
+ return safe_strdup (g, "winxp");
+ else if (strstr (product_name, "R2"))
+ return safe_strdup (g, "win2k3r2");
+ else
+ return safe_strdup (g, "win2k3");
+ }
+ break;
+ case 6:
+ switch (minor) {
+ case 0:
+ if (strstr (product_variant, "Server"))
+ return safe_strdup (g, "win2k8");
+ else
+ return safe_strdup (g, "winvista");
+ case 1:
+ if (strstr (product_variant, "Server"))
+ return safe_strdup (g, "win2k8r2");
+ else
+ return safe_strdup (g, "win7");
+ case 2:
+ if (strstr (product_variant, "Server"))
+ return safe_strdup (g, "win2k12");
+ else
+ return safe_strdup (g, "win8");
+ case 3:
+ if (strstr (product_variant, "Server"))
+ return safe_strdup (g, "win2k12r2");
+ else
+ return safe_strdup (g, "win8.1");
+ }
+ break;
+ case 10:
+ switch (minor) {
+ case 0:
+ if (strstr (product_variant, "Server"))
+ return safe_strdup (g, "win2k16");
+ else
+ return safe_strdup (g, "win10");
+ }
+ break;
+ }
+ }
/* No ID could be guessed, return "unknown". */
return safe_strdup (g, "unknown");
--
2.20.1
5 years, 8 months
IO rate of tar-in, what can we expect on a qcow2 image?
by Martin Blapp
Hi all,
We have done several speed tests on a qcow2 Linux Image to test how fast tar-in with a big
tarball can be. Virtio seems to be active, and we get transfers in a range from 100-160MB/sec,
independent of the disk speed on the host.
For example we had a 20 core host system with 900MB for serial writing and 350MB for mixed
read/write on the native filesystem. We've expected a faster tar-in for qcow2 there than on a
small test system with some slow disks and only two cores. But the rates where nearly the same.
We tried really hard to do some optimizing and using big files inside the tar (for emulating serial
writing), but we managed only to get those 160MB/sec, but not more.
The IO-rate for serial writing inside a running VM-Image on the same qcow2 image is much more
higher, dependent of course on the underlying disks of the host. Here we get clear benefits of fast
storage.
Has anybody of you got more than those 160MB/sec with tar-in, and if so, how did you do it?
Are there maybe some limitations in the XDR/RPC mechanisms of tar-in ?
Best regards:
Martin Blapp
5 years, 8 months
[PATCH nbdkit v3 0/4] Add linuxdisk plugin.
by Richard W.M. Jones
For v3 I reimplemented this using mke2fs -d. This obviously makes the
implementation a whole lot simpler, but cannot support multiple
directory merging.
Patches 1-3 are the same as before. I've also reproduced the notes
from v2 below.
v2:
- Fix inconsistent tab/space.
- All 3 plugins now contain a block of text pointing to the
other 2 plugins.
- TMDIR -> TMPDIR
- Unlink the temporary file and other cleanups along error paths.
- fclose -> pclose, and check the return value for errors.
I considered, but didn't yet fix, the latent bug in shell_quote.
Instead I added a comment. Note there's a case where we probably
(arguably) should be using shell_quote on an argv[0] here:
https://github.com/libguestfs/nbdkit/blob/72e0afe2e280d895f68941677fafa55...
'du -c -k -s' works on FreeBSD which doesn't have GNU coreutils.
(However I agree it's not very natural to use this plugin with FreeBSD
at all.)
Rich.
5 years, 9 months
[PATCH nbdkit v2 0/5] Add linuxdisk plugin.
by Richard W.M. Jones
Another interesting thing you can do with this plugin:
https://rwmj.wordpress.com/2019/02/19/nbdkit-linuxdisk-plugin/
v2:
- Fix inconsistent tab/space.
- All 3 plugins now contain a block of text pointing to the
other 2 plugins.
- TMDIR -> TMPDIR
- Unlink the temporary file and other cleanups along error paths.
- fclose -> pclose, and check the return value for errors.
- There's an extra commit containing a minor change to TODO. I will
probably push this.
I considered, but didn't yet fix, the latent bug in shell_quote.
Instead I added a comment. Note there's a case where we probably
(arguably) should be using shell_quote on an argv[0] here:
https://github.com/libguestfs/nbdkit/blob/72e0afe2e280d895f68941677fafa55...
'du -c -k -s' works on FreeBSD which doesn't have GNU coreutils.
(However I agree it's not very natural to use this plugin with FreeBSD
at all.)
The return from 'chdir (origdir)' is checked on the normal path, and
not checked only on the error path where we're only trying to make a
best effort clean-up.
Rich.
5 years, 9 months
[PATCH nbdkit 0/4] New plugin: Add linuxdisk plugin.
by Richard W.M. Jones
Turns out Japanese trains are good for coding!
In supermin we have a bunch of code to create the libguestfs
appliance. It creates it directly using libext2fs (part of
e2fsprogs). We can use the same technique to create ext2 virtual
disks in nbdkit, which is what this new plugin does. Why a new plugin
instead of modifying the floppy plugin? See the 4/4 commit message
for an explanation.
The first 3 patches are pretty uncontroversial refactoring. The 4th
patch contains the plugin and tests. It's probably best to start with
the commit message and the included man page.
This is quick even for relatively large filesystems containing large
numbers of small files. Here's an example for the nbdkit source code
(including the .git directory):
$ time ./nbdkit --filter=partition -U - linuxdisk . partition=1 --run 'qemu-img convert $nbd /var/tmp/ext2fs.img'
real 0m1.314s
user 0m0.424s
sys 0m0.889s
$ ls -lh /var/tmp/ext2fs.img
-rw-r--r--. 1 rjones rjones 351M Feb 19 07:44 /var/tmp/ext2fs.img
The tests + valgrind pass on Fedora 29 & RHEL 7.
Rich.
5 years, 9 months
Fedora 29 guestfish not working
by CHANU ROMAIN
Hello,
I tried to install guestfish on my Fedora 29 and used the commands from
documentation sudo dnf install libguestfs-tools but I got an error when
I tried to execute run. You will find below logs below:
************************************************************
* IMPORTANT NOTICE
*
* When reporting bugs, include the COMPLETE, UNEDITED
* output below in your bug report.
*
************************************************************
PATH=/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/us
r/sbin:/home/romain/bin
XDG_RUNTIME_DIR=/run/user/1000
SELinux: Disabled
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: libvirt
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_hv: /usr/bin/qemu-kvm
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_smp: 1
guestfs_get_sockdir: /run/user/1000
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.39.11fedora=29,release=1.fc29,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=libvirt
libguestfs: launch: tmpdir=/tmp/libguestfsH1Xvb3
libguestfs: launch: umask=0022
libguestfs: launch: euid=1000
libguestfs: libvirt version = 4007000 (4.7.0)
libguestfs: guest random name = guestfs-rakt1mfrsshbuiqs
libguestfs: connect to libvirt
libguestfs: opening libvirt handle: URI = qemu:///session, auth =
default+wrapper, flags = 0
libguestfs: successfully opened libvirt handle: conn = 0x55f938843730
libguestfs: qemu version (reported by libvirt) = 3000000 (3.0.0)
libguestfs: get libvirt capabilities
libguestfs: parsing capabilities XML
libguestfs: build appliance
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-1000/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-1000/appliance.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.14
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-1000/lock
supermin: build: /usr/lib64/guestfs/supermin.d
supermin: reading the supermin appliance
supermin: build: visiting /usr/lib64/guestfs/supermin.d/base.tar.gz
type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/daemon.tar.gz
type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/excludefiles
type uncompressed excludefiles
supermin: build: visiting /usr/lib64/guestfs/supermin.d/hostfiles type
uncompressed hostfiles
supermin: build: visiting /usr/lib64/guestfs/supermin.d/init.tar.gz
type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/packages type
uncompressed packages
supermin: build: visiting /usr/lib64/guestfs/supermin.d/udev-
rules.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/zz-packages-xfs
type uncompressed packages
supermin: mapping package names to installed packages
supermin: resolving full list of package dependencies
supermin: exception: Librpm.Multiple_matches(2)
libguestfs: error: /usr/bin/supermin exited with error status 1, see
debug messages above
libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL:
Invalid argument [you can ignore this message if you are not using
SELinux + sVirt]
libguestfs: closing guestfs handle 0x55f938840880 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsH1Xvb3
What can I do?
Best regards,
5 years, 9 months
[PATCH nbdkit v2] server: utils: Make nbdkit_parse_size to reject negative values
by Mykola Ivanets
From: Nikolay Ivanets <stenavin(a)gmail.com>
nbdkit_parse_size() uses strtoumax() function to parse input strings
which states:
"if there was a leading minus sign, the negation of the result of the
conversion represented as an unsigned value, unless the original
(nonnegated) value would overflow."
Later validation doesn't catch the situation when parsed value appeared
within the valid range (due to negation) but original string passed to a
function literally represented negative number.
Thus nbdkit_parse_size() treats negative values in a range [-UINT64_MAX;
INT64_MIN - 1] as positive values in a range [1; INT64_MAX] due to
negation performed by strtoumax().
In this patch:
1. strtoimax() is used instead of strtoumax() to reflect the nature of
the 'size' which cannot be negative and is not expected to exceed
INT64_MAX.
2. Error reporting separates cases where the string is parsed to a
negative value or parsed value overflows (greater then INT64_MAX).
Tests:
1. Some more tests were added to cover described behaviour.
2. Input strings where grouped into a set which lead to
valid/invalid/negative/overflow result.
3. Some strings with a leading '+' sign were added.
---
server/test-utils.c | 28 ++++++++++++++++++++++++----
server/utils.c | 19 ++++++++++++++-----
2 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/server/test-utils.c b/server/test-utils.c
index f51f63a..3965fd3 100644
--- a/server/test-utils.c
+++ b/server/test-utils.c
@@ -62,14 +62,26 @@ test_nbdkit_parse_size (void)
{ "0x0", -1 },
{ "garbage", -1 },
{ "0garbage", -1 },
- { "-1", -1 },
- { "-2", -1 },
- { "9223372036854775808", -1 },
- { "-9223372036854775808", -1 },
{ "8E", -1 },
{ "8192P", -1 },
+
+ /* Strings leading to overflow */
+ { "9223372036854775808", -1 }, /* INT_MAX + 1 */
+ { "18446744073709551614", -1 }, /* UINT64_MAX - 1 */
+ { "18446744073709551615", -1 }, /* UINT64_MAX */
+ { "18446744073709551616", -1 }, /* UINT64_MAX + 1 */
{ "999999999999999999999999", -1 },
+ /* Strings representing negative values */
+ { "-1", -1 },
+ { "-2", -1 },
+ { "-9223372036854775809", -1 }, /* INT64_MIN - 1 */
+ { "-9223372036854775808", -1 }, /* INT64_MIN */
+ { "-9223372036854775807", -1 }, /* INT64_MIN + 1 */
+ { "-18446744073709551616", -1 }, /* -UINT64_MAX - 1 */
+ { "-18446744073709551615", -1 }, /* -UINT64_MAX */
+ { "-18446744073709551614", -1 }, /* -UINT64_MAX + 1 */
+
/* Strings we may want to support in the future */
{ "M", -1 },
{ "1MB", -1 },
@@ -77,8 +89,14 @@ test_nbdkit_parse_size (void)
{ "1.5M", -1 },
/* Valid strings */
+ { "-0", 0 },
{ "0", 0 },
+ { "+0", 0 },
{ " 08", 8 },
+ { "1", 1 },
+ { "+1", 1 },
+ { "1234567890", 1234567890 },
+ { "+1234567890", 1234567890 },
{ "9223372036854775807", INT64_MAX },
{ "1s", 512 },
{ "2S", 1024 },
@@ -88,12 +106,14 @@ test_nbdkit_parse_size (void)
{ "1K", 1024 },
{ "1m", 1024 * 1024 },
{ "1M", 1024 * 1024 },
+ { "+1M", 1024 * 1024 },
{ "1g", 1024 * 1024 * 1024 },
{ "1G", 1024 * 1024 * 1024 },
{ "1t", 1024LL * 1024 * 1024 * 1024 },
{ "1T", 1024LL * 1024 * 1024 * 1024 },
{ "1p", 1024LL * 1024 * 1024 * 1024 * 1024 },
{ "1P", 1024LL * 1024 * 1024 * 1024 * 1024 },
+ { "8191p", 1024LL * 1024 * 1024 * 1024 * 1024 * 8191 },
{ "1e", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 },
{ "1E", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 },
};
diff --git a/server/utils.c b/server/utils.c
index 18011fd..6feb564 100644
--- a/server/utils.c
+++ b/server/utils.c
@@ -88,21 +88,30 @@ nbdkit_absolute_path (const char *path)
int64_t
nbdkit_parse_size (const char *str)
{
- uint64_t size;
+ int64_t size;
char *end;
uint64_t scale = 1;
- /* Disk sizes cannot usefully exceed off_t (which is signed), so
- * scan unsigned, then range check later that result fits. */
+ /* Disk sizes cannot usefully exceed off_t (which is signed) and
+ * cannot be negative. */
/* XXX Should we also parse things like '1.5M'? */
/* XXX Should we allow hex? If so, hex cannot use scaling suffixes,
* because some of them are valid hex digits */
errno = 0;
- size = strtoumax (str, &end, 10);
- if (errno || str == end) {
+ size = strtoimax (str, &end, 10);
+ if (str == end) {
nbdkit_error ("could not parse size string (%s)", str);
return -1;
}
+ if (size < 0) {
+ nbdkit_error ("size cannot be negative (%s)", str);
+ return -1;
+ }
+ if (errno) {
+ nbdkit_error ("size (%s) exceeds maximum value", str);
+ return -1;
+ }
+
switch (*end) {
/* No suffix */
case '\0':
--
2.17.2
5 years, 9 months