[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] ssh: switch from libssh2 to libssh
From: |
Pino Toscano |
Subject: |
Re: [Qemu-block] [PATCH] ssh: switch from libssh2 to libssh |
Date: |
Thu, 20 Oct 2016 17:44:41 +0200 |
User-agent: |
KMail/5.3.1 (Linux/4.7.3-200.fc24.x86_64; KDE/5.26.0; x86_64; ; ) |
On Thursday, 20 October 2016 16:32:50 CEST Richard W.M. Jones wrote:
> On Thu, Oct 20, 2016 at 05:15:24PM +0200, Pino Toscano wrote:
> > Rewrite the implementation of the ssh block driver to use libssh instead
> > of libssh. The libssh library has various advantages over libssh:
> > - easier API for authentication (for example for using ssh-agent)
> > - easier API for known_hosts handling
> > - supports newer types of keys in known_hosts
> >
> > Kerberos authentication can be enabled once the libssh bug for it [1] is
> > fixed.
> >
> > The development version of libssh (i.e. the future 0.8.x) supports
> > fsync, so reuse the build time check for this.
> >
> > [1] https://red.libssh.org/issues/242
> >
> > Signed-off-by: Pino Toscano <address@hidden>
>
>
> When I applied this patch and compiled it with warnings enabled:
>
> block/ssh.c: In function ‘connect_to_ssh’:
> block/ssh.c:643:12: warning: ‘ret’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> return ret;
> ^~~
Interesting, there was no warning for me. Anyway, I think this:
diff --git a/block/ssh.c b/block/ssh.c
index 7c316db..7ff376e 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -519,6 +519,7 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
/* Create SSH session. */
s->session = ssh_new();
if (!s->session) {
+ ret = -EINVAL;
goto err;
}
should fix it (added already locally).
> To test the patch, I used virt-builder to create a virtual machine
> disk image on another machine (accessible over ssh). Then from my
> laptop I ran:
>
> ./x86_64-softmmu/qemu-system-x86_64 -nodefconfig \
> -M accel=kvm -cpu host -m 2048 \
> -drive
> file.driver=ssh,file.user=[user],file.host=[host],file.path=/var/tmp/fedora-24.img,format=raw,if=virtio
> \
> -serial stdio
>
> Unfortunately this failed with a large number of sftp errors:
>
> read failed: (sftp error code: 0)
>
> and subsequently hung. So I'm afraid I couldn't test the patch at all :-(
Can you please enable the logging of the ssh driver, and libssh own
logging too? Basically (see lines 45-46) set:
#define DEBUG_SSH 1
#define TRACE_LIBSSH 4
> Also fsync was not supported for me, but I'm using 0.7.3 and the code
> says I need 0.8.0.
Yes, this is correct.
Thanks,
--
Pino Toscano
signature.asc
Description: This is a digitally signed message part.