[libvirt] [PATCH 5/5] virISCSIScanTargets: Allow making targets persistent

John Ferlan jferlan at redhat.com
Mon Jul 2 23:40:15 UTC 2018



On 06/29/2018 11:01 AM, Michal Privoznik wrote:
> After new iSCSI interface is successfully set up, we issue

s/new/a new/
s/issue/issue a/

> sendtargets command. However, after 56057900dc53df490d we don't
> update the host config which in turn makes login fail because
> iscsiadm is unable to find any matching record for the interface.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/storage/storage_backend_iscsi.c |  1 +
>  src/util/viriscsi.c                 | 21 ++++++++++++++++++---
>  src/util/viriscsi.h                 |  1 +
>  tests/viriscsitest.c                |  3 ++-
>  4 files changed, 22 insertions(+), 4 deletions(-)
> 

Like the previous patch - is there a specific bug or something that led
you down this path?  Can you show an example of the existing code that's
creating a bad command line and generating an error and then how this
fixes things.  It's not like we have tests and for this stuff it's
really nice to have plenty of examples.

> diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
> index 3b9dddb4fd..6242cd0fac 100644
> --- a/src/storage/storage_backend_iscsi.c
> +++ b/src/storage/storage_backend_iscsi.c
> @@ -196,6 +196,7 @@ virStorageBackendISCSIFindPoolSources(const char *srcSpec,
>  
>      if (virISCSIScanTargets(portal,
>                              source->initiator.iqn,
> +                            false,
>                              &ntargets, &targets) < 0)
>          goto cleanup;
>  
> diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
> index 365669aac2..baf41c5be1 100644
> --- a/src/util/viriscsi.c
> +++ b/src/util/viriscsi.c
> @@ -43,6 +43,7 @@ VIR_LOG_INIT("util.iscsi");
>  static int
>  virISCSIScanTargetsInternal(const char *portal,
>                              const char *ifacename,
> +                            bool persist,
>                              size_t *ntargetsret,
>                              char ***targetsret);
>  
> @@ -295,8 +296,10 @@ virISCSIConnection(const char *portal,
>               * portal. Without the sendtargets all that is received is a
>               * "iscsiadm: No records found". However, we must ensure that
>               * the command is issued over interface name we invented above.

s/above./above/

> +             * AND that targets are made persistent.

s/AND/and/

Similar to previous - with minor adjustments and explanation,

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

>               */
> -            if (virISCSIScanTargetsInternal(portal, ifacename, NULL, NULL) < 0)
> +            if (virISCSIScanTargetsInternal(portal, ifacename,
> +                                            true, NULL, NULL) < 0)
>                  goto cleanup;
>  
>              break;
[...]




More information about the libvir-list mailing list