[CentOS-virt] kvm guest from zfs dataset

Mon Jan 19 13:00:02 UTC 2015
George Dunlap <dunlapg at umich.edu>

On Fri, Jan 16, 2015 at 12:47 AM, aurfalien <aurfalien at gmail.com> wrote:
> Hi all,
>
> I thought I’d post this in case any one has issues similar to mine.
>
> First, my initial email to the list which I didn’t send;
>
> I’m trying to run a KVM based guest OS off of a mirrored ZFS dataset.
>
> It won’t run with errors "invalid argument..", but will run when on the root
> volume, or when that ZFS dataset has been removed in favor of an EXT4
> volumes.
>
> Thanks in advance,
>
> PS I do see this thread which is not promising;
>
> http://www.redhat.com/archives/redhat-list/2014-July/msg00017.html
>
> Lastly, the solution;
>
> Set your cache policy on the KVM guest as write back.
>
> This allows it to run on a ZFS volume.
>
> My apology if this has been covered.  I did spend some time on this so
> hopefully you can save time by setting the cache policy.


The virt-manager / KVM angle is covered here:

https://github.com/zfsonlinux/zfs/issues/224

It looks like virt-manager asks for "cached=none" by default, which
causes qemu to pass the "O_DIRECT" flag when opening the file, which
ZFS doesn't support.

Be advised that if you use your work-around, you may be risking
problems with disk corruption unless your OS understands how to use
flush commands; see cached=writeback here:

https://www.suse.com/documentation/sles11/book_kvm/data/sect1_1_chapter_book_kvm.html

 -George