Linux Device Mapper development
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: s90006763 <sunao.sun@huawei.com>,
	xose.vazquez@gmail.com, christophe.varoqui@opensvc.com,
	bmarzins@redhat.com, dm-devel@redhat.com, hare@suse.de,
	mwilck+gmail@suse.de
Cc: wangke16@huawei.com, guanjunxiong@huawei.com,
	chengjike.cheng@huawei.com, lixiaoying@huawei.com,
	shenhong09@huawei.com
Subject: Re: [PATCH] multipathd: display the host WWNN fields When the iSCSI path information is displayed using the multipath command, the host WWNN in the path information is not fully displayed, as follows: Multipathd show paths format "%N %n" Host WWNN Target WWNN [undef] iqn.xxx-xx.com.xx:oceanstor:xxxx:: xx:x.x [undef] iqn.xxx-xx.com.xx:oceanstor:xxxx:: xx:x.x
Date: Fri, 02 Nov 2018 13:42:02 +0100	[thread overview]
Message-ID: <442ca3b60aa6b394a0e87c13b034ab6a4e34e401.camel@suse.com> (raw)
In-Reply-To: <20181027044038.10192-1-sunao.sun@huawei.com>

Hello Sunao,

On Sat, 2018-10-27 at 12:40 +0800, s90006763 wrote:
> This patch solves this problem and gets the complete display of host
> WWNN related fields,as follows:multipathd show paths format "%N %n"
> Host WWNN Target WWPN
> Iqn.xx-x.com.redhat:86329 iqn.xxx-xx.com.xx:oceanstor:xxxx::xx:x.x
> Iqn.xx-x.com.redhat:86329 iqn.xxx-xx.com.xx:oceanstor:xxxx::xx:x.x
> ---
>  libmultipath/print.c | 46 +++++++++++++++++++++++++++++++++++++++++-
> ----
>  1 file changed, 41 insertions(+), 5 deletions(-)

Thanks again for the new submission.

Your patch still has lots of whitespace and other style issues. Please
use checkpatch.pl as I suggested in my previous review. Also, as I
already mentioned, please keep your subject line (summary) at a
readable length (75 chars) and add the other information in the
message body.

Apart from that, I only have one more minor nitpick, see below.
We are getting close.

Best regards,
Martin

> 
> diff --git a/libmultipath/print.c b/libmultipath/print.c
> index 7b610b94..956d705d 100644
> --- a/libmultipath/print.c
> +++ b/libmultipath/print.c
> @@ -525,15 +525,13 @@ snprint_path_mpp (char * buff, size_t len,
> const struct path * pp)
>  }
>  
>  static int
> -snprint_host_attr (char * buff, size_t len, const struct path * pp,
> char *attr)
> +snprint_fc_host_attr (char * buff, size_t len, const struct path *
> pp, char *attr)
>  {
>  	struct udev_device *host_dev = NULL;
>  	char host_id[32];
>  	const char *value = NULL;
>  	int ret;
>  
> -	if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
> -		return snprintf(buff, len, "[undef]");
>  	sprintf(host_id, "host%d", pp->sg_id.host_no);
>  	host_dev = udev_device_new_from_subsystem_sysname(udev,
> "fc_host",
>  							  host_id);
> @@ -551,16 +549,54 @@ out:
>  	return ret;
>  }
>  
> +static int
> +snprint_iscsi_host_attr (char * buff, size_t len, const struct path
> * pp, char *attr)
> +{
> +        struct udev_device *host_dev = NULL;
> +        char host_id[32];
> +        const char *value = NULL;
> +        int ret;
> +
> +        sprintf(host_id, "session%d", pp->sg_id.transport_id);
> +        host_dev = udev_device_new_from_subsystem_sysname(udev,
> "iscsi_session",
> +                                                          host_id);
> +        if (!host_dev) {
> +                condlog(1, "%s: No iscsi_host device for '%s'", pp-
> >dev, host_id);
> +                goto out;
> +        }
> +        value = udev_device_get_sysattr_value(host_dev, attr);
> +        if (value)
> +                ret = snprint_str(buff, len, value);
> +        udev_device_unref(host_dev);
> +out:
> +	if (!value)
> +		ret = snprintf(buff, len, "[unknown]");

Please use "undef" here, for consistency.

> +	return ret;
> +}
> +
>  int
>  snprint_host_wwnn (char * buff, size_t len, const struct path * pp)
>  {
> -	return snprint_host_attr(buff, len, pp, "node_name");
> +	if(pp->sg_id.proto_id == SCSI_PROTOCOL_ISCSI)
> +	{
> +		return snprint_iscsi_host_attr(buff, len, pp,
> "initiatorname");
> +	}
> +	else if (pp->sg_id.proto_id == SCSI_PROTOCOL_FCP)
> +	{
> +		return snprint_fc_host_attr(buff, len, pp,
> "node_name");
> +	}
> +	return snprintf(buff, len, "[undef]");
>  }
>  
>  int
>  snprint_host_wwpn (char * buff, size_t len, const struct path * pp)
>  {
> -	return snprint_host_attr(buff, len, pp, "port_name");
> +	
> +	if (pp->sg_id.proto_id == SCSI_PROTOCOL_FCP)
> +	{
> +		return snprint_fc_host_attr(buff, len, pp,
> "port_name");
> +	}
> +	return snprintf(buff, len, "[undef]");	
>  }
>  
>  int

-- 
Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

      reply	other threads:[~2018-11-02 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27  4:40 [PATCH] multipathd: display the host WWNN fields When the iSCSI path information is displayed using the multipath command, the host WWNN in the path information is not fully displayed, as follows: Multipathd show paths format "%N %n" Host WWNN Target WWNN [undef] iqn.xxx-xx.com.xx:oceanstor:xxxx:: xx:x.x [undef] iqn.xxx-xx.com.xx:oceanstor:xxxx:: xx:x.x s90006763
2018-11-02 12:42 ` Martin Wilck [this message]

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=442ca3b60aa6b394a0e87c13b034ab6a4e34e401.camel@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=chengjike.cheng@huawei.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=guanjunxiong@huawei.com \
    --cc=hare@suse.de \
    --cc=lixiaoying@huawei.com \
    --cc=mwilck+gmail@suse.de \
    --cc=shenhong09@huawei.com \
    --cc=sunao.sun@huawei.com \
    --cc=wangke16@huawei.com \
    --cc=xose.vazquez@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox