>From 6d46420bbbadf6f276f087fa905388f4191e9140 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <[email protected]> Date: Fri, 11 Mar 2011 11:27:58 +0100 Subject: [PATCH] Keep startup mode in sync when specified in config file
When the startup mode has been specified in iscsid.conf it needs to be kept in sync for both settings, 'node.startup' and 'node.conn[0].startup'. References: bnc#458142 Signed-off-by: Hannes Reinecke <[email protected]> diff --git a/usr/idbm.c b/usr/idbm.c index c8f2896..85f5e7c 100644 --- a/usr/idbm.c +++ b/usr/idbm.c @@ -549,6 +549,8 @@ void idbm_recinfo_config(recinfo_t *info, FILE *f) char name[NAME_MAXVAL]; char value[VALUE_MAXVAL]; char *line, *nl, buffer[2048]; + char *node_startup_value = NULL; + char *conn_startup_value = NULL; int line_number = 0; int c = 0, i; @@ -607,8 +609,29 @@ void idbm_recinfo_config(recinfo_t *info, FILE *f) } *(value+i) = 0; + if (!strcmp(name, "node.startup")) { + node_startup_value = strdup(value); + } + if (!strcmp(name, "node.conn[0].startup")) { + conn_startup_value = strdup(value); + } (void)idbm_rec_update_param(info, name, value, line_number); } while (line); + /* + * Compat hack: + * Keep node.startup and node.conn[0].startup in sync even + * if only one of those has been specified in the config file. + */ + if (node_startup_value && !conn_startup_value) { + (void)idbm_rec_update_param(info, "node.conn[0].startup", + node_startup_value, -1); + free(node_startup_value); + } + if (conn_startup_value && !node_startup_value) { + (void)idbm_rec_update_param(info, "node.startup", + conn_startup_value, -1); + free(conn_startup_value); + } } /* -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
