From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxFwc-0008So-Jx for qemu-devel@nongnu.org; Thu, 20 Oct 2016 12:11:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxFwb-0000FD-7D for qemu-devel@nongnu.org; Thu, 20 Oct 2016 12:11:50 -0400 Date: Thu, 20 Oct 2016 17:11:41 +0100 From: "Richard W.M. Jones" Message-ID: <20161020161141.GF11243@redhat.com> References: <1476976524-6599-1-git-send-email-ptoscano@redhat.com> <20161020153250.GE11243@redhat.com> <2129980.is88ABC7Ux@thyrus.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2129980.is88ABC7Ux@thyrus.usersys.redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] ssh: switch from libssh2 to libssh List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pino Toscano Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, jcody@redhat.com, kwolf@redhat.com, mreitz@redhat.com On Thu, Oct 20, 2016 at 05:44:41PM +0200, Pino Toscano wrote: > 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 in= stead > > > 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 > > >=20 > > > Kerberos authentication can be enabled once the libssh bug for it [= 1] is > > > fixed. > > >=20 > > > The development version of libssh (i.e. the future 0.8.x) supports > > > fsync, so reuse the build time check for this. > > >=20 > > > [1] https://red.libssh.org/issues/242 > > >=20 > > > Signed-off-by: Pino Toscano > >=20 > >=20 > > When I applied this patch and compiled it with warnings enabled: > >=20 > > block/ssh.c: In function =E2=80=98connect_to_ssh=E2=80=99: > > block/ssh.c:643:12: warning: =E2=80=98ret=E2=80=99 may be used uninit= ialized in this function [-Wmaybe-uninitialized] > > return ret; > > ^~~ >=20 > Interesting, there was no warning for me. Anyway, I think this: >=20 > 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 *o= ptions, > /* Create SSH session. */ > s->session =3D ssh_new(); > if (!s->session) { > + ret =3D -EINVAL; > goto err; > } > =20 > should fix it (added already locally). Yes, this fixes the warning. > > 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: > >=20 > > ./x86_64-softmmu/qemu-system-x86_64 -nodefconfig \ > > -M accel=3Dkvm -cpu host -m 2048 \ > > -drive file.driver=3Dssh,file.user=3D[user],file.host=3D[host],= file.path=3D/var/tmp/fedora-24.img,format=3Draw,if=3Dvirtio \ > > -serial stdio > >=20 > > Unfortunately this failed with a large number of sftp errors: > >=20 > > read failed: (sftp error code: 0) > >=20 > > and subsequently hung. So I'm afraid I couldn't test the patch at al= l :-( >=20 > Can you please enable the logging of the ssh driver, and libssh own > logging too? Basically (see lines 45-46) set: >=20 > #define DEBUG_SSH 1 > #define TRACE_LIBSSH 4 I'll send you the full trace privately since it's enormous. Rich. > > Also fsync was not supported for me, but I'm using 0.7.3 and the code > > says I need 0.8.0. >=20 > Yes, this is correct. >=20 > Thanks, > --=20 > Pino Toscano --=20 Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rj= ones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW