clean up dead node links from discovery when reusing tpgt

This commit is contained in:
Chris Leech 2013-12-10 13:12:01 -08:00
parent 695b8c9be0
commit 5d97fd1468
2 changed files with 18 additions and 7 deletions

View File

@ -1,4 +1,4 @@
From cdb98072f7690cd9f5ec4aa5aa503711e552b5da Mon Sep 17 00:00:00 2001 From ef61cd4912e90c8202598f2fa4e9f1842a5b5822 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com> From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 12:39:07 -0700 Date: Tue, 13 Aug 2013 12:39:07 -0700
Subject: idbw_rec_write, pick tpgt from existing record Subject: idbw_rec_write, pick tpgt from existing record
@ -8,11 +8,11 @@ for existing new style records with tpgt before creating an old style
record without. If one exists, take the tpgt from it an write an record without. If one exists, take the tpgt from it an write an
updated new style record instead. updated new style record instead.
--- ---
usr/idbm.c | 36 ++++++++++++++++++++++++++++++++++++ usr/idbm.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+) 1 file changed, 40 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c diff --git a/usr/idbm.c b/usr/idbm.c
index cb6ffd1..5adbd95 100644 index cb6ffd1..0410079 100644
--- a/usr/idbm.c --- a/usr/idbm.c
+++ b/usr/idbm.c +++ b/usr/idbm.c
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
@ -23,7 +23,16 @@ index cb6ffd1..5adbd95 100644
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/file.h> #include <sys/file.h>
@@ -1884,12 +1885,48 @@ static int idbm_rec_write_old(node_rec_t *rec) @@ -162,6 +163,8 @@ static struct idbm *db;
_n++; \
} while(0)
+static int idbm_remove_disc_to_node_link(node_rec_t *rec, char *portal);
+
static void
idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri)
{
@@ -1884,12 +1887,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
FILE *f; FILE *f;
char *portal; char *portal;
int rc = 0; int rc = 0;
@ -65,6 +74,7 @@ index cb6ffd1..5adbd95 100644
+ if (tpgt != PORTAL_GROUP_TAG_UNKNOWN) { + if (tpgt != PORTAL_GROUP_TAG_UNKNOWN) {
+ log_warning("using tpgt %u from existing record", tpgt); + log_warning("using tpgt %u from existing record", tpgt);
+ rec->tpgt = tpgt; + rec->tpgt = tpgt;
+ rc = idbm_remove_disc_to_node_link(rec, portal);
+ free(portal); + free(portal);
+ return idbm_rec_write_new(rec); + return idbm_rec_write_new(rec);
+ } + }
@ -73,5 +83,5 @@ index cb6ffd1..5adbd95 100644
rec->name, rec->conn[0].address, rec->conn[0].port); rec->name, rec->conn[0].address, rec->conn[0].port);
-- --
1.8.1.4 1.8.3.1

View File

@ -297,8 +297,9 @@ fi
%{_includedir}/libiscsi.h %{_includedir}/libiscsi.h
%changelog %changelog
* Fri Dec 06 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-17 * Tue Dec 10 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-17
- fix regression in glob use, inappropriate error code escape - fix regression in glob use, inappropriate error code escape
- clean up dead node links from discovery when reusing tpgt
* Mon Nov 25 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-16 * Mon Nov 25 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-16
- fix iscsiuio socket activation - fix iscsiuio socket activation