2018-03-20 18:44:33 +03:00
/* -------------------------------------------------------------------------- */
2022-04-07 20:49:58 +03:00
/* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems */
2018-03-20 18:44:33 +03:00
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
2020-07-05 23:01:32 +03:00
# ifndef RANK_SCHEDULER_H_
# define RANK_SCHEDULER_H_
2018-03-20 18:44:33 +03:00
# include "Scheduler.h"
# include "SchedulerTemplate.h"
# include "RankPolicy.h"
# include "UserPriorityPolicy.h"
class RankScheduler : public Scheduler
{
public :
2018-10-09 12:42:17 +03:00
RankScheduler ( ) : Scheduler ( ) , rp_host ( 0 ) , rp_ds ( 0 ) , rp_nics ( 0 ) , rp_vm ( 0 ) { } ;
2018-03-20 18:44:33 +03:00
~ RankScheduler ( )
{
delete rp_host ;
delete rp_ds ;
2018-10-09 12:42:17 +03:00
delete rp_nics ;
2018-03-20 18:44:33 +03:00
delete rp_vm ;
} ;
void register_policies ( const SchedulerTemplate & conf )
{
rp_host = new RankHostPolicy ( hpool , conf . get_policy ( ) , 1.0 ) ;
add_host_policy ( rp_host ) ;
rp_ds = new RankDatastorePolicy ( dspool , conf . get_ds_policy ( ) , 1.0 ) ;
add_ds_policy ( rp_ds ) ;
rp_vm = new UserPriorityPolicy ( vmpool , 1.0 ) ;
add_vm_policy ( rp_vm ) ;
2018-10-09 12:42:17 +03:00
rp_nics = new RankNetworkPolicy ( vnetpool , conf . get_nics_policy ( ) , 1.0 ) ;
add_nic_policy ( rp_nics ) ;
2018-03-20 18:44:33 +03:00
} ;
private :
RankPolicy * rp_host ;
RankPolicy * rp_ds ;
2018-10-09 12:42:17 +03:00
RankPolicy * rp_nics ;
2018-03-20 18:44:33 +03:00
UserPriorityPolicy * rp_vm ;
2020-07-02 23:42:10 +03:00
} ;
2020-07-05 23:01:32 +03:00
# endif // RANK_SCHEDULER_H_