[libvirt] [PATCH python] Fix error check for virDomainGetTime method

The virDomainGetTime returns either a dict or None, but the python glue layer for checking for '-1'. Thus it failed to raise an exception on error. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt-override-virDomain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py index fa5f75f..7c417b8 100644 --- a/libvirt-override-virDomain.py +++ b/libvirt-override-virDomain.py @@ -63,7 +63,7 @@ def getTime(self, flags=0): """Extract information about guest time """ ret = libvirtmod.virDomainGetTime(self._o, flags) - if ret == -1: raise libvirtError ('virDomainGetTime() failed', dom=self) + if ret == None: raise libvirtError ('virDomainGetTime() failed', dom=self) return ret def setTime(self, time=None, flags=0): -- 2.9.3

On 05/24/2017 04:15 PM, Daniel P. Berrange wrote:
The virDomainGetTime returns either a dict or None, but the python glue layer for checking for '-1'. Thus it failed to raise an exception on error.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt-override-virDomain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py index fa5f75f..7c417b8 100644 --- a/libvirt-override-virDomain.py +++ b/libvirt-override-virDomain.py @@ -63,7 +63,7 @@ def getTime(self, flags=0): """Extract information about guest time """ ret = libvirtmod.virDomainGetTime(self._o, flags) - if ret == -1: raise libvirtError ('virDomainGetTime() failed', dom=self) + if ret == None: raise libvirtError ('virDomainGetTime() failed', dom=self) return ret
def setTime(self, time=None, flags=0):
ACK, trivial. Michal
participants (2)
-
Daniel P. Berrange
-
Michal Privoznik