[libnbd PATCH] ci: Enable python code style
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
ci/build.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/ci/build.sh b/ci/build.sh
index 7d62a84a5d4b..4ea3fec7d512 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -8,6 +8,7 @@ main() {
autoreconf -if
CONFIG_ARGS="\
+--enable-python-code-style \
--enable-gcc-warnings \
--enable-fuse \
--enable-ocaml \
--
2.32.0
3 years, 6 months
[libnbd PATCH] nbdsh: Simplify the script
by Martin Kletzander
There is no need for any hacks if we just do what execution of the module would
have done.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
sh/nbdsh.in | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sh/nbdsh.in b/sh/nbdsh.in
index d10f0c1b6b26..f66e2918d304 100644
--- a/sh/nbdsh.in
+++ b/sh/nbdsh.in
@@ -1,4 +1,4 @@
-#!/bin/sh -
+#!/usr/bin/env @PYTHON@
# Copyright (C) 2011-2019 Red Hat Inc.
#
# @configure_input@
@@ -17,10 +17,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# Test if /bin/sh supports exec -a option (only supported in bash 4.2
-# and above, and not part of POSIX).
-if /bin/sh -c 'exec -a test true' 2>/dev/null; then
- exec -a nbdsh @PYTHON@ -mnbd "$@"
-else
- exec @PYTHON@ -mnbd "$@"
-fi
+import nbdsh
+
+nbdsh.shell()
--
2.32.0
3 years, 6 months
[libnbd PATCH v2] bash: Generate completion files during build
by Martin Kletzander
At that point the dependencies are more relevant and we will also avoid shipping
symlinks.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
bash/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bash/Makefile.am b/bash/Makefile.am
index 4245eca485a2..41d7b137baf2 100644
--- a/bash/Makefile.am
+++ b/bash/Makefile.am
@@ -24,10 +24,10 @@ EXTRA_DIST = \
if HAVE_BASH_COMPLETION
-dist_bashcomp_DATA = nbdfuse nbdsh
+bashcomp_DATA = nbdfuse nbdsh
if HAVE_LIBXML2
-dist_bashcomp_DATA += nbdcopy nbdinfo
+bashcomp_DATA += nbdcopy nbdinfo
endif HAVE_LIBXML2
--
2.32.0
3 years, 6 months
[PATCH nbdkit] plugins/ssh: remove pointless code fetching SHA1 fingerprint
by Daniel P. Berrangé
The result of calling ssh_get_publickey_hash() is never used in the
code, simply being freed on all exit paths. It appears this was
copied from the libssh docs example code, where the fingerprint
was indeed printed on the console.
The ssh_session_is_known_server() call will validate against any
fingerprint stored in the $HOME/.ssh/known_hosts file. The hashes
in this file will use the algorithm configured for the openssh
client, which will usually be SHA256 in modern OS.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
plugins/ssh/ssh.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/plugins/ssh/ssh.c b/plugins/ssh/ssh.c
index 994e9834..6d18f18d 100644
--- a/plugins/ssh/ssh.c
+++ b/plugins/ssh/ssh.c
@@ -228,14 +228,6 @@ do_verify_remote_host (struct ssh_handle *h)
nbdkit_error ("could not get server public key");
return -1;
}
- rc = ssh_get_publickey_hash (srv_pubkey,
- SSH_PUBLICKEY_HASH_SHA1,
- &hash, &hlen);
- ssh_key_free (srv_pubkey);
- if (rc < 0) {
- nbdkit_error ("could not get server public key SHA1 hash");
- return -1;
- }
state = ssh_session_is_known_server (h->session);
switch (state) {
@@ -245,13 +237,11 @@ do_verify_remote_host (struct ssh_handle *h)
case SSH_KNOWN_HOSTS_CHANGED:
nbdkit_error ("host key for server changed");
- ssh_clean_pubkey_hash (&hash);
return -1;
case SSH_KNOWN_HOSTS_OTHER:
nbdkit_error ("host key for server was not found "
"but another type of key exists");
- ssh_clean_pubkey_hash (&hash);
return -1;
case SSH_KNOWN_HOSTS_NOT_FOUND:
@@ -259,22 +249,18 @@ do_verify_remote_host (struct ssh_handle *h)
* host key is set up before using nbdkit so we error out here.
*/
nbdkit_error ("could not find known_hosts file");
- ssh_clean_pubkey_hash (&hash);
return -1;
case SSH_KNOWN_HOSTS_UNKNOWN:
nbdkit_error ("host key is unknown, you must use ssh first "
"and accept the host key");
- ssh_clean_pubkey_hash (&hash);
return -1;
case SSH_KNOWN_HOSTS_ERROR:
nbdkit_error ("known hosts error: %s", ssh_get_error (h->session));
- ssh_clean_pubkey_hash (&hash);
return -1;
}
- ssh_clean_pubkey_hash (&hash);
return 0;
}
--
2.31.1
3 years, 6 months
Re: [Libguestfs] [libguestfs/libguestfs] virt-v2v: error: internal error: invalid argument: cannot fetch XML description of guest ‘Guest_Name’: internal error: HTTP response code 404 for download from (#68)
by Richard W.M. Jones
On Tue, Jun 22, 2021 at 01:16:36AM -0700, sabrinesoltani wrote:
> I have a problem when I use virt-v2v to migrate VMs from Vmware hypervisor to
> OLVM plateform.
> The guest is powered off and exists on esxi server.
>
> virt-v2v: error: internal error: invalid argument: cannot fetch XML
> description of guest ‘Guest_name’: internal error: HTTP response
> code 404 for download from " https://...."
> If reporting bugs, run virt-v2v with debugging enabled and include the
> complete output:
>
> virt-v2v -v -x [...]
As it says, you'll need to run virt-v2v with the -v -x options
and post the full log somewhere.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
3 years, 6 months
How it works - libnbd / nbdkit upstream releases
by Richard W.M. Jones
Hi Eric,
I thought it would be more useful to document (semi-)publicly how I do
upstream releases of libnbd / nbdkit. None of this is set in stone,
it's just how I do it right now.
For upstream development (master) branch dot releases:
- Edit configure.ac and update the last field of AC_INIT
- This should all pass:
./configure
make distclean
./configure --enable-gcc-warnings --enable-python-code-style
make
make check
make check-valgrind
- This compares the files in the dist tarball with the files in git
and is useful to make sure EXTRA_DIST isn't missing anything:
make dist
make maintainer-check-extra-dist
- I usually copy the tarball to another machine to make sure it
compiles.
- Once you're happy the tarball works, commit & tag it:
make maintainer-commit
make maintainer-tag
git push ; git push --tags
- GPG sign the tarball with a detached signature and upload it to the
website. (I will talk to you about this separately).
Note that since the tarball contains generated files, especially
for libnbd, we don't rely on the automatically generated tarballs
in gitlab.
For a Fedora Rawhide release, which usually follows from the above:
- fedpkg clone -B libnbd # or nbdkit
cd libnbd/rawhide
- Edit libnbd.spec to set the updated version, and add a %changelog
entry. See previous commits for examples.
- Upload the sources:
fedpkg new-sources libnbd-*.tar.gz libnbd-*.tar.gz.sig
- Commit, push it and build:
fedpkg commit -c
fedpkg push
fedpkg build
#fedora update # only required on non-Rawhide branches
Check the other Fedora branches. At the moment they are following the
stable branch, only Rawhide follows the development branch. But at
other times it is possible that a Fedora release branch might be
following the development branch (because our upstream releases don't
synchronise with Fedora).
For an upstream stable branch (stable-1.xx) dot release:
- Cherry pick only patches which are any of:
* Bug fixes
* Simple code refactoring that don't introduce new features.
- Definitely don't introduce new features in the stable branch.
- I try to avoid introducing new tests in the stable branch, because
tests can fail and we don't want someone upgrading along the stable
branch to have build issues.
- I usually like to keep the commits in the same order as the
development branch as much as possible, but it's not a hard
requirement.
- I find it very helpful to use git cherry-pick -x option since it
makes it easy to search git log to see what commits have been
backported (especially useful when commits depend on each other).
- Proceed per development release as above.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
3 years, 6 months
[PATCH libnbd 0/2] copy: Set default request-size to 2**18 (262144 bytes)
by Richard W.M. Jones
As Nir has pointed out, our current default for nbdcopy --request-size
is far from optimal. In this patch series I have changed the default
to something which is better, and provided some benchmark results.
With this simplistic approach it's not possible to choose a default
which is best in all situations. That will likely require us to
benchmark many machines and try to work out a formula relating
measurable aspects of those machines like L3 cache size to the best
request size, but that's a lot more work.
Also one of the tests implicitly depended on the default size so I had
to adjust the test.
Rich.
3 years, 6 months
nbd_aio_p{read,write} responsibilities
by Abhay Raj Singh
I was going through the code and realized io_uring is similar to libev in
the way that we listen to the io events ourselves but the difference is
when we encounter the event we read it ourselves(io_uring), whereas in the
case of libev we ask libnbd to read it for us. We notify that the
connection is readable using ai_notify_read and the command is ran by the
state machine the command was queued by an earlier call to nbd_aio_pread.
My question is if we read from the socket using (let's say read[1]) what do
we need to do to inform the state machine we have done so, so that it can
function properly as I am assuming nbd_aio_pread modifies the state in some
way on enqueue and completion
Thanks and regards,
Abhay
---
[1]: io_uring has read but not recv in kernel 5.5
3 years, 6 months