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:
parent
cdb2a8a476
commit
10107cd69a
@ -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:
|
||||
|
@ -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();
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,11 @@ int VirtualMachinePoolXML::set_up()
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
if (objects.empty())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
oss.str("");
|
||||
oss << "Pending and rescheduling VMs:" << endl;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user