lvmteam / lvm2

Mirror of upstream LVM2 repository
https://gitlab.com/lvmteam/lvm2
GNU General Public License v2.0
133 stars 73 forks source link

pvmove wrong logic on corner case #119

Closed socketpair closed 1 year ago

socketpair commented 1 year ago

I have two PVs and one VG over them. First PV is empty (no allocated PE). The second is full (all PEs allocated, no free PEs).

pvmove /dev/first_pv exits with non-zero code saying No extents available for allocation.

It should check first if there is nothing to do. And only THEN check for extents available for allocation.

zkabelac commented 1 year ago

So the returned status value cannot be qualified as bug and this is more a philosophical question and there is no clear definition in logic - i.e. many 'lvchange' command will give you an error if you try to change something into the state in which the LV already is.

Note - in the case it would first check 'extents' for moving - it gives this error message: "No data to move for vg."

So in most cases 'lvm2' does report an error if the command could not be doing what it was asking to be doing - it does NOT usually try to 'sanitize' commands working with metadata and report 'success' if there is nothing to do.

We would likely need to introduce some new set of options, but it's usually not worth.... (Taking into account how many other existing script we would broke by checking some reported errors)