]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_hotplug: Report VIR_ERR_DEVICE_MISSING when device is not found
authorLee Yarwood <lyarwood@redhat.com>
Mon, 14 Jun 2021 10:18:37 +0000 (11:18 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 16 Jun 2021 11:01:36 +0000 (13:01 +0200)
126db34a81bc9f9f9710408f88cceaa1e34bbbd7 had previously switched various
flows over to this from VIR_ERR_OPERATION_FAILED.

This change simply does the same for qemuDomainDetachPrepDisk,
qemuDomainDetachPrepInput and qemuDomainDetachPrepVsock to allow
management apps to centralise their error handling on just
VIR_ERR_DEVICE_MISSING for missing devices during a detach.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_hotplug.c

index 8f7ac301145a1700c87cd1ce9d3cbe67bd8a6062..ddc797afaef8cef40fb419989e9419dc2df40452 100644 (file)
@@ -5317,7 +5317,7 @@ qemuDomainDetachPrepDisk(virDomainObj *vm,
     int idx;
 
     if ((idx = qemuFindDisk(vm->def, match->dst)) < 0) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
+        virReportError(VIR_ERR_DEVICE_MISSING,
                        _("disk %s not found"), match->dst);
         return -1;
     }
@@ -5814,7 +5814,7 @@ qemuDomainDetachPrepInput(virDomainObj *vm,
     int idx;
 
     if ((idx = virDomainInputDefFind(vm->def, match)) < 0) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+        virReportError(VIR_ERR_DEVICE_MISSING, "%s",
                        _("matching input device not found"));
         return -1;
     }
@@ -5850,7 +5850,7 @@ qemuDomainDetachPrepVsock(virDomainObj *vm,
     *detach = vsock = vm->def->vsock;
     if (!vsock ||
         !virDomainVsockDefEquals(match, vsock)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+        virReportError(VIR_ERR_DEVICE_MISSING, "%s",
                        _("matching vsock device not found"));
         return -1;
     }