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

F #2983: Option to set cold migration type (#153)

* F #2983: Option to set cold migration type

* M #-: Use set_conf_single in scheduler template
This commit is contained in:
Pavel Czerný 2020-08-15 21:34:15 +02:00 committed by GitHub
parent afbf0e472b
commit 79d125c6dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 69 deletions

View File

@ -24,6 +24,11 @@
#
# LIVE_RESCHEDS: Perform live (1) or cold migrations (0) when rescheduling a VM
#
# COLD_MIGRATE_MODE: Type of cold migration, see documentation for one.vm.migrate
# 0 = save - default
# 1 = poweroff
# 2 = poweroff-hard
#
# DEFAULT_SCHED: Definition of the default scheduling algorithm
# - policy:
# 0 = Packing. Heuristic that minimizes the number of hosts in use by
@ -98,6 +103,7 @@ MAX_DISPATCH = 30
MAX_HOST = 1
LIVE_RESCHEDS = 0
COLD_MIGRATE_MODE = 0
MEMORY_SYSTEM_DS_SCALE = 0

View File

@ -28,8 +28,12 @@ public:
VirtualMachinePoolXML(Client* client,
unsigned int machines_limit,
bool _live_resched):
PoolXML(client, machines_limit), live_resched(_live_resched){};
bool _live_resched,
unsigned int _cold_migrate_mode)
: PoolXML(client, machines_limit)
, live_resched(_live_resched)
, cold_migrate_mode(_cold_migrate_mode)
{}
virtual ~VirtualMachinePoolXML(){};
@ -119,6 +123,8 @@ protected:
*/
bool live_resched;
unsigned int cold_migrate_mode;
private:
/**
* Stores the list of vms, and it associated user prioty vm_resources.
@ -135,7 +141,7 @@ public:
VirtualMachineActionsPoolXML(Client* client,
unsigned int machines_limit):
VirtualMachinePoolXML(client, machines_limit, false){};
VirtualMachinePoolXML(client, machines_limit, false, 0){};
virtual ~VirtualMachineActionsPoolXML(){};
@ -184,7 +190,7 @@ class VirtualMachineRolePoolXML : public VirtualMachinePoolXML
public:
VirtualMachineRolePoolXML(Client * client, unsigned int machines_limit):
VirtualMachinePoolXML(client, machines_limit, false){};
VirtualMachinePoolXML(client, machines_limit, false, 0){};
virtual ~VirtualMachineRolePoolXML(){};

View File

@ -257,12 +257,15 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, int dsid, bool resched,con
if (resched == true)
{
client->call("one.vm.migrate",// methodName
"iibb", // arguments format
"iibbii", // arguments format
&deploy_result, // resultP
vid, // argument 1 (VM)
hid, // argument 2 (HOST)
live_resched, // argument 3 (LIVE)
false); // argument 4 (ENFORCE)
false, // argument 4 (ENFORCE)
-1, // argument 5 (DS_ID)
cold_migrate_mode // argument 6 (0 save, 1 poweroff, 2 poweroff hard)
);
}
else
{
@ -272,8 +275,8 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, int dsid, bool resched,con
vid, // argument 1 (VM)
hid, // argument 2 (HOST)
false, // argument 3 (ENFORCE)
dsid, // argument 5 (SYSTEM SD)
extra_template.c_str()); // argument 6 (EXTRA TEMPLATE)
dsid, // argument 4 (SYSTEM SD)
extra_template.c_str()); // argument 5 (EXTRA TEMPLATE)
}
}
catch (exception const& e)

View File

@ -85,6 +85,7 @@ void Scheduler::start()
string etc_path;
unsigned int live_rescheds;
unsigned int cold_migrate_mode;
// -----------------------------------------------------------
// Configuration File
@ -128,6 +129,8 @@ void Scheduler::start()
conf.get("LIVE_RESCHEDS", live_rescheds);
conf.get("COLD_MIGRATE_MODE", cold_migrate_mode);
conf.get("MEMORY_SYSTEM_DS_SCALE", mem_ds_scale);
conf.get("DIFFERENT_VNETS", diff_vnets);
@ -299,7 +302,17 @@ void Scheduler::start()
img_dspool = new ImageDatastorePoolXML(client);
vm_roles_pool = new VirtualMachineRolePoolXML(client, machines_limit);
vmpool = new VirtualMachinePoolXML(client, machines_limit, live_rescheds==1);
if (cold_migrate_mode > 2)
{
cold_migrate_mode = 0;
NebulaLog::warn("SCHED",
"Invalid parameter COLD_MIGRATE_MODE, setting default = 0");
}
vmpool = new VirtualMachinePoolXML(client, machines_limit, live_rescheds==1,
cold_migrate_mode);
vnetpool = new VirtualNetworkPoolXML(client);

View File

@ -28,9 +28,7 @@ const char * SchedulerTemplate::conf_name="sched.conf";
void SchedulerTemplate::set_conf_default()
{
SingleAttribute * attribute;
VectorAttribute * vattribute;
string value;
map<string,string> vvalue;
/*
@ -46,56 +44,19 @@ void SchedulerTemplate::set_conf_default()
# DEFAULT_SCHED
# DEFAULT_DS_SCHED
# LIVE_RESCHEDS
# COLD_MIGRATE_MODE
# LOG
#-------------------------------------------------------------------------------
*/
//MESSAGE_SIZE
value = "1073741824";
attribute = new SingleAttribute("MESSAGE_SIZE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//TIMEOUT
value = "60";
attribute = new SingleAttribute("TIMEOUT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//ONE_XMLRPC
value = "http://localhost:2633/RPC2";
attribute = new SingleAttribute("ONE_XMLRPC",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// SCHED_INTERVAL
value = "30";
attribute = new SingleAttribute("SCHED_INTERVAL",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// MAX_VM
value = "300";
attribute = new SingleAttribute("MAX_VM",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// MAX_DISPATCH
value = "30";
attribute = new SingleAttribute("MAX_DISPATCH",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//MAX_HOST
value = "1";
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));
set_conf_single("MESSAGE_SIZE", "1073741824");
set_conf_single("TIMEOUT", "60");
set_conf_single("ONE_XMLRPC", "http://localhost:2633/RPC2");
set_conf_single("SCHED_INTERVAL", "30");
set_conf_single("MAX_VM", "300");
set_conf_single("MAX_DISPATCH", "30");
set_conf_single("MAX_HOST", "1");
set_conf_single("LIVE_RESCHEDS", "0");
set_conf_single("COLD_MIGRATE_MODE", "0");
//DEFAULT_SCHED
vvalue.clear();
@ -118,17 +79,8 @@ void SchedulerTemplate::set_conf_default()
vattribute = new VectorAttribute("DEFAULT_NIC_SCHED",vvalue);
conf_default.insert(make_pair(vattribute->name(),vattribute));
//"MEMORY_SYSTEM_DS_SCALE"
value = "0";
attribute = new SingleAttribute("MEMORY_SYSTEM_DS_SCALE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DIFFERENT_VNETS
value = "YES";
attribute = new SingleAttribute("DIFFERENT_VNETS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
set_conf_single("MEMORY_SYSTEM_DS_SCALE", "0");
set_conf_single("DIFFERENT_VNETS", "YES");
//LOG CONFIGURATION
vvalue.clear();