You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Marc-André Lureau
9e6bdef224
util: add qemu_write_pidfile()
There are variants of qemu_create_pidfile() in qemu-pr-helper and
qemu-ga. Let's have a common implementation in libqemuutil.
The code is initially based from pr-helper write_pidfile(), with
various improvements and suggestions from Daniel Berrangé:
QEMU will leave the pidfile existing on disk when it exits which
initially made me think it avoids the deletion race. The app
managing QEMU, however, may well delete the pidfile after it has
seen QEMU exit, and even if the app locks the pidfile before
deleting it, there is still a race.
eg consider the following sequence
QEMU 1 libvirtd QEMU 2
1. lock(pidfile)
2. exit()
3. open(pidfile)
4. lock(pidfile)
5. open(pidfile)
6. unlink(pidfile)
7. close(pidfile)
8. lock(pidfile)
IOW, at step 8 the new QEMU has successfully acquired the lock, but
the pidfile no longer exists on disk because it was deleted after
the original QEMU exited.
While we could just say no external app should ever delete the
pidfile, I don't think that is satisfactory as people don't read
docs, and admins don't like stale pidfiles being left around on
disk.
To make this robust, I think we might want to copy libvirt's
approach to pidfile acquisition which runs in a loop and checks that
the file on disk /after/ acquiring the lock matches the file that
was locked. Then we could in fact safely let QEMU delete its own
pidfiles on clean exit..
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180831145314.14736-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
8 years ago |
| .. |
|
installer
|
qga-win: Fixing msi upgrade disallow in WiX file
|
8 years ago |
|
vss-win32
|
qga-win: fix error-handling in getNameByStringSID()
|
9 years ago |
|
Makefile.objs
|
qapi: Move qapi-schema.json to qapi/, rename generated files
|
8 years ago |
|
channel-posix.c
|
qga: use local path for local headers
|
8 years ago |
|
channel-win32.c
|
qga: use local path for local headers
|
8 years ago |
|
channel.h
|
qga: add systemd socket activation support
|
9 years ago |
|
commands-posix.c
|
qga: fix file descriptor leak
|
8 years ago |
|
commands-win32.c
|
qga-win: Handle fstrim for OSes lower than Win8
|
8 years ago |
|
commands.c
|
glib: bump min required glib library version to 2.40
|
8 years ago |
|
guest-agent-command-state.c
|
qga: use local path for local headers
|
8 years ago |
|
guest-agent-core.h
|
Include qmp-commands.h exactly where needed
|
8 years ago |
|
main.c
|
util: add qemu_write_pidfile()
|
8 years ago |
|
qapi-schema.json
|
qga/schema: fix documentation for GuestOSInfo
|
8 years ago |
|
service-win32.c
|
qga: Remove unnecessary glib.h includes
|
10 years ago |
|
service-win32.h
|
Clean up header guards that don't match their file name
|
10 years ago |
|
vss-win32.c
|
qga: use local path for local headers
|
8 years ago |
|
vss-win32.h
|
qga-win: Fix a bug where qemu-ga service is stuck during stop operation
|
9 years ago |