mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: monitor cleanup delvm error handling
Drop redundant NULL checks, and add an error string prefix Acked-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
a82c182171
commit
d9ed7bb1dd
@ -259,16 +259,17 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name)
|
|||||||
if (qemuMonitorHMPCommand(mon, cmd, &reply))
|
if (qemuMonitorHMPCommand(mon, cmd, &reply))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (strstr(reply, "No block device supports snapshots") != NULL) {
|
if (strstr(reply, "No block device supports snapshots")) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("this domain does not have a device to delete snapshots"));
|
_("this domain does not have a device to delete snapshots"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (strstr(reply, "Snapshots not supported on device") != NULL) {
|
} else if (strstr(reply, "Snapshots not supported on device")) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (strstr(reply, "Error") != NULL
|
} else if (strstr(reply, "Error") &&
|
||||||
&& strstr(reply, "while deleting snapshot") != NULL) {
|
strstr(reply, "while deleting snapshot")) {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply);
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
|
_("Failed to delete snapshot: %s"), reply);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user