[libvirt] [PATCH 3/1] qemu: refactor file opening

Daniel Veillard veillard at redhat.com
Fri Sep 2 03:57:26 UTC 2011


On Tue, Aug 30, 2011 at 03:04:48PM -0600, Eric Blake wrote:
> In a SELinux or root-squashing NFS environment, libvirt has to go
> through some hoops to create a new file that qemu can then open()
> by name.  Snapshots are a case where we want to guarantee an empty
> file that qemu can open; also, reopening a save file to convert it
> from being marked partial to complete requires a reopen to avoid
> O_DIRECT headaches.  Refactor some existing code to make it easier
> to reuse in later patches.
> 
> * src/qemu/qemu_migration.h (qemuMigrationToFile): Drop parameter.
> * src/qemu/qemu_migration.c (qemuMigrationToFile): Let cgroup do
> the stat, rather than asking caller to do it and pass info down.
> * src/qemu/qemu_driver.c (qemuOpenFile): New function, pulled from...
> (qemuDomainSaveInternal): ...here.
> (doCoreDump, qemuDomainSaveImageOpen): Use it here as well.
> ---
> 
> Originally posted here:
> https://www.redhat.com/archives/libvir-list/2011-August/msg01174.html
> 
> but just a bit more tweaking made it useful for other purposes.
> 
>  src/qemu/qemu_driver.c    |  248 ++++++++++++++++++++++----------------------
>  src/qemu/qemu_migration.c |   13 ++-
>  src/qemu/qemu_migration.h |    2 +-
>  3 files changed, 133 insertions(+), 130 deletions(-)
[...]

  Okay that was a fairly complex patch, but it looks fine after
  scrutinity (but I didn't try to run it),

  ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list