allow dtrfs upgrade
This commit is contained in:
parent
bdf5bf947e
commit
0931744328
11
src/state.rs
11
src/state.rs
@ -112,7 +112,8 @@ impl Resources {
|
|||||||
let mut volumes = config.volumes.clone();
|
let mut volumes = config.volumes.clone();
|
||||||
for volume in volumes.iter_mut() {
|
for volume in volumes.iter_mut() {
|
||||||
if let Some(reservation) = self.reserved_storage.get(&volume.path) {
|
if let Some(reservation) = self.reserved_storage.get(&volume.path) {
|
||||||
volume.max_reservation_mib = volume.max_reservation_mib.saturating_sub(*reservation);
|
volume.max_reservation_mib =
|
||||||
|
volume.max_reservation_mib.saturating_sub(*reservation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
volumes.sort_by_key(|v| v.max_reservation_mib);
|
volumes.sort_by_key(|v| v.max_reservation_mib);
|
||||||
@ -660,7 +661,8 @@ impl VM {
|
|||||||
config: &Config,
|
config: &Config,
|
||||||
res: &mut Resources,
|
res: &mut Resources,
|
||||||
) -> Result<(), VMCreationErrors> {
|
) -> Result<(), VMCreationErrors> {
|
||||||
if req.vcpus < self.vcpus {
|
if req.vcpus < self.vcpus && req.vcpus != 0 && req.memory_mib != 0 && req.disk_size_mib != 0
|
||||||
|
{
|
||||||
// Downgrade will be upported only after we implement deviation for VMs.
|
// Downgrade will be upported only after we implement deviation for VMs.
|
||||||
// (Deviation from the slot size allows management of VMs with unbalanced resources,
|
// (Deviation from the slot size allows management of VMs with unbalanced resources,
|
||||||
// without fully saturating a node. We are disabling downgrades to avoid complexity at
|
// without fully saturating a node. We are disabling downgrades to avoid complexity at
|
||||||
@ -675,7 +677,10 @@ impl VM {
|
|||||||
}
|
}
|
||||||
if req.memory_mib > 0
|
if req.memory_mib > 0
|
||||||
&& config.max_mem_reservation_mib
|
&& config.max_mem_reservation_mib
|
||||||
< res.reserved_memory_mib.saturating_sub(self.memory_mib).saturating_add(req.memory_mib)
|
< res
|
||||||
|
.reserved_memory_mib
|
||||||
|
.saturating_sub(self.memory_mib)
|
||||||
|
.saturating_add(req.memory_mib)
|
||||||
{
|
{
|
||||||
return Err(VMCreationErrors::NotEnoughMemory);
|
return Err(VMCreationErrors::NotEnoughMemory);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user