On 5/13/20 4:48 PM, Daniel Henrique Barboza wrote:
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?
I'm not aware of any real benefit. IIUC, qemu is trying to clean up its
own code so they changed the API. The qemu commit I'm referencing in 1/2
mentions possible performance benefits of using the new API. Also, the
commit mentions better control over memory allocation because we won't
be using global -mem-prealloc and -mem-path but in libvirt, we would use
corresponding attributes of memory-backend-* anyway. Therefore, from my
POV it's only 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.
Interesting idea. This is basically the same as making the private
variable I'm inventing controllable by user. Let me check if there is a
way to actually detect whether qemu supports only the old way, or only
the new way or both.
And it looks like it sort of can. I mean, there is numa-mem-supported
attribute to a machine type in output of 'query-machines'. But there
doesn't seem to be anything for -numa memdev=.
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.
Is that so? Qemu deprecated the old API and just for the sake of the
argument, imagine they already removed it. Now, on libvirt level, how do
we handle it? I mean, you are not able to migrate from older qemu to
this hypothetical qemu. Sure, we can blame qemu, or we can start using
the new API and some machines started with older qemu would be able to
migrate to the hypothetical qemu.
Yeah, we don't have a good option.
>
> 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.
I think they will have to track both actually. They will have to track
QEMU version, no argument there. But also Libvirt version - they minimal
required version would have to be the one where Libvirt switches from
old to the new API.
Michal