mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2024-12-22 13:34:06 +03:00
3ff8500175
We take care of killing QEMU processes when a guest shuts down manually. QEMU will not exit itself, if started with -no-shutdown, but it will still emit a "SHUTDOWN" event, which we await and then send SIGTERM. This additionally allows us to handle backups in such situations. A vzdump instance will connect to our socket and identify itself as such in the handshake, sending along a VMID which will be marked as backing up until the file handle is closed. When a SHUTDOWN event is received while the VM is backing up, we do not kill the VM. And when the vzdump handle is closed, we check if the guest has started up since, and only if it's determined to still be turned off, we then finally kill QEMU. We cannot wait for QEMU directly to finish the backup (i.e. with query-backup), as that would kill the VM too fast for vzdump to send the last 'query-backup' to mark the backup as successful and done. For handling 'query-status' messages sent to QEMU, a state-machine-esque protocol is implemented into the Client struct (ClientState). This is necessary, since QMP works asynchronously, and results arrive on the same channel as events and even the handshake. For referencing QEMU Clients from vzdump messages, they are kept in a hash table. This requires linking against glib. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
33 lines
828 B
Makefile
33 lines
828 B
Makefile
DESTDIR=
|
|
PREFIX=/usr
|
|
SBINDIR=${PREFIX}/sbin
|
|
SERVICEDIR=/lib/systemd/system
|
|
MANDIR=${PREFIX}/share/man
|
|
|
|
export NOVIEW=1
|
|
include /usr/share/pve-doc-generator/pve-doc-generator.mk
|
|
|
|
CC ?= gcc
|
|
CFLAGS += -O2 -Werror -Wall -Wextra -Wpedantic -Wtype-limits -Wl,-z,relro -std=gnu11
|
|
CFLAGS += $(shell pkg-config --cflags json-c glib-2.0)
|
|
LDFLAGS += $(shell pkg-config --libs json-c glib-2.0)
|
|
|
|
qmeventd: qmeventd.c
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
|
|
|
|
docs: qmeventd.8
|
|
|
|
.PHONY: install
|
|
install: qmeventd docs
|
|
install -d ${DESTDIR}/${SBINDIR}
|
|
install -d ${DESTDIR}${SERVICEDIR}
|
|
install -d ${DESTDIR}${MANDIR}/man8
|
|
install -m 0644 qmeventd.service ${DESTDIR}${SERVICEDIR}
|
|
install -m 0755 qmeventd ${DESTDIR}${SBINDIR}
|
|
install -m 0644 qmeventd.8 ${DESTDIR}/${MANDIR}/man8
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(MAKE) cleanup-docgen
|
|
rm -rf qmeventd
|