brhellman opened a new issue, #14959:
URL: https://github.com/apache/cloudstack/issues/14959

   ### Problem
   
   For Linstor primary storage, CloudStack reports as capacity the **sum of the 
total capacity of every LINSTOR storage pool** in the resource group's pool 
list, on every node. Each volume, however, is stored on `place_count` nodes of 
the resource group, so the real capacity is about the sum divided by the 
replica count (and a single volume can be no larger than one node's pool). 
CloudStack therefore shows several times the storage that exists, and its 
allocation checks (`pool.storage.capacity.disablethreshold`, over-provisioning) 
work against the inflated number.
   
   `LinstorUtil.getCapacityBytes()` and `LinstorUtil.getStorageStats()` (4.22 
branch, same in 4.23.0.0):
   
   ```java
   List<StoragePool> storagePools = getRscGroupStoragePools(linstorApi, 
rscGroupName);
   return storagePools.stream()
       .filter(sp -> sp.getProviderKind() != ProviderKind.DISKLESS)
       .mapToLong(sp -> sp.getTotalCapacity() != null ? sp.getTotalCapacity() : 
0L)
       .sum() * 1024;
   ```
   
   `getRscGroupStoragePools()` returns that pool on every node, so the sum 
grows with the node count while the replica count is ignored.
   
   ### Steps to reproduce
   
   1. 3 KVM hosts, each with a LINSTOR LVM thin pool of 39 GiB (`pool0`); 
resource group `cloudstack` with `place_count 2`; Linstor primary storage using 
that resource group.
   2. *Infrastructure → Primary Storage*: **116 G** total (3 × 39 GiB), 
although at most ~58 GiB of data fits (2 copies of everything) and no volume 
can exceed 39 GiB.
   3. With 27 GiB free on the nodes, `createVolume` of 35 GiB is accepted; 
attached and written from an instance, the thin pools of the two nodes holding 
it fill up after about two minutes, DRBD detaches both replicas, and everything 
else on those pools (other volumes, in our case also the CloudStack management 
database on the same pool) gets I/O errors.
   
   ### Versions
   
   CloudStack 4.23.0.0 (KVM, AlmaLinux 10.3), LINSTOR 1.35.3, DRBD 9.3.5.
   
   ### Suggested fix
   
   Divide by the resource group's replica count 
(`getSelectFilter().getPlaceCount()`), or ask LINSTOR: `linstor resource-group 
query-size-info <rg>` (also in the REST API) returns the maximum volume size 
the resource group can place, taking replicas and node placement into account.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to