lvmteam/lvm2

pvmove wrong logic on corner case

Closed this issue · 1 comments

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.

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)