[libvirt] [PATCH 3/9] qemu: Reuse qemuBlockStorageSourceAttachApply in disk hotplug

Peter Krempa pkrempa at redhat.com
Mon Jun 4 06:42:55 UTC 2018


On Sat, Jun 02, 2018 at 17:39:51 +0200, Ján Tomko wrote:
> On Fri, Jun 01, 2018 at 05:51:06PM +0200, Peter Krempa wrote:
> > Create a new "Prepare" function and move the drive add code into the new
> > helpers. This will eventually allow to simplify and unify the attaching
> > code for use with blockdev at the same time as providing compatibility
> > with older qemus.
> > 
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> > src/qemu/qemu_block.c   | 18 ++++++++++++++++++
> > src/qemu/qemu_block.h   |  4 ++++
> > src/qemu/qemu_command.c | 29 ++++++++++++++++++++++++++++-
> > src/qemu/qemu_command.h |  8 ++++----
> > src/qemu/qemu_hotplug.c | 26 +++++++++-----------------
> > 5 files changed, 63 insertions(+), 22 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> > index 85176925c9..73aab9d73a 100644
> > --- a/src/qemu/qemu_block.c
> > +++ b/src/qemu/qemu_block.c

[...]

> > @@ -1591,6 +1603,12 @@ qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon,
> >     if (data->storageAttached)
> >         ignore_value(qemuMonitorBlockdevDel(mon, data->storageNodeName));
> > 
> > +    if (data->driveAdded) {
> > +        if (qemuMonitorDriveDel(mon, data->driveAlias) < 0)
> > +            VIR_WARN("Unable to remove drive %s (%s) after failed "
> > +                     "qemuMonitorAddDevice", data->driveAlias, data->driveCmd);
> > +    }
> > +
> >     virErrorRestore(&orig_err);
> 
> Even though this call is unrelated to the other two, shouldn't rollback
> be in reverse order?

I'll put it so that it's strictly in reverse order, but I made it
impossible to create the data structure in a way that would allow
'drive_add' and 'blockdev_add' be used at the same time.

> 
> Reviewed-by: Ján Tomko <jtomko at redhat.com>
> 
> Jano



> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-------------- 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/20180604/cad37b71/attachment-0001.sig>


More information about the libvir-list mailing list