First part to fixing #5180 [0]. Adds a simple D-Bus server which implements the `org.qemu.VMState1` interface as specified in the QEMU documentation [1]. Using the built-in QEMU VMState machinery saves us from having to worry about transfer and convergence of the data and letl QEMU take care of it. Any object on the D-Bus path `/org/qemu/VMState1` implementing that interface will be called by QEMU during live-migration, iif the `Id` property is registered within the `dbus-vmstate` QEMU object for a specific VM. The actual state loading/restoring is done via the conntrack(8) tool, a small tool which already implements hard parts of interacting with the conntrack subsystem via netlink. Filtering is done on CONNMARK, which is set to the specific VMID for all packets by the firewall. Additionally, a custom `com.proxmox.VMStateHelper` interface is implemented by the object, adding a small `Quit` method for cleanly shutting down the daemon via the D-Bus API. For all to work, D-Bus needs a policy describing who is allowed to access the interface. [2] Currently, there is a hard-limit of 1 MiB of state enforced by QEMU. Typical conntrack state entries as dumped by conntrack(8) in the `save` output format are just plaintext, ASCII lines and mostly around 150-200 characters. That translates then to about ~5200 entries that can be migrated. Such a typical line looks like: -A -t 431974 -u SEEN_REPLY,ASSURED -s 10.1.0.1 -d 10.1.1.20 \ -r 10.1.1.20 -q 10.1.0.1 -p tcp --sport 48550 --dport 22 \ --reply-port-src 22 --reply-port-dst 48550 --state ESTABLISHED In the future, compression could be implemented for these before sending them to QEMU, which should increase the above number quite a bit - since these entries are nicely compressible. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=5180 [1] https://www.qemu.org/docs/master/interop/dbus-vmstate.html [2] https://dbus.freedesktop.org/doc/dbus-daemon.1.html#configuration_file Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com> Link: https://lore.proxmox.com/20250730094549.263805-7-c.heiss@proxmox.com
61 lines
1.4 KiB
Makefile
61 lines
1.4 KiB
Makefile
include /usr/share/dpkg/default.mk
|
|
|
|
export PACKAGE=qemu-server
|
|
BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
|
|
|
|
export DESTDIR ?=
|
|
|
|
GITVERSION:=$(shell git rev-parse HEAD)
|
|
|
|
DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
|
|
DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
|
|
DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
|
|
|
|
DEBS=$(DEB) $(DBG_DEB)
|
|
|
|
all:
|
|
|
|
.PHONY: tidy
|
|
tidy:
|
|
git ls-files ':*.p[ml]'| xargs -n4 -P0 proxmox-perltidy
|
|
cd src; proxmox-perltidy bin/qm bin/qmextract bin/qmrestore usr/pve-bridgedown usr/pve-bridge
|
|
|
|
.PHONY: dinstall
|
|
dinstall: deb
|
|
dpkg -i $(DEB)
|
|
|
|
$(BUILDDIR):
|
|
rm -rf $@ $@.tmp
|
|
cp -a src $@.tmp
|
|
cp -a debian $@.tmp/
|
|
echo "git clone git://git.proxmox.com/git/qemu-server.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
|
|
mv $@.tmp $@
|
|
|
|
.PHONY: deb
|
|
deb: $(DEBS)
|
|
$(DBG_DEB): $(DEB)
|
|
$(DEB): $(BUILDDIR)
|
|
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
|
|
lintian $(DEBS)
|
|
|
|
.PHONY: dsc
|
|
dsc: $(DSC)
|
|
$(DSC): $(BUILDDIR)
|
|
cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
|
|
lintian $(DSC)
|
|
|
|
sbuild: $(DSC)
|
|
sbuild $(DSC)
|
|
|
|
.PHONY: upload
|
|
upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
|
|
upload: $(DEB)
|
|
tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com upload --product pve --dist $(UPLOAD_DIST)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(PACKAGE)-*/ *.deb *.build *.buildinfo *.changes *.dsc $(PACKAGE)_*.tar.?z
|
|
|
|
|
|
.PHONY: distclean
|
|
distclean: clean
|