Просмотр исходного кода

This puts multiple nodeids on each [QUORUM] Members line instead of
putting each nodeid on a separate line. With more than a few nodes the
excessive lines become a real nuisance, and anyone up around 32 nodes
may literally be scrolling through hundreds of those lines.

from David teigland



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2565 fd59a12c-fef9-0310-b244-a6a79926bd2f

Christine Caulfield 16 лет назад
Родитель
Сommit
2e2581f574
1 измененных файлов с 27 добавлено и 3 удалено
  1. 27 3
      exec/vsf_quorum.c

+ 27 - 3
exec/vsf_quorum.c

@@ -103,6 +103,32 @@ static struct memb_ring_id quorum_ring_id;
 static size_t quorum_view_list_entries = 0;
 static int quorum_view_list[PROCESSOR_COUNT_MAX];
 struct quorum_services_api_ver1 *quorum_iface = NULL;
+static char view_buf[64];
+
+static void log_view_list(const unsigned int *view_list, size_t view_list_entries)
+{
+	int total = (int)view_list_entries;
+	int len, pos, ret;
+	int i = 0;
+
+	while (1) {
+		len = sizeof(view_buf);
+		pos = 0;
+		memset(view_buf, 0, len);
+
+		for (; i < total; i++) {
+			ret = snprintf(view_buf + pos, len - pos, " %d", view_list[i]);
+			if (ret >= len - pos)
+				break;
+			pos += ret;
+		}
+		log_printf (LOGSYS_LEVEL_NOTICE, "Members[%d]:%s%s",
+			    total, view_buf, i < total ? "\\" : "");
+
+		if (i == total)
+			break;
+	}
+}
 
 /* Internal quorum API function */
 static void quorum_api_set_quorum(const unsigned int *view_list,
@@ -123,9 +149,7 @@ static void quorum_api_set_quorum(const unsigned int *view_list,
 	memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id));
 	memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries);
 
-	log_printf (LOGSYS_LEVEL_NOTICE, "Members[%d]: ", (int)view_list_entries);
-	for (i=0; i<view_list_entries; i++)
-		log_printf (LOGSYS_LEVEL_NOTICE, "    %d ", view_list[i]);
+	log_view_list(view_list, view_list_entries);
 
 	/* Tell internal listeners */
 	send_internal_notification();