[libvirt] virsh blockresize syntax is inconsistent with vol-resize and somewhat dangerous

Patrik Martinsson martinsson.patrik at gmail.com
Fri Oct 25 08:28:01 UTC 2019


Hi Tim,

I recently stumbled on the same thing, accidentally shrinking a blockdevice.

I have written a patch for virsh that will force the user to append a
'--force' flag if shrinking is desired.

The behavior is somewhat still inconsistent with the vol-resize
command, however a bigger rewrite is needed to make both commands
operate exactly the same, which I don't know if actually needed.

Previous discussion can be found below,
- https://www.redhat.com/archives/libvir-list/2019-October/msg00258.html
- https://www.redhat.com/archives/libvir-list/2019-October/msg01437.html

Best regards,
Patrik


On Thu, Oct 24, 2019 at 6:04 PM Tim Small <tim at seoss.co.uk> wrote:
>
> Hello,
>
> virsh has two commands which can be used to resize block devices -
> "blockresize" for volumes in use by and active guest, and "vol-resize"
> for volumes which are not in use.
>
> The vol-resize syntax allows to specify the size as a delta (increase or
> decrease vs. the current size), and also refuses to shrink a volume
> unless the "--shrink" argument is also passed.
>
> Most other tools which can be used for block device resizing (outside of
> libvirt) also have similar "--shrink" argument requirements when
> reducing the size of an existing block device.  e.g. ceph requires
> "--allow-shrink" when using the "rbd resize" command.
>
> The lack of such a safety device makes "blockresize" a foot-gun (which I
> recently found to great effect when I typoed the domain name to another
> valid domain).
>
> It seems I am not alone in making this error e.g.
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902171
>
> One possible solution would be to make a new command e.g. "domblkresize"
> or perhaps "live-resize", which implement the "--shrink" and "--delta"
> behaviour to make it consistent with "vol-resize" syntax, and mark the
> "blockresize" command as deprecated in the documentation and help (so
> that existing automation which depends on the current behaviour doesn't
> break).
>
> Any thoughts?  Should I open this as an RFE?
>
> Thanks,
>
> Tim.
>
>
> --
> South East Open Source Solutions Limited
> Registered in England and Wales with company number 06134732.
> Registered Office: 2 Powell Gardens, Redhill, Surrey, RH1 1TQ
> VAT number: 900 6633 53  http://seoss.co.uk/ +44-(0)1273-808309
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>


-- 
Best regards,
Patrik Martinsson




More information about the libvir-list mailing list