Hello All,
Patch for the bug #2884312 (oa_soap: Switchover removes and re-inserts
resources - ID: 2884312) is attached fore review. This patch applies
only to oa_soap plugin. This patch avoids the rediscovery of resources
on switchover. Please review the patch and provide the feedback comments
before the end of this month.
Thanks
Mohan
--
mo...@fc <[email protected]>
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap.c new/plugins/oa_soap/oa_soap.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap.c 2009-10-22 15:24:14.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -34,6 +34,7 @@
* Raja Kumar Thatte <[email protected]>
* Sudesh Acharya <[email protected]>
* Vivek Kumar <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*
* This file implements the entry point of the oa soap plug-in. This handles
* customer handler for oa soap interface for handling the any request for soap
@@ -121,6 +122,7 @@ SaErrorT build_oa_soap_custom_handler(st
oa_handler->mutex = g_mutex_new();
oa_handler->oa_1 = NULL;
oa_handler->oa_2 = NULL;
+ oa_handler->oa_switching=SAHPI_FALSE;
oa_handler->shutdown_event_thread = SAHPI_FALSE;
/* Initialize the oa_info structure */
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_callsupport.c new/plugins/oa_soap/oa_soap_callsupport.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap_callsupport.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_callsupport.c 2009-10-22 15:24:37.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -30,6 +30,7 @@
*
* Author(s)
* Bryan Sutula <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*
*
* This file implements support functions that are used to perform SOAP
@@ -530,7 +531,7 @@ SOAP_CON *soap_open(char *server,
/* Login to the OA, saving session information */
if (soap_login(connection)) {
- err("OA login failed");
+ err("OA login failed for server %s", connection->server);
if (oh_ssl_ctx_free(connection->ctx)) {
err("oh_ssl_ctx_free() failed");
}
@@ -1095,7 +1096,7 @@ int soap_call(SOAP_CON *conn
*/
if (! connection->session_id[0]) {
if (soap_login(connection)) {
- err("OA login failed");
+ err("OA login failed in soap call");
return(-1);
}
} /* If we don't have a session key */
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_event.c new/plugins/oa_soap/oa_soap_event.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap_event.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_event.c 2009-10-22 15:38:28.000000000 -0600
@@ -158,6 +158,19 @@ gpointer oa_soap_event_thread(gpointer o
}
}
+ /* If the OA server is NULL, do not even try to open the connection
+ just get out */
+ if (!strcmp(oa->server,"")) {
+ g_thread_exit((gpointer *)NULL);
+ }
+
+ /* The following is an workaround for an OA bug, where the IP is
+ returned as 0.0.0.0 Just quit in that case also */
+ if (!strcmp(oa->server,"0.0.0.0")) {
+ err("OA returned IP is 0.0.0.0.");
+ g_thread_exit((gpointer *)NULL);
+ }
+
/* Check whether OA Status is ABSENT
* If yes, wait till the OA status becomes ACTIVE or STANDBY
*/
@@ -200,7 +213,7 @@ gpointer oa_soap_event_thread(gpointer o
OA_SOAP_CHEK_SHUTDOWN_REQ(oa_handler, NULL, NULL, NULL);
oa->event_con2 = soap_open(url, user_name, password,
HPI_CALL_TIMEOUT);
- if (oa->event_con2 == NULL)
+ if (oa->event_con2 == NULL)
sleep(2);
}
@@ -264,11 +277,17 @@ gpointer oa_soap_event_thread(gpointer o
soap_open(url, user_name,
password,
HPI_CALL_TIMEOUT);
- if (oa->event_con2 == NULL)
- sleep(2);
+ if (oa->event_con2 == NULL) {
+ if (oa->oa_status == OA_ABSENT)
+ sleep(60);
+ else
+ sleep(5);
+ err("soap_open for oa->event_con2 failed\n");
+ }
}
} /* end of else (non-switchover error handling) */
} /* end of else (SOAP call failure handling) */
+
} /* end of 'while(listen_for_events == SAHPI_TRUE)' loop */
return (gpointer *) SA_OK;
@@ -294,6 +313,7 @@ void oa_soap_error_handling(struct oh_ha
struct oa_info *oa)
{
SaErrorT rv = SA_OK;
+ int is_switchover = SAHPI_FALSE;
SaHpiBoolT is_oa_accessible = SAHPI_FALSE;
struct oa_soap_handler *oa_handler = NULL;
SaHpiInt32T error_code;
@@ -306,6 +326,10 @@ void oa_soap_error_handling(struct oh_ha
oa_handler = (struct oa_soap_handler *) oh_handler->data;
+ /* If the OA is not PRESENT, then do not even try. Just get out */
+ if ( oa->oa_status == OA_ABSENT )
+ return;
+
/* Check whether OA was present. If not, event_con will be NULL */
g_mutex_lock(oa->mutex);
if (oa->event_con == NULL) {
@@ -368,7 +392,7 @@ void oa_soap_error_handling(struct oh_ha
*/
OA_SOAP_CHEK_SHUTDOWN_REQ(oa_handler, oa_handler->mutex,
oa->mutex, NULL);
- rv = oa_soap_re_discover_resources(oh_handler, oa);
+ rv = oa_soap_re_discover_resources(oh_handler, oa, is_switchover);
g_mutex_unlock(oa->mutex);
g_mutex_unlock(oa_handler->mutex);
if (rv != SA_OK) {
@@ -456,9 +480,9 @@ void process_oa_out_of_access(struct oh_
oa_was_removed = SAHPI_TRUE;
/* OA is not present,
- * wait for 5 seconds and check again
+ * wait for 30 seconds and check again
*/
- sleep(5);
+ sleep(30);
}
}
@@ -524,8 +548,13 @@ void process_oa_out_of_access(struct oh_
if (rv == SA_OK) {
is_oa_reachable = SAHPI_TRUE;
} else {
- /* Wait for 2 seconds and try again */
- sleep(2);
+ /* If switchover is in progress, then sleep longer */
+ if (( oa_handler->oa_switching == SAHPI_TRUE ) ||
+ ( oa->oa_status == OA_ABSENT ))
+ sleep(30);
+ else
+ sleep(2);
+ dbg("check_oa_status failed, oa_status is %d\n",oa->oa_status);
/* OA is not accessible. Restart the timer */
g_timer_start(timer);
/* Double the timeout value until it reaches
@@ -896,6 +925,7 @@ void process_oa_events(struct oh_handler
"-- Not processed");
break;
case EVENT_MEDIA_INSERTED:
+ /* EVENT_OA_INFO that arrives later is processed */
dbg("EVENT_MEDIA_INSERTED -- Not processed");
break;
case EVENT_MEDIA_REMOVED:
Only in latest_oct21_2009/plugins/oa_soap: .oa_soap_event.c.swp
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap.h new/plugins/oa_soap/oa_soap.h
--- latest_oct21_2009/plugins/oa_soap/oa_soap.h 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap.h 2009-10-22 15:23:47.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -34,6 +34,7 @@
* Raja Kumar Thatte <[email protected]>
* Vivek Kumar <[email protected]>
* Shuah Khan <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*/
#ifndef _OA_SOAP_H
@@ -134,9 +135,9 @@
#define OA_2_21 2.21
/* OA switchover re-try wait period */
-#define WAIT_ON_SWITCHOVER 1
+#define WAIT_ON_SWITCHOVER 10
/* OA switchover max re-try */
-#define MAX_RETRY_ON_SWITCHOVER 1
+#define MAX_RETRY_ON_SWITCHOVER 10
/* Enum for storing the status of the plugin */
enum oa_soap_plugin_status {
@@ -202,6 +203,7 @@ struct oa_soap_handler
/* Type of the enclsoure */
SaHpiInt32T enc_type;
SaHpiBoolT shutdown_event_thread;
+ SaHpiInt32T oa_switching;
GMutex *mutex;
};
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_oa_event.c new/plugins/oa_soap/oa_soap_oa_event.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap_oa_event.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_oa_event.c 2009-10-22 15:21:19.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -30,6 +30,7 @@
*
* Author(s)
* Raghavendra P.G. <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*
* This file has the OA related events handling
*
@@ -150,6 +151,7 @@ SaErrorT process_oa_failover_event(struc
GTimer *timer = NULL;
gulong micro_seconds;
gdouble time_elapsed = 0;
+ int is_switchover = SAHPI_TRUE;
if (oh_handler == NULL || oa == NULL) {
err("Invalid parameters");
@@ -167,8 +169,9 @@ SaErrorT process_oa_failover_event(struc
return SA_OK;
}
- err("OA got switched over");
+ err("OA switching started");
oa_handler = (struct oa_soap_handler *) oh_handler->data;
+ oa_handler->oa_switching=SAHPI_TRUE;
/* Always lock the oa_handler mutex and then oa_info mutex
* This is to avoid the deadlock
@@ -272,6 +275,7 @@ SaErrorT process_oa_failover_event(struc
}
OA_SOAP_CHEK_SHUTDOWN_REQ(oa_handler, NULL, NULL, NULL);
+
/* Check the OA staus there may be change in OA state */
rv = check_oa_status(oa_handler, oa, oa->event_con);
if (rv != SA_OK) {
@@ -290,6 +294,8 @@ SaErrorT process_oa_failover_event(struc
g_mutex_lock(oa->mutex);
if (oa->oa_status != ACTIVE) {
g_mutex_unlock(oa->mutex);
+ oa_handler->oa_switching=SAHPI_FALSE;
+ err("OA switching completed");
return SA_OK;
}
g_mutex_unlock(oa->mutex);
@@ -306,10 +312,14 @@ SaErrorT process_oa_failover_event(struc
*/
OA_SOAP_CHEK_SHUTDOWN_REQ(oa_handler, oa_handler->mutex, oa->mutex,
NULL);
- rv = oa_soap_re_discover_resources(oh_handler, oa);
+ rv = oa_soap_re_discover_resources(oh_handler, oa, is_switchover);
g_mutex_unlock(oa->mutex);
g_mutex_unlock(oa_handler->mutex);
+ /* At this point assume that switchover is complete */
+ oa_handler->oa_switching=SAHPI_FALSE;
+ err("OA switching completed");
+
if (rv != SA_OK) {
err("Re-discovery failed for OA %s", oa->server);
oa_soap_error_handling(oh_handler, oa);
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_re_discover.c new/plugins/oa_soap/oa_soap_re_discover.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap_re_discover.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_re_discover.c 2009-10-22 15:23:58.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -33,6 +33,7 @@
* Vivek Kumar <[email protected]>
* Raghavendra M.S. <[email protected]>
* Shuah Khan <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*
* This file implements the re-discovery functionality. The resources of the
* HP BladeSystem c-Class are re-discovered, whenever the connection to the
@@ -124,7 +125,7 @@ static SaErrorT oa_soap_re_disc_therm_su
* SA_ERR_HPI_INTERNAL_ERROR - on failure.
**/
SaErrorT oa_soap_re_discover_resources(struct oh_handler_state *oh_handler,
- struct oa_info *oa)
+ struct oa_info *oa, int oa_switched)
{
SaErrorT rv = SA_OK;
struct oa_soap_handler *oa_handler = NULL;
@@ -138,6 +139,22 @@ SaErrorT oa_soap_re_discover_resources(s
err("Re-discovery started");
+ /* The following is applicable only to OA Switchover cases
+ Just rediscover oa and end the whole thing. If some other hardware
+ is removed at the same time, then it is a separate case that needs to
+ be handled separately */
+
+ if ( oa_switched == SAHPI_TRUE ) {
+ OA_SOAP_CHEK_SHUTDOWN_REQ(oa_handler, oa_handler->mutex, oa->mutex,
+ NULL);
+ rv = re_discover_oa(oh_handler, oa->event_con);
+ if (rv != SA_OK) {
+ err("Re-discovery of OA failed");
+ }
+ oa_switched = 0;
+ return rv;
+ }
+
/* Re-discovery is called by locking the OA handler mutex and oa_info
* mutex. Hence on getting request to shutdown, pass the locked mutexes
* for unlocking
@@ -447,7 +464,6 @@ SaErrorT remove_oa(struct oh_handler_sta
bay_number, "",
SAHPI_UNSPECIFIED_RESOURCE_ID,
RES_ABSENT);
-
return SA_OK;
}
@@ -631,7 +647,7 @@ SaErrorT add_oa(struct oh_handler_state
}
return SA_OK;
-}
+} /* add_oa */
/**
* re_discover_blade
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_re_discover.h new/plugins/oa_soap/oa_soap_re_discover.h
--- latest_oct21_2009/plugins/oa_soap/oa_soap_re_discover.h 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_re_discover.h 2009-10-22 15:23:27.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -30,6 +30,7 @@
*
* Author(s)
* Raghavendra P.G. <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*/
#ifndef _OA_SOAP_RE_DISCOVER_H
@@ -45,7 +46,7 @@
#include "oa_soap_lcd_event.h"
SaErrorT oa_soap_re_discover_resources(struct oh_handler_state *oh_handler,
- struct oa_info *oa);
+ struct oa_info *oa, int oa_switched);
SaErrorT re_discover_oa(struct oh_handler_state *oh_handler,
SOAP_CON *con);
diff -rup latest_oct21_2009/plugins/oa_soap/oa_soap_utils.c new/plugins/oa_soap/oa_soap_utils.c
--- latest_oct21_2009/plugins/oa_soap/oa_soap_utils.c 2009-10-21 15:35:31.000000000 -0600
+++ new/plugins/oa_soap/oa_soap_utils.c 2009-10-22 15:21:51.000000000 -0600
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, Hewlett-Packard Development Company, LLP
+ * Copyright (C) 2007-2009, Hewlett-Packard Development Company, LLP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -32,6 +32,7 @@
* Raghavendra P.G. <[email protected]>
* Vivek Kumar <[email protected]>
* Shuah Khan <[email protected]>
+ * Mohan Devarajulu <[email protected]>
*
* This file implements all the utility functions which will be useful of oa
* soap functioning. Majority of the functions are helper functions for
@@ -1029,9 +1030,9 @@ void create_oa_connection(struct oa_soap
} else {
g_mutex_unlock(oa->mutex);
/* OA is not present,
- * wait for 5 seconds and check again
+ * wait for 30 seconds and check again
*/
- sleep(5);
+ sleep(30);
}
}
@@ -1048,7 +1049,7 @@ void create_oa_connection(struct oa_soap
g_mutex_unlock(oa->mutex);
rv = initialize_oa_con(oa, user_name, password);
- if (rv != SA_OK) {
+ if ((rv != SA_OK) && (oa->oa_status != OA_ABSENT)) {
/* OA may not be reachable
* wait for 2 seconds and check again
*/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel