提交 65b390ad 编写于 作者: P Peter Krempa

qemu: hotplug: Properly handle errors in qemuDomainWaitForDeviceRemoval

Callers ignore if this function returns -1 and continue as though the
DEVICE_DELETED event was not received. Since we can't be sure that the
event was not received we should behave as if the event was not
supported and remove the device definition right away. The error
fortunately won't really happen here.
上级 786bc251
...@@ -3348,8 +3348,8 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm) ...@@ -3348,8 +3348,8 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm)
} }
/* Returns: /* Returns:
* -1 on error * 0 when DEVICE_DELETED event is unsupported, or we failed to reliably wait
* 0 when DEVICE_DELETED event is unsupported * for the event
* 1 when DEVICE_DELETED arrived before the timeout and the caller is * 1 when DEVICE_DELETED arrived before the timeout and the caller is
* responsible for finishing the removal * responsible for finishing the removal
* 2 device removal did not finish in qemuDomainRemoveDeviceWaitTime * 2 device removal did not finish in qemuDomainRemoveDeviceWaitTime
...@@ -3364,7 +3364,7 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) ...@@ -3364,7 +3364,7 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm)
return 0; return 0;
if (virTimeMillisNow(&until) < 0) if (virTimeMillisNow(&until) < 0)
return -1; return 0;
until += qemuDomainRemoveDeviceWaitTime; until += qemuDomainRemoveDeviceWaitTime;
while (priv->unpluggingDevice) { while (priv->unpluggingDevice) {
...@@ -3373,9 +3373,9 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) ...@@ -3373,9 +3373,9 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm)
if (errno == ETIMEDOUT) { if (errno == ETIMEDOUT) {
return 2; return 2;
} else { } else {
virReportSystemError(errno, "%s", VIR_WARN("Failed to wait on unplug condition for domain '%s' "
_("Unable to wait on unplug condition")); "device '%s'", vm->def->name, priv->unpluggingDevice);
return -1; return 0;
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册