On 01/30/2012 03:11 PM, Phantomcircuit wrote:
I'd like to add a simple flag to virStorageVolWipe to use
O_DIRECT.
What's the proper way to add such a flag?
Best is to copy by example :) Here's a recent patch that added a new
flag to the public API, exposed the new flag in virsh, and implemented
that flag in the qemu driver:
commit 4e9953a426b44b40c5e0890abb73e0f90c454da5
Author: Eric Blake <eblake(a)redhat.com>
Date: Mon Jan 9 11:57:46 2012 -0700
snapshot: allow reuse of existing files in disk snapshot
When disk snapshots were first implemented, libvirt blindly refused
to allow an external snapshot destination that already exists, since
qemu will blindly overwrite the contents of that file during the
snapshot_blkdev monitor command, and we don't like a default of
data loss by default. But VDSM has a scenario where NFS permissions
are intentionally set so that the destination file can only be
created by the management machine, and not the machine where the
guest is running, so that libvirt will necessarily see the destination
file already existing; adding a flag will allow VDSM to force the file
reuse without libvirt complaining of possible data loss.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org