On 31.10.2014 03:02, Luyao Huang wrote:
When pass None or a empty dictionary to time, it will report error.Allow a one-element dictionary which contains 'seconds',setting JUST seconds will do the sane thing of passing 0 for nseconds, instead of erroring out.If dict have a unkown key, it will report error. Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx> --- libvirt-override-virDomain.py | 6 +++--- libvirt-override.c | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py index a50ec0d..2a4c4c9 100644 --- a/libvirt-override-virDomain.py +++ b/libvirt-override-virDomain.py @@ -66,9 +66,9 @@ if ret == -1: raise libvirtError ('virDomainGetTime() failed', dom=self) return ret - def setTime(self, time=None, flags=0): - """Set guest time to the given value. @time is a dict conatining - 'seconds' field for seconds and 'nseconds' field for nanosecons """ + def setTime(self, time, flags=0): + """Set guest time to the given value. @time is a dict containing + 'seconds' field for seconds and 'nseconds' field for nanoseconds """ ret = libvirtmod.virDomainSetTime(self._o, time, flags) if ret == -1: raise libvirtError ('virDomainSetTime() failed', dom=self) return ret
Well, C API doesn't require @seconds and @nseconds to be always set, ie when using VIR_DOMAIN_TIME_SYNC flag. I believe python binding should follow the design. I'll post updated patch shortly.
Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list