Re: [PATCH] qemu: hotplug: Properly clean up drive backend if frontend hotplug fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 14, 2015 at 08:43:37 +0200, Michal Privoznik wrote:
> On 11.09.2015 17:41, Peter Krempa wrote:
> > Commit 8125113c added code that should remove the disk backend if the
> > fronted hotplug failed for any reason. The code had a bug though as it
> > used the disk string for unplug rather than the backend alias. Fix the
> > code by pre-creating an alias string and using it instead of the disk
> > string. In cases where qemu does not support QEMU_CAPS_DEVICE, we ignore
> > the unplug of the backend since we can't really create an alias in that
> > case.
> > 
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1262399
> > ---
> >  src/qemu/qemu_hotplug.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > index 63fafa6..c956e8c 100644
> > --- a/src/qemu/qemu_hotplug.c
> > +++ b/src/qemu/qemu_hotplug.c
> > @@ -321,6 +321,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
> >      qemuDomainObjPrivatePtr priv = vm->privateData;
> >      char *devstr = NULL;
> >      char *drivestr = NULL;
> > +    char *drivealias = NULL;
> >      bool releaseaddr = false;
> >      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> >      const char *src = virDomainDiskGetSource(disk);
> > @@ -365,6 +366,10 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
> >          if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
> >              goto error;
> > 
> > +        if (virAsprintf(&drivealias, "%s%s", QEMU_DRIVE_HOST_PREFIX,
> > +                        disk->info.alias) < 0)
> > +            goto error;
> > +
> 
> Maybe we can use qemuDeviceDriveHostAlias() instead of virAsprintf?
> 
Indeed. I couldn't remember that we have something like that when I was
fixing the code.

I'll fix it and push. Thanks

Peter

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]