[PATCH 0/3] Add a retry procedure after failing to do post parsing

zhangjl02 posted 3 patches 1 week, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220507094016.1991-1-jx8zjs@126.com
src/conf/domain_conf.c | 10 +++++++++-
src/conf/domain_conf.h |  2 ++
src/qemu/qemu_domain.c | 18 ++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
[PATCH 0/3] Add a retry procedure after failing to do post parsing
Posted by zhangjl02 1 week, 2 days ago
Get default emulator based on guest's arch, and replace it in domain's
definition after domainPostParseDataAlloc's failure, then alloc again.
This will solve the migration problem because of qemu emulator location error,
especially, from host with to host without qemu-kvm.
This commit will also allow user to create a domain with wrong emulator 
location, and correct it to the default one.

zhangjl02 (3):
  qemu_domain: introduce qemuDomainPostParseDataDefEmulator
  domain_conf: introduce virDomainPostParseDataDefEmulator type
  domain_conf: set default emulator into def if it fails to alloc

 src/conf/domain_conf.c | 10 +++++++++-
 src/conf/domain_conf.h |  2 ++
 src/qemu/qemu_domain.c | 18 ++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

-- 
2.35.1.windows.2
Re: [PATCH 0/3] Add a retry procedure after failing to do post parsing
Posted by Daniel P. Berrangé 1 week ago
On Sat, May 07, 2022 at 05:40:13PM +0800, zhangjl02 wrote:
> Get default emulator based on guest's arch, and replace it in domain's
> definition after domainPostParseDataAlloc's failure, then alloc again.
> This will solve the migration problem because of qemu emulator location error,
> especially, from host with to host without qemu-kvm.

When you're migrating between hosts it is possible to provide libvirt an
updated XML doc at the time you initiate the migration. This allows you
to change any aspect that doesn't impact guest ABI, so you can provide
an updated emulator binary path at time of migration.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH 0/3] Add a retry procedure after failing to do post parsing
Posted by Peter Krempa 1 week ago
On Mon, May 09, 2022 at 09:12:51 +0100, Daniel P. Berrangé wrote:
> On Sat, May 07, 2022 at 05:40:13PM +0800, zhangjl02 wrote:
> > Get default emulator based on guest's arch, and replace it in domain's
> > definition after domainPostParseDataAlloc's failure, then alloc again.
> > This will solve the migration problem because of qemu emulator location error,
> > especially, from host with to host without qemu-kvm.

[please primarily put justification of why you are doing something into
the patches themselves. Apart from making it more obvious to reviewers
it also records the justification in git once patches are commited]

> When you're migrating between hosts it is possible to provide libvirt an
> updated XML doc at the time you initiate the migration. This allows you
> to change any aspect that doesn't impact guest ABI, so you can provide
> an updated emulator binary path at time of migration.

Actually there might be a problem with this. I've discussed this
recently with Jirka.

Specifically the ABI stability check is done on the source of the
migration. This means that the source has to actually parse and
interpret the destination XML too if it's provided by the user.

Now if your source host doesn't have the qemu binary or doesn't have it
in the path you have it on the destination this will fail.

I mentioned to Jirka that I think this is sub-optimal:

1) see problem above
2) the post-parse callbacks might fill in different defaults e.g. if the
destination qemu has different capabilities
3) if it were done on destination, the source portion of the XML can be
parsed without post-parse callbacks as it comes actually from a live
libvirt instance

So with the above if they have problem of qemu not being where they
expect, using of the destination XML will not help.

They might be able to use the hook script to filter it on the
destination though:

https://www.libvirt.org/hooks.html#qemu-guest-migration
Re: [PATCH 0/3] Add a retry procedure after failing to do post parsing
Posted by Daniel P. Berrangé 1 week ago
On Mon, May 09, 2022 at 10:22:56AM +0200, Peter Krempa wrote:
> On Mon, May 09, 2022 at 09:12:51 +0100, Daniel P. Berrangé wrote:
> > On Sat, May 07, 2022 at 05:40:13PM +0800, zhangjl02 wrote:
> > > Get default emulator based on guest's arch, and replace it in domain's
> > > definition after domainPostParseDataAlloc's failure, then alloc again.
> > > This will solve the migration problem because of qemu emulator location error,
> > > especially, from host with to host without qemu-kvm.
> 
> [please primarily put justification of why you are doing something into
> the patches themselves. Apart from making it more obvious to reviewers
> it also records the justification in git once patches are commited]
> 
> > When you're migrating between hosts it is possible to provide libvirt an
> > updated XML doc at the time you initiate the migration. This allows you
> > to change any aspect that doesn't impact guest ABI, so you can provide
> > an updated emulator binary path at time of migration.
> 
> Actually there might be a problem with this. I've discussed this
> recently with Jirka.
> 
> Specifically the ABI stability check is done on the source of the
> migration. This means that the source has to actually parse and
> interpret the destination XML too if it's provided by the user.
> 
> Now if your source host doesn't have the qemu binary or doesn't have it
> in the path you have it on the destination this will fail.
> 
> I mentioned to Jirka that I think this is sub-optimal:
> 
> 1) see problem above
> 2) the post-parse callbacks might fill in different defaults e.g. if the
> destination qemu has different capabilities
> 3) if it were done on destination, the source portion of the XML can be
> parsed without post-parse callbacks as it comes actually from a live
> libvirt instance

Right so we need to pass the XML to the dest, have its details
expanded, then sent back to the src for ABI checking. Or alternatively
just send the current live XML from src to dest, and let the dest do
the ABI checking in the Prepare step. 

> So with the above if they have problem of qemu not being where they
> expect, using of the destination XML will not help.

Hmm, yes, annoying.

> 
> They might be able to use the hook script to filter it on the
> destination though:
> 
> https://www.libvirt.org/hooks.html#qemu-guest-migration
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|