[Qemu-devel] [PATCH v3 0/6] Add dbus-vmstate

Marc-André Lureau posted 6 patches 4 years, 8 months ago
Test docker-clang@ubuntu failed
Test FreeBSD failed
Test checkpatch passed
Test docker-quick@centos7 failed
Failed in applying to current master (apply log)
There is a newer version of this series
MAINTAINERS                   |   6 +
backends/Makefile.objs        |   4 +
backends/dbus-vmstate.c       | 530 ++++++++++++++++++++++++++++++++++
configure                     |   7 +
docs/devel/migration.rst      |   2 +-
docs/interop/dbus-vmstate.rst |  68 +++++
docs/interop/dbus.rst         |  73 +++++
docs/interop/index.rst        |   2 +
hw/block/onenand.c            |   2 +-
hw/core/Makefile.objs         |   1 +
hw/core/qdev.c                |  21 +-
hw/core/vmstate-if.c          |  23 ++
hw/ide/cmd646.c               |   2 +-
hw/ide/isa.c                  |   2 +-
hw/ide/piix.c                 |   2 +-
hw/ide/via.c                  |   2 +-
hw/misc/max111x.c             |   2 +-
hw/net/eepro100.c             |   4 +-
hw/net/vmxnet3.c              |   2 +-
hw/nvram/eeprom93xx.c         |   4 +-
hw/ppc/spapr_drc.c            |   9 +-
hw/ppc/spapr_iommu.c          |   4 +-
hw/s390x/s390-skeys.c         |   2 +-
include/hw/vmstate-if.h       |  32 ++
include/migration/register.h  |   6 +-
include/migration/vmstate.h   |  10 +-
migration/qjson.h             |   2 +
migration/savevm.c            |  29 +-
stubs/vmstate.c               |   4 +-
tests/Makefile.include        |  20 +-
tests/dbus-vmstate-daemon.sh  |  95 ++++++
tests/dbus-vmstate-test.c     | 386 +++++++++++++++++++++++++
tests/dbus-vmstate1.xml       |  12 +
tests/libqtest.c              |  41 +--
tests/libqtest.h              |   9 +
35 files changed, 1355 insertions(+), 65 deletions(-)
create mode 100644 backends/dbus-vmstate.c
create mode 100644 docs/interop/dbus-vmstate.rst
create mode 100644 docs/interop/dbus.rst
create mode 100644 hw/core/vmstate-if.c
create mode 100644 include/hw/vmstate-if.h
create mode 100755 tests/dbus-vmstate-daemon.sh
create mode 100644 tests/dbus-vmstate-test.c
create mode 100644 tests/dbus-vmstate1.xml
[Qemu-devel] [PATCH v3 0/6] Add dbus-vmstate
Posted by Marc-André Lureau 4 years, 8 months ago
Hi,

With external processes or helpers participating to the VM support, it
becomes necessary to handle their migration. Various options exist to
transfer their state:
1) as the VM memory, RAM or devices (we could say that's how
   vhost-user devices can be handled today, they are expected to
   restore from ring state)
2) other "vmstate" (as with TPM emulator state blobs)
3) left to be handled by management layer

1) is not practical, since an external processes may legitimatelly
need arbitrary state date to back a device or a service, or may not
even have an associated device.

2) needs ad-hoc code for each helper, but is simple and working

3) is complicated for management layer, QEMU has the migration timing

The proposed "dbus-vmstate" object will connect to a given D-Bus
address, and save/load from org.qemu.VMState1 owners on migration.

Thus helpers can easily have their state migrated with QEMU, without
implementing ad-hoc support (such as done for TPM emulation)

D-Bus is ubiquitous on Linux (it is systemd IPC), and can be made to
work on various other OSes. There are several implementations and good
bindings for various languages.  (the tests/dbus-vmstate-test.c is a
good example of how simple the implementation of services can be, even
in C)

dbus-vmstate is put into use by the libvirt series "[PATCH 00/23] Use
a slirp helper process".

v3:
- after various discussions on helper processes, we settled on a
  preference for having a bus for communications. This version is
  actually v1 updated.
- added a dbus.rst document to describe D-Bus recommendations for QEMU
- added dbus-vmstate-daemon.sh to play with the dbus-daemon configuration
  (although it is not very useful in the context of a single UID)
- added a new vmstate interface, so that any object can implement
  VMStateDescription, and converted dbus-vmstate
- added "migration: fix vmdesc leak on vmstate_save() error"
- convert to g_auto

v2:
- D-Bus is most common and practical through a bus, but it requires a
  daemon to be running. I argue that the benefits outweight the cost
  of running an extra daemon in v1 in the context of multi-process
  qemu, but it is also possible to connect in p2p mode as done in this
  new version.

Marc-André Lureau (6):
  migration: fix vmdesc leak on vmstate_save() error
  vmstate: add qom interface to get id
  vmstate: replace DeviceState with VMStateIf
  tests: add qtest_expect_exit_status()
  docs: start a document to describe D-Bus usage
  Add dbus-vmstate object

 MAINTAINERS                   |   6 +
 backends/Makefile.objs        |   4 +
 backends/dbus-vmstate.c       | 530 ++++++++++++++++++++++++++++++++++
 configure                     |   7 +
 docs/devel/migration.rst      |   2 +-
 docs/interop/dbus-vmstate.rst |  68 +++++
 docs/interop/dbus.rst         |  73 +++++
 docs/interop/index.rst        |   2 +
 hw/block/onenand.c            |   2 +-
 hw/core/Makefile.objs         |   1 +
 hw/core/qdev.c                |  21 +-
 hw/core/vmstate-if.c          |  23 ++
 hw/ide/cmd646.c               |   2 +-
 hw/ide/isa.c                  |   2 +-
 hw/ide/piix.c                 |   2 +-
 hw/ide/via.c                  |   2 +-
 hw/misc/max111x.c             |   2 +-
 hw/net/eepro100.c             |   4 +-
 hw/net/vmxnet3.c              |   2 +-
 hw/nvram/eeprom93xx.c         |   4 +-
 hw/ppc/spapr_drc.c            |   9 +-
 hw/ppc/spapr_iommu.c          |   4 +-
 hw/s390x/s390-skeys.c         |   2 +-
 include/hw/vmstate-if.h       |  32 ++
 include/migration/register.h  |   6 +-
 include/migration/vmstate.h   |  10 +-
 migration/qjson.h             |   2 +
 migration/savevm.c            |  29 +-
 stubs/vmstate.c               |   4 +-
 tests/Makefile.include        |  20 +-
 tests/dbus-vmstate-daemon.sh  |  95 ++++++
 tests/dbus-vmstate-test.c     | 386 +++++++++++++++++++++++++
 tests/dbus-vmstate1.xml       |  12 +
 tests/libqtest.c              |  41 +--
 tests/libqtest.h              |   9 +
 35 files changed, 1355 insertions(+), 65 deletions(-)
 create mode 100644 backends/dbus-vmstate.c
 create mode 100644 docs/interop/dbus-vmstate.rst
 create mode 100644 docs/interop/dbus.rst
 create mode 100644 hw/core/vmstate-if.c
 create mode 100644 include/hw/vmstate-if.h
 create mode 100755 tests/dbus-vmstate-daemon.sh
 create mode 100644 tests/dbus-vmstate-test.c
 create mode 100644 tests/dbus-vmstate1.xml

-- 
2.23.0


Re: [Qemu-devel] [PATCH v3 0/6] Add dbus-vmstate
Posted by no-reply@patchew.org 4 years, 8 months ago
Patchew URL: https://patchew.org/QEMU/20190912122514.22504-1-marcandre.lureau@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

libudev           no
default devices   yes

warning: Python 2 support is deprecated
warning: Python 3 will be required for building future versions of QEMU

NOTE: cross-compilers enabled:  'cc'
  GEN     x86_64-softmmu/config-devices.mak.tmp
---
Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry

**
ERROR:/tmp/qemu-test/src/tests/dbus-vmstate-test.c:150:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
cleaning up pid 28575
ERROR - Bail out! ERROR:/tmp/qemu-test/src/tests/dbus-vmstate-test.c:150:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
make: *** [check-qtest-x86_64] Error 1
make: *** Waiting for unfinished jobs....
  TEST    iotest-qcow2: 080


The full log is available at
http://patchew.org/logs/20190912122514.22504-1-marcandre.lureau@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com