Change in osmo-hlr[master]: add --db-check option

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Thu Oct 31 03:49:58 UTC 2019


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/15912 )


Change subject: add --db-check option
......................................................................

add --db-check option

This allows starting osmo-hlr to merely open the database, do upgrades if
necessary, and quit, without opening any ports.

Needed for upcoming patch that introduces a db_upgrade test, in
I0961bab0e17cfde5b030576c5bc243c2b51d9dc4.

Change-Id: I1a4b3360690acd2cd3cffdadffbb00a28d421316
---
M src/hlr.c
1 file changed, 16 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/12/15912/1

diff --git a/src/hlr.c b/src/hlr.c
index 8b9dff1..f9cc2f5 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -706,6 +706,7 @@
 	printf("  -T --timestamp             Prefix every log line with a timestamp.\n");
 	printf("  -e --log-level number      Set a global loglevel.\n");
 	printf("  -U --db-upgrade            Allow HLR database schema upgrades.\n");
+	printf("  -C --db-check              Quit after opening (and upgrading) the database.\n");
 	printf("  -V --version               Print the version of OsmoHLR.\n");
 }
 
@@ -714,6 +715,7 @@
 	const char *db_file;
 	bool daemonize;
 	bool db_upgrade;
+	bool db_check;
 } cmdline_opts = {
 	.config_file = "osmo-hlr.cfg",
 	.db_file = NULL,
@@ -735,6 +737,7 @@
 			{"log-level", 1, 0, 'e'},
 			{"timestamp", 0, 0, 'T'},
 			{"db-upgrade", 0, 0, 'U' },
+			{"db-check", 0, 0, 'C' },
 			{"version", 0, 0, 'V' },
 			{0, 0, 0, 0}
 		};
@@ -773,6 +776,9 @@
 		case 'U':
 			cmdline_opts.db_upgrade = true;
 			break;
+		case 'C':
+			cmdline_opts.db_check = true;
+			break;
 		case 'V':
 			print_version(1);
 			exit(0);
@@ -879,6 +885,16 @@
 		exit(1);
 	}
 
+	if (cmdline_opts.db_check) {
+		LOGP(DMAIN, LOGL_NOTICE, "Cmdline option --db-check: Database was opened successfully, quitting.\n");
+		db_close(g_hlr->dbc);
+		log_fini();
+		talloc_free(hlr_ctx);
+		talloc_free(tall_vty_ctx);
+		talloc_disable_null_tracking();
+		exit(0);
+	}
+
 	g_hlr->gs = osmo_gsup_server_create(hlr_ctx, g_hlr->gsup_bind_addr, OSMO_GSUP_PORT,
 					    read_cb, &g_lu_ops, g_hlr);
 	if (!g_hlr->gs) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/15912
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I1a4b3360690acd2cd3cffdadffbb00a28d421316
Gerrit-Change-Number: 15912
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191031/82f23e4e/attachment.htm>


More information about the gerrit-log mailing list