1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
*
* The Contents of this file are made available subject to the terms of
* the Sun Industry Standards Source License Version 1.2
*
* Sun Microsystems Inc., March, 2001
*
*
* Sun Industry Standards Source License Version 1.2
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.2 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2001 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
************************************************************************/
/*___INFO__MARK_END__*/
#include <string.h>
#include "uti/sge_rmon.h"
#include "uti/sge_log.h"
#include "uti/sge_prog.h"
#include "sgeobj/sge_all_listsL.h"
#include "comm/commlib.h"
#include "gdi/sge_gdi2.h"
#include "sge.h"
#include "qmaster_to_execd.h"
#include "msg_qmaster.h"
static int host_notify_about_X(sge_gdi_ctx_class_t *ctx,
lListElem *host,
u_long32 x,
int tag,
int progname_id);
/****** qmaster/host/host_notify_about_X() *************************************
* NAME
* host_notify_about_X() -- Send X to comproc
*
* SYNOPSIS
* static int host_notify_about_X(lListElem *host,
* u_long32 x,
* int tag,
* int progname_id)
*
* FUNCTION
* Sends the information "x" which will be tagged with "tag" to
* the comproc on "host" which is identified by "progname_id".
*
* Following combinations are meaningfull in the moment:
*
* x tag progname_id
* -------------- -------------------- ------------
* 0 or 1 TAG_KILL_EXECD EXECD
* featureset id TAG_NEW_FEATURES EXECD
* * TAG_GET_NEW_CONF EXECD
*
* INPUTS
* lListElem *host - EH_Type element
* u_long32 x - data
* int tag - tag for data
* int progname_id - programm name id
*
* RESULT
* int - error state
* 0 - no error
* -1 - error
* -2 - comproc with id "progname_id" not known on "host"
*
* NOTES
* We send an unacknowledged request for the moment.
* I would have a better feelin if we make some sort of acknowledgement.
*
* SEE ALSO
* qmaster/host/host_notify_about_featureset()
*******************************************************************************/
static int host_notify_about_X(sge_gdi_ctx_class_t *ctx,
lListElem *host,
u_long32 x,
int tag,
int progname_id)
{
const char *hostname = NULL;
sge_pack_buffer pb;
int ret = -1;
DENTER(TOP_LAYER, "host_notify_about_X");
hostname = lGetHost(host, EH_name);
if (progname_id == EXECD) {
unsigned long last_heard_from;
u_short id = 1;
const char *commproc = prognames[progname_id];
cl_commlib_get_last_message_time(cl_com_get_handle(prognames[QMASTER], 0),
(char*)hostname, (char*)commproc,id,
&last_heard_from);
if (!last_heard_from) {
ERROR((SGE_EVENT, MSG_NOXKNOWNONHOSTYTOSENDCONFNOTIFICATION_SS,
commproc, hostname));
DRETURN(-2);
}
}
if (init_packbuffer(&pb, 256, 0) == PACK_SUCCESS) {
u_long32 dummy = 0;
packint(&pb, x);
if (gdi2_send_message_pb(ctx, 0, prognames[progname_id], 1, hostname,
tag, &pb, &dummy) == CL_RETVAL_OK) {
ret = 0;
}
clear_packbuffer(&pb);
}
DRETURN(ret);
}
/****** qmaster/host/host_notify_about_new_conf() *****************************
* NAME
* host_notify_about_new_conf() -- Notify execd about new config.
*
* SYNOPSIS
* int host_notify_about_new_conf(lListElem *host)
*
* FUNCTION
* Notify execd that there is a new configuration available.
*
* INPUTS
* lListElem *host - EH_Type element
*
* RESULT
* int - see host_notify_about_X()
*
* SEE ALSO
* qmaster/host/host_notify_about_X()
*******************************************************************************/
int host_notify_about_new_conf(sge_gdi_ctx_class_t *ctx, lListElem *host)
{
return host_notify_about_X(ctx, host, 0, TAG_GET_NEW_CONF, EXECD);
}
/****** qmaster/host/host_notify_about_kill() *********************************
* NAME
* host_notify_about_kill() -- Send kill command to execd
*
* SYNOPSIS
* int host_notify_about_kill(lListElem *host, int kill_command)
*
* FUNCTION
* Send the given "kill_command" to the execution "host".
*
* INPUTS
* lListElem *host - EH_Type
* int kill_command - command
*
* RESULT
* int - see host_notify_about_X()
*
* SEE ALSO
* qmaster/host/host_notify_about_X()
*******************************************************************************/
int host_notify_about_kill(sge_gdi_ctx_class_t *ctx, lListElem *host, int kill_command)
{
return host_notify_about_X(ctx, host, kill_command, TAG_KILL_EXECD, EXECD);
}
int host_notify_about_full_load_report(sge_gdi_ctx_class_t *ctx, lListElem *host)
{
return host_notify_about_X(ctx, host, 0, TAG_FULL_LOAD_REPORT, EXECD);
}
|