1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
37
#include "sge_object.h"
38
#include "sge_cqueue.h"
39
#include "sge_qinstance.h"
40
#include "sge_qinstance_state.h"
42
#include "msg_mirlib.h"
44
#include "sge_mirror.h"
45
#include "sge_queue_mirror.h"
48
cqueue_update_master_list(sge_evc_class_t *evc, object_description *object_base, sge_object_type type,
49
sge_event_action action, lListElem *event, void *clientdata)
51
sge_callback_result ret = SGE_EMA_OK;
52
const char *name = NULL;
53
lList *qinstance_list = NULL;
54
lListElem *cqueue = NULL;
56
const lDescr *list_descr = NULL;
58
DENTER(TOP_LAYER, "cqueue_update_master_list");
59
name = lGetString(event, ET_strkey);
60
list = sge_master_list(object_base, SGE_TYPE_CQUEUE);
61
list_descr = lGetListDescr(lGetList(event, ET_new_version));
62
cqueue = cqueue_list_locate(*list, name);
64
if ((action == SGE_EMA_MOD || action == SGE_EMA_ADD)
67
* modify events for CQ_Type objects; we may not update
68
* - CQ_qinstances - it is maintained by QINSTANCE events
70
lXchgList(cqueue, CQ_qinstances, &qinstance_list);
73
ret &= (sge_mirror_update_master_list(list, list_descr, cqueue,
74
name, action, event) == SGE_EM_OK) ? SGE_EMA_OK : SGE_EMA_FAILURE;
75
cqueue = cqueue_list_locate(*list, name);
77
if ((action == SGE_EMA_MOD || action == SGE_EMA_ADD)
80
* Replace CQ_qinstances list
82
lXchgList(cqueue, CQ_qinstances, &qinstance_list);
83
lFreeList(&qinstance_list);
91
qinstance_update_cqueue_list(sge_evc_class_t *evc, object_description *object_base, sge_object_type type,
92
sge_event_action action, lListElem *event, void *clientdata)
94
sge_callback_result ret = SGE_EMA_OK;
95
const char *name = NULL;
96
const char *hostname = NULL;
97
lListElem *cqueue = NULL;
99
DENTER(TOP_LAYER, "qinstance_update_cqueue_list");
100
name = lGetString(event, ET_strkey);
101
hostname = lGetString(event, ET_strkey2);
103
cqueue = cqueue_list_locate( *(sge_master_list(object_base, SGE_TYPE_CQUEUE)), name);
105
if (cqueue != NULL) {
106
dstring key_buffer = DSTRING_INIT;
107
lList *list = lGetList(cqueue, CQ_qinstances);
108
const lDescr *list_descr = lGetListDescr(lGetList(event, ET_new_version));
110
lListElem *qinstance = qinstance_list_locate(list, hostname, NULL);
111
const char *key = NULL;
112
bool is_list = list != NULL ? true : false;
114
sge_dstring_sprintf(&key_buffer, SFN"@"SFN, name, hostname);
115
key = sge_dstring_get_string(&key_buffer);
117
if (action == SGE_EMA_MOD) {
118
u_long32 type = lGetUlong(event, ET_type);
120
if (type == sgeE_QINSTANCE_SOS ||
121
type == sgeE_QINSTANCE_USOS) {
122
if (qinstance != NULL) {
123
if (type == sgeE_QINSTANCE_SOS) {
124
qinstance_state_set_susp_on_sub(qinstance, true);
126
qinstance_state_set_susp_on_sub(qinstance, false);
129
ERROR((SGE_EVENT, MSG_QINSTANCE_CANTFINDFORUPDATEIN_SS, key,
131
ret = SGE_EMA_FAILURE;
133
sge_dstring_free(&key_buffer);
138
ret &= (sge_mirror_update_master_list(&list, list_descr, qinstance, key,
139
action, event) == SGE_EM_OK) ? true : false;
140
sge_dstring_free(&key_buffer);
142
lSetList(cqueue, CQ_qinstances, list);
145
ERROR((SGE_EVENT, MSG_CQUEUE_CANTFINDFORUPDATEIN_SS, name, SGE_FUNC));
146
ret = SGE_EMA_FAILURE;