1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #1243: Add configuration option to select the rescheduling type

This commit is contained in:
Ruben S. Montero 2012-04-29 23:38:40 +02:00
parent f2105549a7
commit 38c5992cd8
6 changed files with 35 additions and 7 deletions

View File

@ -18,6 +18,8 @@
# MAX_HOST: Maximum number of Virtual Machines dispatched to a given host in
# each scheduling action
#
# LIVE_RESCHEDS: Perform live (1) or cold migrations (0) when rescheduling a VM
#
# DEFAULT_SCHED: Definition of the default scheduling algorithm
# - policy:
# 0 = Packing. Heuristic that minimizes the number of hosts in use by
@ -41,6 +43,8 @@ MAX_DISPATCH = 30
MAX_HOST = 1
LIVE_RESCHEDS = 0
DEFAULT_SCHED = [
policy = 1
]

View File

@ -155,6 +155,11 @@ private:
*/
unsigned int host_dispatch_limit;
/**
* Type of migrations when rescheduling a VM: 0 cold, 1 live
*/
unsigned int live_rescheds;
/**
* Threshold value to round up freecpu
*/

View File

@ -27,10 +27,10 @@ class VirtualMachinePoolXML : public PoolXML
{
public:
VirtualMachinePoolXML(
Client* client,
unsigned int machines_limit
):PoolXML(client, machines_limit){};
VirtualMachinePoolXML(Client* client,
unsigned int machines_limit,
bool _live_resched):
PoolXML(client, machines_limit), live_resched(_live_resched){};
~VirtualMachinePoolXML(){};
@ -47,6 +47,12 @@ public:
return static_cast<VirtualMachineXML *>(PoolXML::get(oid));
};
/**
* Dispatch a VM to the given host
* @param vid the VM id
* @param hid the id of the target host
* @param resched the machine is going to be rescheduled
*/
int dispatch(int vid, int hid, bool resched) const;
protected:
@ -60,6 +66,9 @@ protected:
virtual void add_object(xmlNodePtr node);
virtual int load_info(xmlrpc_c::value &result);
/* Do live migrations to resched VMs*/
bool live_resched;
};
#endif /* VM_POOL_XML_H_ */

View File

@ -122,7 +122,7 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, bool resched) const
client->get_oneauth().c_str(), // argument 0 (AUTH)
vid, // argument 1 (VM)
hid, // argument 2 (HOST)
true); // argument 3 (LIVE)
live_resched); // argument 3 (LIVE)
}
else
{

View File

@ -136,6 +136,8 @@ void Scheduler::start()
conf.get("MAX_DISPATCH", dispatch_limit);
conf.get("MAX_HOST", host_dispatch_limit);
conf.get("LIVE_RESCHEDS", live_rescheds);
oss.str("");
@ -169,8 +171,9 @@ void Scheduler::start()
// -----------------------------------------------------------
hpool = new HostPoolXML(client);
vmpool = new VirtualMachinePoolXML(client, machines_limit);
vmpool = new VirtualMachinePoolXML(client,
machines_limit,
(live_rescheds == 1));
acls = new AclXML(client);
// -----------------------------------------------------------

View File

@ -40,6 +40,7 @@ void SchedulerTemplate::set_conf_default()
# MAX_DISPATCH
# MAX_HOST
# DEFAULT_SCHED
# LIVE_RESCHEDS
#-------------------------------------------------------------------------------
*/
// ONED_PORT
@ -71,6 +72,12 @@ void SchedulerTemplate::set_conf_default()
attribute = new SingleAttribute("MAX_HOST",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//LIVE_RESCHEDS
value = "0";
attribute = new SingleAttribute("LIVE_RESCHEDS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DEFAULT_SCHED
map<string,string> vvalue;