mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
Feature #1712: Fix resched. It was planning migrations to hosts using different system DS
This commit is contained in:
1 parent
44332e72a6
commit
9d30cbc2ce
3 files changed
+25
-18
No files matched your search
@@ -74,6 +74,11 @@ public:
|
||||
return hid;
|
||||
};
|
||||
|
||||
int get_dsid() const
|
||||
{
|
||||
return dsid;
|
||||
};
|
||||
|
||||
bool is_resched() const
|
||||
{
|
||||
return (resched == 1);
|
||||
@@ -256,6 +261,7 @@ protected:
|
||||
int gid;
|
||||
|
||||
int hid;
|
||||
int dsid;
|
||||
|
||||
int resched;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ void VirtualMachineXML::init_attributes()
|
||||
ds_requirements = automatic_requirements;
|
||||
}
|
||||
|
||||
// ---------------- HISTORY HID, RESCHED & TEMPLATE ------------------------
|
||||
// ---------------- HISTORY HID, DSID, RESCHED & TEMPLATE ------------------
|
||||
|
||||
result = ((*this)["/VM/HISTORY_RECORDS/HISTORY/HID"]);
|
||||
|
||||
@@ -146,6 +146,17 @@ void VirtualMachineXML::init_attributes()
|
||||
hid = -1;
|
||||
}
|
||||
|
||||
result = ((*this)["/VM/HISTORY_RECORDS/HISTORY/DS_ID"]);
|
||||
|
||||
if (result.size() > 0)
|
||||
{
|
||||
dsid = atoi(result[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
dsid = -1;
|
||||
}
|
||||
|
||||
result = ((*this)["/VM/RESCHED"]);
|
||||
|
||||
if (result.size() > 0)
|
||||
|
||||
@@ -587,8 +587,12 @@ void Scheduler::match_schedule()
|
||||
|
||||
vm->sort_match_hosts();
|
||||
|
||||
if (vm->is_resched()) //Do not schedule storage for migrations
|
||||
if (vm->is_resched())
|
||||
{
|
||||
// Do not schedule storage for migrations, the VMs needs to be
|
||||
// deployed in the same system DS
|
||||
|
||||
vm->add_match_datastore(vm->get_dsid());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -804,20 +808,6 @@ void Scheduler::dispatch()
|
||||
continue;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Migrate VM if reschedule VM, skip DS selection
|
||||
//------------------------------------------------------------------
|
||||
if (vm->is_resched())
|
||||
{
|
||||
host->add_capacity(cpu,mem,dsk);
|
||||
|
||||
host_vms[hid]++;
|
||||
|
||||
vmpool->dispatch(vm_it->first, hid, -1, true); //migrate VM
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Get the highest ranked datastore
|
||||
//------------------------------------------------------------------
|
||||
@@ -843,9 +833,9 @@ void Scheduler::dispatch()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Test datastore capcity
|
||||
// Test datastore capacity, but not for migrations
|
||||
//--------------------------------------------------------------
|
||||
if (ds->test_capacity(dsk) != true)
|
||||
if (!vm->is_resched() && ds->test_capacity(dsk) != true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user