churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
840 stars 181 forks source link

Ability to pass custom ZFS options during VM creation #494

Open mateuszkwiatkowski opened 2 years ago

mateuszkwiatkowski commented 2 years ago

Currently there's no way to set reservation dynamically during VM creation. Lack of ZFS reservations are pretty bad when pool runs out of space. FreeBSD guests are unusable and Linux guests remounts their filesystems into read-only mode. I propose to add a flag to vm create to enable setting reservation, for example: vm create -s 10G -r 10G.

WanpengQian commented 1 year ago

A better approach is to pass an option string to zfs create, in that way, the user can specify any zfs options when creating vm.

mateuszkwiatkowski commented 1 year ago

Yeah, that's even better idea. Updating title to reflec that.

churchers commented 1 year ago

I will look at adding the ability to specify zfs options directly in the create command. In the meantime, it should be possible to do this via a template - although it's not ideal as anew size specified on the command line will override the disk in the template but not the zfs options.

disk0_size=20G
zfs_dataset_opts="reservation=20G"