1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-04 17:47:00 +03:00

Feature #846: Skip the scheduling if there aren't any pending VMs, and omit empty logs

This commit is contained in:
Carlos Martín 2013-01-30 18:41:16 +01:00
parent cdb2a8a476
commit 10107cd69a
5 changed files with 41 additions and 15 deletions

View File

@ -124,6 +124,13 @@ protected:
virtual int schedule();
/**
* Retrieves the pools
*
* @return 0 on success
* -1 on error
* -2 if no VMs need to be scheduled
*/
virtual int set_up_pools();
private:

View File

@ -34,6 +34,13 @@ public:
~VirtualMachinePoolXML(){};
/**
* Retrieves the pending and rescheduling VMs
*
* @return 0 on success
* -1 on error
* -2 if no VMs need to be scheduled
*/
int set_up();
/**

View File

@ -112,14 +112,24 @@ public:
*/
friend ostream& operator<<(ostream& os, VirtualMachineXML& vm)
{
if (vm.hosts.empty())
{
return os;
}
vector<VirtualMachineXML::Host *>::reverse_iterator i;
vector<int>::iterator j;
os << "\t PRI\tHID VM: " << vm.oid << endl
<< "\t-----------------------" << endl;
for (i=vm.hosts.rbegin();i!=vm.hosts.rend();i++)
{
os << "\t" << (*i)->priority << "\t" << (*i)->hid << endl;
}
os << endl;
return os;
};

View File

@ -26,6 +26,11 @@ int VirtualMachinePoolXML::set_up()
if ( rc == 0 )
{
if (objects.empty())
{
return -2;
}
oss.str("");
oss << "Pending and rescheduling VMs:" << endl;

View File

@ -265,6 +265,17 @@ int Scheduler::set_up_pools()
map<int,int>::const_iterator it;
map<int, int> shares;
//--------------------------------------------------------------------------
//Cleans the cache and get the pending VMs
//--------------------------------------------------------------------------
rc = vmpool->set_up();
if ( rc != 0 )
{
return rc;
}
//--------------------------------------------------------------------------
//Cleans the cache and get the hosts ids
//--------------------------------------------------------------------------
@ -293,18 +304,6 @@ int Scheduler::set_up_pools()
hpool->merge_clusters(clpool);
//--------------------------------------------------------------------------
//Cleans the cache and get the pending VMs
//--------------------------------------------------------------------------
rc = vmpool->set_up();
if ( rc != 0 )
{
return rc;
}
//--------------------------------------------------------------------------
//Cleans the cache and get the ACLs
//--------------------------------------------------------------------------
@ -563,9 +562,7 @@ void Scheduler::dispatch()
{
vm = static_cast<VirtualMachineXML*>(vm_it->second);
oss << "\t PRI\tHID VM: " << vm->get_oid() << endl
<< "\t-----------------------" << endl
<< *vm << endl;
oss << *vm;
}
NebulaLog::log("SCHED",Log::INFO,oss);