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.
Showing
想要评论请 注册 或 登录