[libvirt] [PATCH 2/9] qemu: process: Don't try to redetect missing qemuCaps on reconnect

Peter Krempa pkrempa at redhat.com
Mon Nov 25 14:46:38 UTC 2019


On Mon, Nov 25, 2019 at 13:47:15 +0000, Daniel Berrange wrote:
> On Mon, Nov 25, 2019 at 02:18:54PM +0100, Peter Krempa wrote:
> > On Mon, Nov 25, 2019 at 13:11:10 +0000, Daniel Berrange wrote:
> > > On Mon, Nov 25, 2019 at 02:07:13PM +0100, Peter Krempa wrote:
> > > > On Mon, Nov 25, 2019 at 12:59:00 +0000, Daniel Berrange wrote:
> > > > > On Mon, Nov 25, 2019 at 01:53:47PM +0100, Peter Krempa wrote:
> > > > > > The redetection was originally added in 43c01d3838 as a way to recover
> > > > > > from libvirtd upgrade from the time when we didn't persist the qemu
> > > > > > capabilities in the status XML. Also this the oldest supported qemu by
> > > > > > more than two years.
> > > > > > 
> > > > > > Even if somebody would have a running VM running at least qemu 1.5 with
> > > > > > such an old libvirt we certainly wouldn't do the right thing by
> > > > > > redetecting the capabilities and then trying to communicate with qemu.
> > > > > > 
> > > > > > For now it will be the best to just stop considering this scenario any
> > > > > > more.
> > > > > > 
> > > > > > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > > > > > ---
> > > > > >  src/qemu/qemu_process.c | 7 -------
> > > > > >  1 file changed, 7 deletions(-)
> > > > > > 
> > > > > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> > > > > > index 1b88c471f4..a76a8da841 100644
> > > > > > --- a/src/qemu/qemu_process.c
> > > > > > +++ b/src/qemu/qemu_process.c
> > > > > > @@ -8085,13 +8085,6 @@ qemuProcessReconnect(void *opaque)
> > > > > >          goto error;
> > > > > >      }
> > > > > > 
> > > > > > -    /* If upgrading from old libvirtd we won't have found any
> > > > > > -     * caps in the domain status, so re-query them
> > > > > > -     */
> > > > > > -    if (!priv->qemuCaps &&
> > > > > > -        (qemuDomainUpdateQEMUCaps(obj, driver->qemuCapsCache) < 0))
> > > > > > -        goto error;
> > > > > 
> > > > > Shouldn't we be making missing qemuCaps into a fatal error
> > > > > when loading that VM.
> > > > 
> > > > I thought about it for a bit. If we make it an error the VM will vanish
> > > > after upgrade (and continue running). If we don't make an error it will
> > > > not vanish and you'll be able to at least destroy it.
> > > > 
> > > > Given that such situation is super-unlikely, I opted to remove it.
> > > > Nobody will probably run into this situation and if yes then the VM will
> > > > not vanish at least.
> > > > 
> > > > I can add an error though, but to me it seems it's not worth.
> > > 
> > > My concern is that pretty much all our later code will assume that
> > > priv->qemuCaps is non-NULL.  So by ignoring the error, the VM might
> > > not vanish initially, but libvirtd may well crash shortly after.
> > 
> > Good point.
> > 
> > The caps are parsed in qemuDomainObjPrivateXMLParse
> > 
> > How about we either change the condition to allocate priv->qemuCaps even
> > if 0 elements are found in the XML so that priv->qemuCaps is not NULL
> > (but empty).
> 
> This is fine, especially if we mark the VM tainted when we reconnect.

Eh, I think it's so unlikely for that situation to happend that I'll
preferrably add an explicit error and make the VM disappear rather than
trying to add a taint for this scenario.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191125/17a7525e/attachment-0001.sig>


More information about the libvir-list mailing list