mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Feature #3028: Ignore cpu,mem when capacity is not enforced
This commit is contained in:
parent
c041b87ab0
commit
8178f90f8f
@ -454,6 +454,18 @@ public:
|
||||
return host_share.test(cpu, mem, disk, pci, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a new VM can be hosted by the host or not, checking the
|
||||
* PCI devices only.
|
||||
* @param pci devices needed by the VM
|
||||
* @param error Returns the error reason, if any
|
||||
* @return true if the share can host the VM
|
||||
*/
|
||||
bool test_capacity(vector<Attribute *> &pci, string& error) const
|
||||
{
|
||||
return host_share.test(pci, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of the VM IDs set
|
||||
*/
|
||||
|
@ -248,6 +248,26 @@ public:
|
||||
return fits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this share can host a VM, testing only the PCI devices.
|
||||
* @param pci_devs requested by the VM
|
||||
* @param error Returns the error reason, if any
|
||||
*
|
||||
* @return true if the share can host the VM or it is the only one
|
||||
* configured
|
||||
*/
|
||||
bool test(vector<Attribute *>& pci_devs, string& error) const
|
||||
{
|
||||
bool fits = pci.test(pci_devs);
|
||||
|
||||
if (!fits)
|
||||
{
|
||||
error = "Unavailable PCI device.";
|
||||
}
|
||||
|
||||
return fits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to write a HostShare to an output stream
|
||||
*/
|
||||
|
@ -398,14 +398,14 @@ bool RequestManagerVirtualMachine::check_host(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!enforce)
|
||||
if (enforce)
|
||||
{
|
||||
cpu = 0;
|
||||
mem = 0;
|
||||
disk = 0;
|
||||
test = host->test_capacity(cpu, mem, disk, pci, capacity_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
test = host->test_capacity(pci, capacity_error);
|
||||
}
|
||||
|
||||
test = host->test_capacity(cpu, mem, disk, pci, capacity_error);
|
||||
|
||||
if (!test)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user