All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashijeet Acharya <ashijeetacharya@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Richard W.M. Jones" <rjones@redhat.com>,
	jcody@redhat.com, Eric Blake <eblake@redhat.com>,
	mreitz@redhat.com, armbru@redhat.com,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-block@nongnu.org,
	Ashijeet Acharya <ashijeetacharya@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] block/ssh: Add InetSocketAddress and accept it
Date: Fri, 14 Oct 2016 00:04:05 +0530	[thread overview]
Message-ID: <CAC2QTZansaXKsNJi5C3ymc3EEWmAkfZ=6U6Tt-u7W=T6Ju3tqQ@mail.gmail.com> (raw)
In-Reply-To: <1476171437-11830-3-git-send-email-ashijeetacharya@gmail.com>

On Tue, Oct 11, 2016 at 1:07 PM, Ashijeet Acharya
<ashijeetacharya@gmail.com> wrote:
> Add InetSocketAddress compatibility to SSH driver.
>
> Add a new option "server" to the SSH block driver which then accepts
> a InetSocketAddress.
>
> "host" and "port" are supported as legacy options and are mapped to
> their InetSocketAddress representation.
>
> Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
> ---
>  block/ssh.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 78 insertions(+), 9 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 75cb7bc..702871a 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -32,8 +32,11 @@
>  #include "qemu/error-report.h"
>  #include "qemu/sockets.h"
>  #include "qemu/uri.h"
> +#include "qapi-visit.h"
>  #include "qapi/qmp/qint.h"
>  #include "qapi/qmp/qstring.h"
> +#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qmp-output-visitor.h"
>
>  /* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in
>   * this block driver code.
> @@ -74,6 +77,8 @@ typedef struct BDRVSSHState {
>       */
>      LIBSSH2_SFTP_ATTRIBUTES attrs;
>
> +    InetSocketAddress *inet;
> +
>      /* Used to warn if 'flush' is not supported. */
>      char *hostport;
>      bool unsafe_flush_warning;
> @@ -263,7 +268,9 @@ static bool ssh_has_filename_options_conflict(QDict *options, Error **errp)
>              !strcmp(qe->key, "port") ||
>              !strcmp(qe->key, "path") ||
>              !strcmp(qe->key, "user") ||
> -            !strcmp(qe->key, "host_key_check"))
> +            !strcmp(qe->key, "host_key_check") ||
> +            !strcmp(qe->key, "server") ||
> +            !strncmp(qe->key, "server.", 7))
>          {
>              error_setg(errp, "Option '%s' cannot be used with a file name",
>                         qe->key);
> @@ -555,13 +562,71 @@ static QemuOptsList ssh_runtime_opts = {
>      },
>  };
>
> +static bool ssh_process_legacy_socket_options(QDict *output_opts,
> +                                              QemuOpts *legacy_opts,
> +                                              Error **errp)
> +{
> +    const char *host = qemu_opt_get(legacy_opts, "host");
> +    const char *port = qemu_opt_get(legacy_opts, "port");
> +
> +    if (!host && port) {
> +        error_setg(errp, "port may not be used without host");
> +        return false;
> +    }
> +
> +    if (!host) {
> +        error_setg(errp, "No hostname was specified");
> +        return false;

I was debugging this part with gdb while making the changes for v2,
and I hit something very strange.
The code always gives the error of "No hostname was specified". To be
more clear, I reverted back to original driver state and the problem
did not seem to appear for the same qemu command line and I can't find
the bug.

Command I used:

$ ./bin/qemu-system-x86_64 -m 512 -drive
file=ssh://ashijeet@127.0.0.1/home/ashijeet/qemu_build/test.qcow2,
if=virtio

Is there something wrong with the command line?

Ashijeet

  parent reply	other threads:[~2016-10-13 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11  7:37 [Qemu-devel] [PATCH 0/4] Allow blockdev-add for SSH Ashijeet Acharya
2016-10-11  7:37 ` [Qemu-devel] [PATCH 1/4] block/ssh: Add ssh_has_filename_options_conflict() Ashijeet Acharya
2016-10-11  7:37 ` [Qemu-devel] [PATCH 2/4] block/ssh: Add InetSocketAddress and accept it Ashijeet Acharya
2016-10-12 15:51   ` Kevin Wolf
2016-10-12 16:49     ` Ashijeet Acharya
2016-10-13 18:34   ` Ashijeet Acharya [this message]
2016-10-11  7:37 ` [Qemu-devel] [PATCH 3/4] block/ssh: Use InetSocketAddress options Ashijeet Acharya
2016-10-11  7:37 ` [Qemu-devel] [PATCH 4/4] qapi: allow blockdev-add for ssh Ashijeet Acharya
2016-10-11 20:28 ` [Qemu-devel] [PATCH 0/4] Allow blockdev-add for SSH no-reply
2016-10-12  8:09 ` Ashijeet Acharya
2016-10-12  8:22   ` Kevin Wolf
2016-10-12  8:37     ` Ashijeet Acharya
2016-10-12  8:43       ` Kevin Wolf
2016-10-12  8:43   ` Ashijeet Acharya
2016-10-12 16:01 ` Kevin Wolf
2016-10-12 16:20   ` Ashijeet Acharya
2016-10-12 16:40     ` Kevin Wolf
2016-10-12 16:57       ` Ashijeet Acharya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC2QTZansaXKsNJi5C3ymc3EEWmAkfZ=6U6Tt-u7W=T6Ju3tqQ@mail.gmail.com' \
    --to=ashijeetacharya@gmail.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.