Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: lib by andrew from
([email protected])
2. Linux-HA CVS: mgmt by zhenh from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Mon, 3 Apr 2006 03:51:57 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : lib
Dir : linux-ha/lib/crm/common
Modified Files:
utils.c
Log Message:
Instead of logging the partial inputs to the PE, compress and write them
to HA_VARLIBDIR"/heartbeat/pengine"
Inputs are stored in one of 3 series "errors", "warnings" and "other" depending
on what happened during the calculations.
For now it stores all of them and keeps a ".last" file for each series so
that older entries are not overwritten. Shortly there will be an option
to determin how many to keep from each series before overwriting the oldest
ones.
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/utils.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- utils.c 31 Mar 2006 11:58:17 -0000 1.38
+++ utils.c 3 Apr 2006 09:51:56 -0000 1.39
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.38 2006/03/31 11:58:17 andrew Exp $ */
+/* $Id: utils.c,v 1.39 2006/04/03 09:51:56 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -1148,7 +1148,8 @@
XML_RSC_ATTR_MULTIPLE,
XML_RSC_ATTR_STICKINESS,
XML_RSC_ATTR_FAIL_STICKINESS,
-
+ XML_RSC_ATTR_TARGET_ROLE,
+
/* ignore clone fields */
XML_RSC_ATTR_INCARNATION,
XML_RSC_ATTR_INCARNATION_MAX,
@@ -1264,3 +1265,131 @@
abort();
}
+
+char *
+generate_series_filename(
+ const char *directory, const char *series, int sequence, gboolean bzip)
+{
+ int len = 40;
+ char *filename = NULL;
+ const char *ext = "raw";
+
+ CRM_CHECK(directory != NULL, return NULL);
+ CRM_CHECK(series != NULL, return NULL);
+
+ len += strlen(directory);
+ len += strlen(series);
+ crm_malloc0(filename, sizeof(char)*len);
+ CRM_CHECK(filename != NULL, return NULL);
+
+ if(bzip) {
+ ext = "bz2";
+ }
+ sprintf(filename, "%s/%s-%d.%s", directory, series, sequence, ext);
+
+ return filename;
+}
+
+int
+get_last_sequence(const char *directory, const char *series)
+{
+ FILE *file_strm = NULL;
+ int start = 0, length = 0, read_len = 0;
+ char *series_file = NULL;
+ char *buffer = NULL;
+ int seq = 0;
+ int len = 36;
+
+ CRM_CHECK(directory != NULL, return 0);
+ CRM_CHECK(series != NULL, return 0);
+
+ len += strlen(directory);
+ len += strlen(series);
+ crm_malloc0(series_file, sizeof(char)*len);
+ CRM_CHECK(series_file != NULL, return 0);
+ sprintf(series_file, "%s/%s.last", directory, series);
+
+ file_strm = fopen(series_file, "r");
+ if(file_strm == NULL) {
+ crm_err("%s does not exist", series_file);
+ crm_free(series_file);
+ return 0;
+ }
+
+ /* see how big the file is */
+ start = ftell(file_strm);
+ fseek(file_strm, 0L, SEEK_END);
+ length = ftell(file_strm);
+ fseek(file_strm, 0L, start);
+
+ CRM_ASSERT(start == ftell(file_strm));
+
+ crm_debug_3("Reading %d bytes from file", length);
+ crm_malloc0(buffer, sizeof(char) * (length+1));
+ read_len = fread(buffer, sizeof(char), length, file_strm);
+
+ if(read_len != length) {
+ crm_err("Calculated and read bytes differ: %d vs. %d",
+ length, read_len);
+ crm_free(buffer);
+ buffer = NULL;
+
+ } else if(length <= 0) {
+ crm_info("%s was not valid", series_file);
+ crm_free(buffer);
+ buffer = NULL;
+ }
+
+ crm_free(series_file);
+ seq = crm_parse_int(buffer, "0");
+ crm_free(buffer);
+ fclose(file_strm);
+ return seq;
+}
+
+void
+write_last_sequence(
+ const char *directory, const char *series, int sequence, int max)
+{
+ int rc = 0;
+ int len = 36;
+ char *buffer = NULL;
+ FILE *file_strm = NULL;
+ char *series_file = NULL;
+
+ CRM_CHECK(directory != NULL, return);
+ CRM_CHECK(series != NULL, return);
+
+ if(max == 0) {
+ return;
+ }
+ while(max > 0 && sequence > max) {
+ sequence -= max;
+ }
+ buffer = crm_itoa(sequence);
+
+ len += strlen(directory);
+ len += strlen(series);
+ crm_malloc0(series_file, sizeof(char)*len);
+ CRM_CHECK(series_file != NULL, return);
+ sprintf(series_file, "%s/%s.last", directory, series);
+
+ file_strm = fopen(series_file, "w");
+ if(file_strm == NULL) {
+ crm_err("%s does not exist", series_file);
+ crm_free(series_file);
+ return;
+ }
+
+ rc = fprintf(file_strm, "%s", buffer);
+ if(rc < 0) {
+ cl_perror("Cannot write output to %s", series_file);
+ }
+
+ fflush(file_strm);
+ fclose(file_strm);
+
+
+ crm_free(series_file);
+ crm_free(buffer);
+}
------------------------------
Message: 2
Date: Mon, 3 Apr 2006 03:54:56 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : zhenh
Host :
Project : linux-ha
Module : mgmt
Dir : linux-ha/mgmt/client
Modified Files:
haclient.py.in
Log Message:
add standby/active support for node, fixed a bug of status bar
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/client/haclient.py.in,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- haclient.py.in 30 Mar 2006 10:33:06 -0000 1.17
+++ haclient.py.in 3 Apr 2006 09:54:55 -0000 1.18
@@ -513,11 +513,14 @@
status = _("stopped")
else :
dc = manager.get_dc()
- node_iter = None
if node in dc :
status = _("running(dc)")
else :
status = _("running")
+
+ if manager.get_node_config(node)["standby"] == "True" :
+ status = status + "-standby"
+
node_iter = self.store.append(nodes_root,[node, status, "node"])
if active :
@@ -1134,6 +1137,19 @@
self.set_action_sensitive('delrsc',
manager.connected
and self.cur_type in
[_("native"),_("group"),_("clone"),_("place"),_("order"),_("colocation"),_("master")])
+
+ self.set_action_sensitive('standby',
+ manager.connected
+ and self.cur_type in [_("node")]
+ and string.find(self.cur_status, "standby") == -1
+ and string.find(self.cur_status, "running") != -1)
+
+ self.set_action_sensitive('active',
+ manager.connected
+ and self.cur_type in [_("node")]
+ and string.find(self.cur_status, "standby") != -1
+ and string.find(self.cur_status, "running") != -1)
+
# functions
def update(self) :
self.tree.update()
@@ -1204,6 +1220,14 @@
def on_test(self, action) :
print uuid()
+ def on_standby(self, action) :
+ if confirmbox("Make" +" " +self.cur_name + " " +"standby"+"?") :
+ manager.do_cmd("standby\n"+self.cur_name + "\n" + "on")
+
+ def on_active(self, action) :
+ if confirmbox("Make" +" " +self.cur_name + " " + "active"+"?") :
+ manager.do_cmd("standby\n"+self.cur_name + "\n" + "off")
+
def on_add_item(self, action) :
new_type = kvbox(_("The type of new item"),
[Field("type",_("Item Type"),_("native"),
@@ -1280,6 +1304,8 @@
<menu action="action">
<menuitem action="addrsc"/>
<menuitem action="delrsc"/>
+ <menuitem action="standby"/>
+ <menuitem action="active"/>
</menu>
</menubar>
<toolbar name="toolbar">
@@ -1287,6 +1313,8 @@
<toolitem action="logout"/>
<toolitem action="addrsc"/>
<toolitem action="delrsc"/>
+ <toolitem action="standby"/>
+ <toolitem action="active"/>
<toolitem action="quit"/>
</toolbar>
</ui>'''
@@ -1299,7 +1327,9 @@
('quit', gtk.STOCK_QUIT, _('Quit'), None,_('Quit the
Program'), self.on_quit),
('action', None, _('Action')),
('addrsc', gtk.STOCK_ADD, _('Add New Item'),
None,_('add new item'), self.on_add_item),
- ('delrsc', gtk.STOCK_DELETE, _('Delete'),
None,_('delete current item'), self.on_del_item)
+ ('delrsc', gtk.STOCK_DELETE, _('Delete'),
None,_('delete current item'), self.on_del_item),
+ ('standby', gtk.STOCK_NO, _('Standby'), None,_('make
the node standby'), self.on_standby),
+ ('active', gtk.STOCK_YES, _('Active'), None,_('make the
node active'), self.on_active)
])
uimanager.insert_action_group(actiongroup, 0)
uimanager.add_ui_from_string(ui_xml)
@@ -1456,14 +1486,14 @@
event = mgmt_recvmsg()
log("on_event:"+str(event))
if event == "evt:cib_changed" :
- window.statusbar.push(1,"Updating data from server...")
if self.update_timer != -1 :
gobject.source_remove(self.update_timer)
+ else :
+ window.statusbar.push(1,"Updating data from
server...")
self.update_timer = gobject.timeout_add(100,
self.update)
return True
elif event == None or event == "evt:disconnected" :
self.logout()
- print self.active_nodes
for server in self.active_nodes :
if self.login(server, self.username,
self.password) :
break
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 29, Issue 5
*******************************************