Re: [PATCH v2 1/7] storage_iscsi: Reflect the default target port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 18, 2013 at 11:02:36AM -0400, John Ferlan wrote:
> From: Osier Yang <jyang@xxxxxxxxxx>
> 
> The default port for iSCSI target is 3260, which should be reflected
> to the pool's def.
> ---
>  src/storage/storage_backend_iscsi.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
> index ba4f388..08ba2d2 100644
> --- a/src/storage/storage_backend_iscsi.c
> +++ b/src/storage/storage_backend_iscsi.c
> @@ -44,12 +44,14 @@
>  
>  #define VIR_FROM_THIS VIR_FROM_STORAGE
>  
> +#define ISCSI_DEFAULT_TARGET_PORT 3260
> +
>  static char *
>  virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
>  {
>      char *portal = NULL;
>      const char *host;
> -    int port = 3260;
> +    int port;
>  
>      if (source->nhost != 1) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> @@ -60,6 +62,8 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
>      host = source->hosts[0].name;
>      if (source->hosts[0].port != 0)
>          port = source->hosts[0].port;
> +    else
> +        port = source->hosts[0].port = ISCSI_DEFAULT_TARGET_PORT;

I think this would read better as

    if (source->hosts[0].port == 0)
      source->hosts[0].port = ISCSI_DEFAULT_TARGET_PORT;

and just remove use of the separate 'port' variable
completely...

>  
>      if (strchr(host, ':')) {
>          ignore_value(virAsprintf(&portal, "[%s]:%d,1", host, port));

Just reference source->hosts[0].port here.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]