Description of problem: A user can attempt to remove multiple devices from a block storage domain. For each of the devices, the data is first moved from the device to other devices of the domain and then the device is removed from the domain. The data is moved using the lvm command pvmove, if there's not enough free space the operation will fail. When attempting to reduce multiple devices, we can't rely on the lvm verification for free space (as lvm isn't aware that the user we are going to remove more devices from the domain). regardless - validating it instead of failing on the lvm command execution is more user friendly. How reproducible: Always - complicated reproduction Steps to Reproduce: 1. Create a block domain with 1 devices 2. create a preallocated disk in a size close to the device size. 3. extend the domain with another device with size similar to the first device (let's call that device A) 4. create a preallocated disk in size close to the device size. 5. extend the domain with another device with size similar to the first device (yes, again - let's call that device B). 6. create a preallocated disk in size close to the device size. 7. delete the disk residing on device A. 8. send a request to remove devices A and B from the domain (A should appear first). Actual results: The first device is removed from the domain successfully, the second device removal fails because of lack of free space. Expected results: The engine should determine the free space needed to reduce all the devices passed by the user and validate that there is enough free space prior to removing any of the devices from the domain. Additional info:
-------------------------------------- Tested with the following code: ---------------------------------------- rhevm-4.1.0.4-0.1.el7.noarch vdsm-4.19.4-1.el7ev.x86_64 Tested with the following scenario: Steps to Reproduce: 1. Create a block domain with 1 devices 2. create a preallocated disk in a size close to the device size. 3. extend the domain with another device with size similar to the first device (let's call that device A) 4. create a preallocated disk in size close to the device size. 5. extend the domain with another device with size similar to the first device (yes, again - let's call that device B). 6. create a preallocated disk in size close to the device size. 7. delete the disk residing on device A. 8. send a request to remove devices A and B from the domain (A should appear first). Actual results: reduce sd fails - Can't reduce Storage storage-ge8-iscsi3. There is not enough space on the destination devices of the storage domain Expected results: Moving to VERIFIED!