My goal is a default configuration for LVM thin-provisioning that is flexible enough to reserve a safety margin for one admin VM LV (VolA) versus user LVs (VolU1, VolU2, VolU3 ...) even if various administrators (on separate installations) use very different amounts of disk space in their respective admin virtual machines.
For example, one administrator may use 4GB in System1's VolA, but another admin may use 50GB in System2's VolA. This means that a fixed-size volume of 50GB would be unacceptable to the first administrator (and vice-versa), so putting VolA in the thin pool with the other "user" VM volumes is required for flexibility. It is not possible to hand-tailor installations for these systems.
More requisites:
- Admin VM is the storage host, and runs from the thinpool
- User VMs occupy the same pool
- Over-provision; all LV virtual sizes = physical disk size.
The problem occurs when user inexperience, bugs or DoS attempt in user VMs cause allocation of all remaining free space for their user volumes (VolU1, VolU2, etc...) and leave VolA with no free space and the admin VM unable to boot or function normally.
The solution / failsafe should be as automatic and as passive as possible. An ideal solution might be an LVM property set for all user LVs, allowing them to allocate space only when poolFree < N
, while VolA has no such restriction. But I've been unable to find such a feature in Linux LVM and need suggestions.
After some research it seems a solution could involve using a setting for dmeventd
to execute commands (such as 'pause all VMs') when a threshold is reached. A newer man page for dmeventd
I found online says this is possible with dmeventd/thin_command
setting in lvm.conf; it seems this feature was added in May 2017 so I would have to find a backport.
Another option could be adding a rule like the following to rsyslog.conf:
:msg, contains, "some dmeventd message" ^my_pause_vm_script