On 5/12/20 11:52 AM, Michal Privoznik wrote:
In a way, libvirt already uses -numa memdev= in a few cases. In fact, in as few cases as possible - only configurations which can not be configured with -numa mem=, because these two ways are incompatible when it comes to migration. My approach to solve this is to have a privateData flag which tells which directs libvirt to generate old or new cmd line. And then this flag is saved into migration cookie so that the destination is directed the same way. Problem with this approach is that, while migration 6.3.0 -> 6.4.0 -> 6.3.0 works, migration where the machine is started on newer libvirt 6.4.0 and then migrated back to 6.3.0 won't work (in fact is explicitly denied by 2/2) even though there is nothing visible that should prevent the migration.
Is there any advantage in using the new "memdev" format instead of the old one? An actual benefit inside QEMU? Or is it just an API change? If there is a benefit, I'd say we make the user choose to use the new memdev format, explicitly, in the NUMA XML. Or, if we want to default to use the new format, the user needs to set a "legacy" flag in the XML. This makes the migration compatibility an user problem,with clear benefits and drawbacks, and then the user can decide whether it is worth breaking migration for it. Eventually, when QEMU moves on, the 'legacy' option can be deprecated. If there is no benefit aside from "-numa mem=" stop working one day, I'd say to keep the legacy format as long as possible. When the QEMU binary stops supporting it, then we have no choice other than to stop using legacy format with the newer binaries. But the user will move on to the newer QEMU binaries across the env, so it's ok to not use the legacy format any longer. This approach also avoids dealing with migration issues in Libvirt side.
I am not sure whether we have a good move here, because even if we waited until QEMU removes the old way, it won't help us really. We would be just leaving the problem for future us.
I think the problem is simpler to handle in Libvirt when QEMU deprecates the old format entirely. Otherwise the user will have to also keep track of Libvirt versions to understand why the migration is failing here and there. Thanks, DHB
Michal Prívozník (2): qemu: Switch to new -numa memdev= qemu: Disallow migration to older -numa if newer is used src/qemu/qemu_command.c | 20 ++--- src/qemu/qemu_domain.c | 38 +++++++++- src/qemu/qemu_domain.h | 3 + src/qemu/qemu_migration.c | 18 ++++- src/qemu/qemu_migration_cookie.c | 73 +++++++++++++++++++ src/qemu/qemu_migration_cookie.h | 12 +++ src/qemu/qemu_process.c | 25 ++++++- .../qemustatusxml2xmldata/backup-pull-in.xml | 1 + .../blockjob-blockdev-in.xml | 1 + .../blockjob-mirror-in.xml | 1 + .../disk-secinfo-upgrade-in.xml | 1 + .../disk-secinfo-upgrade-out.xml | 1 + .../migration-in-params-in.xml | 1 + .../migration-out-nbd-in.xml | 1 + .../migration-out-nbd-out.xml | 1 + .../migration-out-nbd-tls-in.xml | 1 + .../migration-out-nbd-tls-out.xml | 1 + .../migration-out-params-in.xml | 1 + tests/qemustatusxml2xmldata/modern-in.xml | 1 + .../qemustatusxml2xmldata/vcpus-multi-in.xml | 1 + .../hugepages-numa-default-2M.args | 10 ++- .../hugepages-numa-default-dimm.args | 8 +- .../hugepages-numa-default.args | 6 +- .../memory-hotplug-dimm-addr.args | 3 +- .../qemuxml2argvdata/memory-hotplug-dimm.args | 3 +- ...y-hotplug-nvdimm-access.x86_64-latest.args | 3 +- ...ry-hotplug-nvdimm-align.x86_64-latest.args | 3 +- ...ry-hotplug-nvdimm-label.x86_64-latest.args | 3 +- ...ory-hotplug-nvdimm-pmem.x86_64-latest.args | 3 +- ...ory-hotplug-nvdimm-ppc64.ppc64-latest.args | 3 +- ...hotplug-nvdimm-readonly.x86_64-latest.args | 3 +- .../memory-hotplug-nvdimm.x86_64-latest.args | 3 +- .../numatune-auto-prefer.args | 4 +- .../qemuxml2argvdata/pages-dimm-discard.args | 3 +- .../pages-discard-hugepages.args | 11 ++- tests/qemuxml2argvdata/pages-discard.args | 12 ++- 36 files changed, 236 insertions(+), 47 deletions(-)