Re: QEMU/KVM migration backwards compatibility broken?

Dr. David Alan Gilbert
2019-06-06T13:31:46Z

* Liran Alon (liran.alon@oracle.com) wrote:
>
>
> > On 6 Jun 2019, at 14:07, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:

<snip>

> > It's tricky; for distro-based users, hitting 'update' and getting both
> > makes a lot of sense; but as you say you ened to let them do stuff
> > individually if they want to, so they can track down problems.
> > There's also a newer problem which is people want to run the QEMU in
> > containers on hosts that have separate update schedules - the kernel
> > version relationship is then much more fluid.
> >
> >> Compiling all above very useful discussion (thanks for this!), I may have a better suggestion that doesn’t require any additional flags:
> >> 1) Source QEMU will always send all all VMState subsections that is deemed by source QEMU as required to not break guest semantic behaviour.
> >> This is done by .needed() methods that examine guest runtime state to understand if this state is required to be sent or not.
> >
> > So that's as we already do.
>
> Besides the fact that today we also expect to add a flag tied to machine-type for every new VMState subsection we add that didn’t exist on previous QEMU versions...
>
> >
> >> 2) Destination QEMU will provide a generic QMP command which allows to set names of VMState subsections that if accepted on migration stream
> >> and failed to be loaded (because either subsection name is not implemented or because .post_load() method failed) then the failure should be ignored
> >> and migration should continue as usual. By default, the list of this names will be empty.
> >
> > The format of the migration stream means that you can't skip an unknown
> > subsection; it's not possible to resume parsing the stream without
> > knowing what was supposed to be there. [This is pretty awful
> > but my last attempts to rework it hit a dead end]
>
> Wow… That is indeed pretty awful.
> I thought every VMState subsection have a header with a length field… :(

No, no length - it's just a header saying it's a subsection with the
name, then just unformatted data (that had better match what you
expect!).

> Why did your last attempts to add such a length field to migration stream protocol failed?

There's a lot of stuff that's open coded rather than going through
VMState's, so you don't know how much data they'll end up generating.
So the only way to do that is to write to a buffer and then get the
length and dump the buffer. Actually all that's rare in subsections
but does happen elsewhere. I got some of some of those nasty cases
but I got stuck trying to get rid of some of the other opencoding
(and still keep it compatible).

> >
> > So we still need to tie subsections to machine types; that way
> > you don't send them to old qemu's and there for you don't have the
> > problem of the qemu receiving something it doesn't know.
>
> I agree that if there is no way to skip a VMState subsection in the stream, then we must
> have a way to specify to source QEMU to prevent sending this subsection to destination…
>
> I would suggest though that instead of having a flag tied to machine-type, we will have a QMP command
> that can specify names of subsections we explicitly wish to be skipped sending to destination even if their .needed() method returns true.

I don't like the thought of generically going behind the devices back;
it's pretty rare to have to do this, so adding a qmp command to tweak
properties that we've already got seems to make more sense to me.

> This seems like a more explicit approach and doesn’t come with the down-side of forever not migrating this VMState subsection
Dave

> for the entire lifetime of guest.
>
> >
> > Still, you could skip things where the destination kernel doesn't know
> > about it.
> >
> >> 3) Destination QEMU will implement .post_load() method for all these VMState subsections that depend on kernel capability to be restored properly
> >> such that it will fail subsection load in case kernel capability is not present. (Note that this load failure will be ignored if subsection name is specified in (2)).
> >>
> >> Above suggestion have the following properties:
> >> 1) Doesn’t require any flag to be added to QEMU.
> >
> > There's no logical difference between 'flags' and 'names of subsections'
> > - they're got the same problem in someone somewhere knowing which are
> > safe.
>
> I agree. But creating additional flags does come with a development and testing overhead and makes code less intuitive.
> I would have prefer to use subsection names.
>
> >
> >> 2) Moves all control on whether to fail migration because of failure to load VMState subsection to receiver side. Sender always attempts to send max state he believes is required.
> >> 3) We remove coupling of migration compatibility from machine-type.
> >>
> >> What do you think?
> >
> > Sorry, can't do (3) - we need to keep the binding for subsections to
> > machine types for qemu compatibility; I'm open for something for
> > kernel compat, but not when it's breaking the qemu subsection
> > checks.
> >
> > Dave
>
> Agree. I have proposed now above how to not break qemu subsection checks while still not tie this to machine-type.
> Please tell me what you think on that approach. :)
>
> We can combine that approach together with implementing the mentioned .post_load() methods and maybe it solves the discussion at hand here.
>
> -Liran
>
> >
> >>
> >> -Liran
> >>
> >>>
> >>>> -Liran
> >>>>
> >>>>>
> >>>>>> -Liran
> >>>>>>
> >>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>> -Liran
> >>>>>>> --
> >>>>>>> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> >>>>>>
> >>>>> --
> >>>>> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> >>>>
> >>> --
> >>> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> >>
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK