]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Make domain save work on root-squash NFS
authorLaine Stump <laine@laine.org>
Wed, 3 Mar 2010 16:07:18 +0000 (17:07 +0100)
committerDaniel Veillard <veillard@redhat.com>
Wed, 3 Mar 2010 16:07:18 +0000 (17:07 +0100)
commit3c12a67b766cce51b47861ccde2be41de369f832
tree5ba6792fe3df09b80eb46f50c385ee3c448e9158
parenta03121bcfe24d8677c44a084b57b1ffb4a053d8c
Make domain save work on root-squash NFS

Move *all* file operations related to creation and writing of libvirt
header to the domain save file into a hook function that is called by
virFileOperation. First try to call virFileOperation as root. If that
fails with EACCESS, and (in the case of Linux) statfs says that we're
trying to save the file on an NFS share, rerun virFileOperation,
telling it to fork a child process and setuid to the qemu user. This
is the only way we can successfully create a file on a root-squashed
NFS server.

This patch (along with setting dynamic_ownership=0 in qemu.conf)
makes qemudDomainSave work on root-squashed NFS.

* src/qemu/qemu_driver.c: provide new qemudDomainSaveFileOpHook()
  utility, use it in qemudDomainSave() if normal creation of the
  file as root failed, and after checking the filesystem type for
  the storage is NFS. In that case we also bypass the security
  driver, as this would fail on NFS.
src/qemu/qemu_driver.c