From bacc2236309db4099bbbfe7125efaa7ad83739d8 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Fri, 1 Dec 2017 03:12:21 +0100
Subject: [PATCH 09/36] blockdev: Report proper error class in
__com.redhat.drive_del
RH-Author: Eric Blake <eblake@redhat.com>
Message-id: <20171201031221.26738-1-eblake@redhat.com>
Patchwork-id: 78060
O-Subject: [RHEV-7.5 qemu-kvm-rhev PATCH] blockdev: Report proper error class in __com.redhat.drive_del
Bugzilla: 1487515
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
From: Eric Blake <eblake@redhat.com
Libvirt expects 'DeviceNotFound' to suppress the error message rather
than the generic error. If the wrong error class is used, the libvirt
spams /var/log/messages with a spurious message during hot-unplug:
Aug 30 20:03:32 rhosp8-test libvirtd: 2017-08-30 11:03:32.354+0000: 2562: error : qemuMonitorJSONCheckError:389 : internal error: unable to execute QEMU command '__com.redhat_drive_del': Device 'drive-virtio-disk1' not found
Fixes: 60b62c9d
Diagnosis of the issue performed by Peter Krempa.
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
blockdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 0f063ec..6a37934 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2909,7 +2909,8 @@ void qmp___com_redhat_drive_del(const char *id, Error **errp)
blk = blk_by_name(id);
if (!blk) {
- error_setg(errp, "Device '%s' not found", id);
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", id);
return;
}
--
1.8.3.1