>>> Lee Duncan <[email protected]> schrieb am 15.11.2014 um 02:15 in
Nachricht <[email protected]>:
> From: Hannes Reinecke <[email protected]>
[...]
> diff --git a/utils/open-isns/config.c b/utils/open-isns/config.c
> index 731858854650..c2cbdfbce773 100644
> --- a/utils/open-isns/config.c
> +++ b/utils/open-isns/config.c
> @@ -92,6 +92,37 @@ __isns_config_defaults(void)
> }
>
> /*
> + * Read /etc/iscsi/initiatorname.iscsi
> + */
This comment is very much confising, because `filename' is read, not
/etc/iscsi/initiatorname.iscsi.
> +int
> +isns_read_initiatorname(const char *filename)
> +{
> + FILE *fp;
> + char *name, *pos;
> +
> + if ((fp = fopen(filename, "r")) == NULL) {
> + perror(filename);
> + return -1;
> + }
> +
> + while ((pos = parser_get_next_line(fp)) != NULL) {
> + pos[strcspn(pos, "#")] = '\0';
> +
> + if (!(name = parser_get_next_word(&pos)))
> + continue;
> + if (strcmp(name, "InitiatorName"))
> + continue;
> + if (pos[0] == '=')
> + pos++;
> + if (!strncmp(pos, "iqn.", 4))
> + isns_assign_string(&isns_config.ic_source_name, pos);
> + }
> +
> + fclose(fp);
> + return 0;
> +}
> +
> +/*
[...]
> diff --git a/utils/open-isns/isnsdd.c b/utils/open-isns/isnsdd.c
> index 850060a53294..5b0dfb4c56fe 100644
> --- a/utils/open-isns/isnsdd.c
> +++ b/utils/open-isns/isnsdd.c
> @@ -161,6 +161,7 @@ main(int argc, char **argv)
> if (optind != argc)
> usage(1, NULL);
>
> +#if 0
> /* If the config code derives the source name
> * automatically, we want it to be distinct from
> * any other source name (chosen by eg the iSCSI
> @@ -168,11 +169,21 @@ main(int argc, char **argv)
> * somewhat lame attempt.
> */
> isns_config.ic_source_suffix = "isns";
> -
> +#endif
> isns_read_config(opt_configfile);
>
> + if (!isns_config.ic_source_name) {
> + /*
> + * Try to read the source name from open-iscsi configuration
> + */
> + isns_read_initiatorname(ISCSI_DEFAULT_INITIATORNAME);
You might add the comment here instead ;-)
> + }
> +
> + isns_init_names();
> +
> if (!isns_config.ic_source_name)
> usage(1, "Please specify an iSNS source name");
> +
> source = isns_source_create_iscsi(isns_config.ic_source_name);
>
> isns_write_pidfile(isns_config.ic_pidfile);
> diff --git a/utils/open-isns/paths.h b/utils/open-isns/paths.h
> index b54612c55479..d0deabd3bfaa 100644
> --- a/utils/open-isns/paths.h
> +++ b/utils/open-isns/paths.h
> @@ -19,4 +19,6 @@
> #define ISNS_DEFAULT_ISNSADM_CONFIG ISNS_ETCDIR "/isnsadm.conf"
> #define ISNS_DEFAULT_LOCAL_REGISTRY ISNS_RUNDIR "/isns.registry"
>
> +#define ISCSI_DEFAULT_INITIATORNAME "/etc/iscsi/initiatorname.iscsi"
> +
> #endif /* ISNS_CONFIG_H */
> --
> 2.1.2
>
> --
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.