clean up dead node links from discovery when reusing tpgt

Resolves: #1066115

Signed-off-by: Chris Leech <cleech@redhat.com>
This commit is contained in:
Chris Leech 2013-12-10 13:12:01 -08:00
parent 85bed4b120
commit 46eb122df3

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>
Date: Tue, 13 Aug 2013 12:39:07 -0700
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
updated new style record instead.
---
usr/idbm.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
usr/idbm.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index cb6ffd1..5adbd95 100644
index cb6ffd1..0410079 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -27,6 +27,7 @@
@ -23,7 +23,16 @@ index cb6ffd1..5adbd95 100644
#include <sys/stat.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)
{
@@ -2082,12 +2085,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
FILE *f;
char *portal;
int rc = 0;
@ -65,6 +74,7 @@ index cb6ffd1..5adbd95 100644
+ if (tpgt != PORTAL_GROUP_TAG_UNKNOWN) {
+ log_warning("using tpgt %u from existing record", tpgt);
+ rec->tpgt = tpgt;
+ rc = idbm_remove_disc_to_node_link(rec, portal);
+ free(portal);
+ return idbm_rec_write_new(rec);
+ }
@ -73,5 +83,5 @@ index cb6ffd1..5adbd95 100644
rec->name, rec->conn[0].address, rec->conn[0].port);
--
1.8.1.4
1.8.3.1