
Hello Daniel, On Thu, Jan 02, 2020 at 11:54:23AM -0300, Daniel Henrique Barboza wrote:
On 1/2/20 11:36 AM, Michael Weiser wrote:
I'd rather not reference virsh command options in the error message as it would be highly confusing in any other context. For example, python clients get the error message wrapped in an exception, augmented already by a prefix telling them they need to force the operation: Good point.
Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper callback(asyncjob, *args, **kwargs) File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb callback(*args, **kwargs) File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn ret = fn(self, *args, **kwargs) File "/usr/share/virt-manager/virtManager/object/domain.py", line 1055, in revert_to_snapshot self._backend.revertToSnapshot(snap.get_backend()) File "/usr/lib64/python3.6/site-packages/libvirt.py", line 2088, in revertToSnapshot if ret == -1: raise libvirtError ('virDomainRevertToSnapshot() failed', dom=self) libvirt.libvirtError: revert requires force: revert to snapshot while there is a managed saved state will cause corruption when run, remove saved state first
The same is actually the case for virsh already:
virsh # snapshot-revert debian --snapshotname snapshot1 error: revert requires force: revert to snapshot while there is a managed saved state will cause corruption when run, remove saved state first
virsh #
We could of course reword to better take context and prefix into account, e.g.: Since there is already a "revert requires force" prefix in both python and virsh error messages, changing the error message of this v1 becomes more of a wording/flavor issue.
error: revert requires force: Removal of existing managed saved state strongly recommended to avoid corruption
I prefer this wording though :)
I went with: error: revert requires force: snapshot without memory state, removal of existing managed saved state strongly recommended to avoid corruption because it gives the reason and recommended action in compact form. v2 is on its way. -- Michael