
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@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@redhat.com>
Jano
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list