Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Containerfile.tests.el8
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM quay.io/almalinuxorg/8-base:latest
RUN set -exo pipefail \
&& dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
&& dnf install -y --setopt install_weak_deps=false --nodocs \
python3-requests python3-cryptography python3-setuptools python3-libvirt python3-lxml python3-libguestfs python3-pytest python3-coverage python3-monotonic \
python3-requests python3-cryptography python3-setuptools python3-libvirt python3-lxml python3-libguestfs python3-pytest python3-coverage \
libvirt-daemon libvirt-daemon-kvm libvirt-daemon-driver-qemu libvirt-daemon-config-network systemd \
&& dnf clean all \
&& rm -rf /var/cache/* /var/log/dnf*
Expand Down
2 changes: 1 addition & 1 deletion Containerfile.tests.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM quay.io/fedora/fedora:latest
RUN set -exo pipefail \
&& dnf install -y --setopt install_weak_deps=false --nodocs \
python3-requests python3-cryptography python3-setuptools python3-libvirt python3-lxml python3-libguestfs python3-pytest python3-coverage python3-monotonic \
python3-requests python3-cryptography python3-setuptools python3-libvirt python3-lxml python3-libguestfs python3-pytest python3-coverage \
libvirt-daemon libvirt-daemon-kvm libvirt-daemon-qemu libvirt-daemon-config-network systemd \
&& dnf clean all \
&& rm -rf /var/cache/* /var/log/dnf*
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ guestfs Python module, which is not available from pypi, and needs a running
libvirtd for most of the tests to run. To install all the test requirements on
Fedora:

dnf install python3-requests python3-cryptography python3-libvirt python3-lxml python3-libguestfs python3-pytest python3-monotonic
dnf install python3-requests python3-cryptography python3-libvirt python3-lxml python3-libguestfs python3-pytest

If you wish to test on EL 7, make that:

Expand Down
1 change: 0 additions & 1 deletion oz.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Requires: python3-lxml
Requires: python3-libguestfs >= 1.18
Requires: python3-libvirt
Requires: python3-cryptography
Requires: python3-monotonic
Requires: python3-requests
# in theory, oz doesn't really require libvirtd to be local to operate
# properly. However, because of the libguestfs manipulations, in practice
Expand Down
9 changes: 6 additions & 3 deletions oz/Guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import errno
import hashlib
import logging
import monotonic
try:
from time import monotonic
except ImportError:
from monotonic import monotonic
import os
import re
import shutil
Expand Down Expand Up @@ -1153,7 +1156,7 @@ def _wait_for_guest_boot(self, libvirt_dom):
self.data = b''
# three minutes later or at least timeout before the global boot_timeout
# potential negative boot_deadline is ok in the check
boot_deadline = monotonic.monotonic() + min(3 * 60 , self.boot_timeout - 2)
boot_deadline = monotonic() + min(3 * 60 , self.boot_timeout - 2)

def _boot_cb(self):
'''
Expand Down Expand Up @@ -1189,7 +1192,7 @@ def _boot_cb(self):
# Getting address can be slower than first report, so it is worth
# to try few more times before giving up. Cron should send announce
# every minute, so three minutes should be enough to confirm.
if monotonic.monotonic() < boot_deadline:
if monotonic() < boot_deadline:
# if the data we got didn't match, we need to continue waiting.
# before going to sleep, make sure that the domain is still
# around
Expand Down
11 changes: 7 additions & 4 deletions oz/ozutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@

import lxml.etree

import monotonic
try:
from time import monotonic
except ImportError:
from monotonic import monotonic

import requests

Expand Down Expand Up @@ -1138,11 +1141,11 @@ def timed_loop(max_time, cb, msg, cb_arg=None):
False.
'''
log = logging.getLogger('%s' % (__name__))
now = monotonic.monotonic()
now = monotonic()
end = now + max_time
next_print = now
while now < end:
now = monotonic.monotonic()
now = monotonic()
if now >= next_print:
left = int(end) - int(now)
if left < 0:
Expand All @@ -1156,7 +1159,7 @@ def timed_loop(max_time, cb, msg, cb_arg=None):
# It's possible that the callback took longer than one second.
# In that case, just skip our sleep altogether in an attempt to
# catch up.
sleep_time = 1.0 - (monotonic.monotonic() - now)
sleep_time = 1.0 - (monotonic() - now)
if sleep_time > 0:
# Otherwise, sleep for a time. Note that we try to maintain
# on our starting boundary, so we'll sleep less than a second
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ requests
cryptography
libvirt-python
lxml
monotonic
monotonic; python_version < '3.3'