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__*/
38
#include "sge_schedd_conf.h"
39
#include "sge_usageL.h"
40
#include "sge_confL.h"
41
#include "sched_conf_qmaster.h"
42
#include "sge_event_master.h"
43
#include "sge_sched.h"
45
#include "setup_path.h"
46
#include "sge_answer.h"
47
#include "sge_centry.h"
49
#include "configuration_qmaster.h"
51
#include "sge_persistence_qmaster.h"
52
#include "spool/sge_spooling.h"
54
#include "msg_qmaster.h"
55
#include "msg_common.h"
59
static void check_reprioritize_interval(sge_gdi_ctx_class_t *ctx, lList **alpp, char *ruser, char *rhost);
62
int sge_read_sched_configuration(sge_gdi_ctx_class_t *ctx, lListElem *aSpoolContext, lList **anAnswer)
64
lList *sched_conf = NULL;
65
bool job_spooling = ctx->get_job_spooling(ctx);
67
DENTER(TOP_LAYER, "sge_read_sched_configuration");
69
spool_read_list(anAnswer, aSpoolContext, &sched_conf, SGE_TYPE_SCHEDD_CONF);
71
if (lGetNumberOfElem(sched_conf) == 0)
73
lListElem *ep = sconf_create_default();
75
if (sched_conf == NULL) {
76
sched_conf = lCreateList("schedd_config_list", SC_Type);
79
lAppendElem(sched_conf, ep);
80
spool_write_object(anAnswer, spool_get_default_context(), ep, "schedd_conf", SGE_TYPE_SCHEDD_CONF, job_spooling);
83
if (!sconf_set_config(&sched_conf, anAnswer))
85
lFreeList(&sched_conf);
90
check_reprioritize_interval(ctx, anAnswer, "local" , "local");
97
/************************************************************
98
sge_mod_sched_configuration - Master code
100
Modify scheduler configuration. We have only one entry in
101
Master_Sched_Config_List. So we replace it with the new one.
102
************************************************************/
103
int sge_mod_sched_configuration(
104
sge_gdi_ctx_class_t *ctx,
110
lList *temp_conf_list = NULL;
112
DENTER(TOP_LAYER, "sge_mod_sched_configuration");
114
if ( !confp || !ruser || !rhost ) {
115
CRITICAL((SGE_EVENT, MSG_SGETEXT_NULLPTRPASSED_S, SGE_FUNC));
116
answer_list_add(alpp, SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR);
118
return STATUS_EUNKNOWN;
120
temp_conf_list = lCreateList("sched config", SC_Type);
122
lSetUlong(confp, SC_weight_tickets_override,
123
sconf_get_weight_tickets_override());
125
confp = lCopyElem(confp);
126
lAppendElem(temp_conf_list, confp);
128
/* just check and log */
129
if (!sconf_set_config(&temp_conf_list, alpp)) {
130
lFreeList(&temp_conf_list);
132
return STATUS_EUNKNOWN;
135
if (!sge_event_spool(ctx,
136
alpp, 0, sgeE_SCHED_CONF,
137
0, 0, "schedd_conf", NULL, NULL,
138
confp, NULL, NULL, true, true)) {
139
answer_list_add(alpp, MSG_SCHEDCONF_CANTCREATESCHEDULERCONFIGURATION, STATUS_ESEMANTIC, ANSWER_QUALITY_ERROR);
144
check_reprioritize_interval(ctx, alpp, ruser, rhost);
146
INFO((SGE_EVENT, MSG_SGETEXT_MODIFIEDINLIST_SSSS, ruser, rhost, "scheduler", "scheduler configuration"));
147
answer_list_add(alpp, SGE_EVENT, STATUS_OK, ANSWER_QUALITY_INFO);
151
} /* sge_mod_sched_configuration */
154
static void check_reprioritize_interval(sge_gdi_ctx_class_t *ctx, lList **alpp, char *ruser, char *rhost)
156
DENTER(TOP_LAYER, "check_reprioritize_interval");
158
if (((sconf_get_reprioritize_interval() == 0) && (mconf_get_reprioritize())) ||
159
((sconf_get_reprioritize_interval() != 0) && (!mconf_get_reprioritize()))) {
160
bool flag = (sconf_get_reprioritize_interval() != 0) ? true : false;
161
lListElem *conf = sge_get_configuration_for_host(SGE_GLOBAL_NAME);
163
sge_set_conf_reprioritize(conf, flag);
165
sge_mod_configuration(ctx, conf, alpp, ruser, rhost);
172
} /* check_reprioritize_interval */