[libvirt] [PATCH] test_driver: provide virDomainGetTime implementation

Ján Tomko jtomko at redhat.com
Tue Apr 16 10:29:07 UTC 2019


On Tue, Apr 16, 2019 at 11:27:44AM +0200, Ilias Stamatis wrote:
>Στις Τρί, 16 Απρ 2019 στις 2:00 π.μ., ο/η Cole Robinson
><crobinso at redhat.com> έγραψε:
>>
>> On 4/9/19 6:16 AM, Ján Tomko wrote:
>> > On Mon, Apr 08, 2019 at 01:43:17AM +0200, Ilias Stamatis wrote:
>> >> Implement testDomainGetTime by returning the current time.
>> >>
>> >> Signed-off-by: Ilias Stamatis <stamatis.iliass at gmail.com>
>> >> ---
>> >> I initially implemented this using clock_gettime, but Pavel suggested
>> >> that this might not be a good idea since it isn't a cross-platform
>> >> function. So I used virTimeMillisNow instead and set the nanoseconds
>> >> part to 0 which can be ok for the test driver.
>> >>
>> >
>> > Do you have a consumer for this?
>> >
>> > IIUC these APIs are used for testing by higher layers like virt-manager
>> > or libvirt-dbus and having it return a different value every time does
>> > not seem that useful. For example for nodeCPUstats we return hardcoded
>> > values.
>>
>> I agree, hardcoded is slightly preferred. Consider if we wanted to have
>> virsh unit tests or python binding unit tests, a constant value by
>> default would help ensure some intermediate piece isn't screwing up the
>> value.
>>
>> - Cole
>
>So I can change this to a fixed value. Is there any specific value
>that you would prefer or should I use my current time?
>

Personally, I'd prefer 627319920

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190416/a0672459/attachment-0001.sig>


More information about the libvir-list mailing list