5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2024-12-25 05:33:49 +03:00
Commit Graph

16 Commits

Author SHA1 Message Date
Dominik Csapak
95386dafb7 fix convert_size with decimal numbers and add tests
converting from 0.5 gb to mb resulted in 0 mb
with this patch it correctly returns 512

also add tests and catch more errors

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-15 11:15:50 +01:00
Wolfgang Bumiller
3feb2c7661 tests: remove acquire-lock newline termination
Not needed anymore.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-11-10 11:29:54 +01:00
Dominik Csapak
e2c29de775 add ability to have multiple timespecs for hours and minutes
so things like: 2,4:0 will work

also add regression tests for this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-13 11:36:20 +02:00
Dominik Csapak
a5ffa49fda trim event and check if empty
give a meaningful error if it is empty and disallow it instead of having
an implicit default (the default should be set by the component using
the calendarevent, not the calendarevent itself)

also add regression tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-13 11:36:11 +02:00
Dominik Csapak
057c619ab2 calendarevent: check range for start also without repetition
else an event like "61" never finishes when calculating the next event

also add regression tests for this and other range checks

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-02 09:30:55 +02:00
Dominik Csapak
a4200306fe calendarevent: change sorting of hours and minutes to numeric
otherwise the numbers are sorted like this:
[1,10,11 .. 19, 2, 20, ..]
which would lead to the wrong next time

also add regression tests for this and mixed forms like:
20..22:*/30

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-05-31 08:37:19 +02:00
Dietmar Maurer
3ebebd191d test/calendar_event_test.pl: regression tests for PVE::CalendarEvent 2017-05-17 13:38:16 +02:00
Wolfgang Bumiller
d9f86d0d87 Tools: make file-locking aware of external exception sources
Previously an external exception (eg. caused by a SIGARLM in a code
which is already inside a run_with_timeout() call) could happen in
various places where we did not properly this situation.
For instance after calling $lock_func() but before reaching the cleanup
code. In this case a lock was leaked.
Additionally the code was broken in that it used perl's automatic hash
creation side effect ($a->{x}->{y} implicitly initializing $a->{x} with
an empty hash when it did not exist). The effect was that if our own
time out was triggered after the initial check for an existing file
handle inside $lock_func() happened (extremely rare since perl would have
to be running insanely slow), the cleanup did:

    if (my $fh = $lock_handles->{$$}->{$filename}->{fh}) {

This recreated $lock_handles->{$$}->{$filename} as an empty hash.
A subsequent call to lock_file_full() will think a file descriptor
already exists because the check simply used:

    if (!$lock_handles->{$$}->{$filename}) {

While this could have been a one-line fix for this one particular case,
we'd still not be taking external timeouts into account causing the
first issue described above.
2017-05-12 11:40:26 +02:00
Dietmar Maurer
5d5a179cda runtest.pl: use lib '.' - because newer perl does not have that by default
To make tests work again on debian stretch.
2017-01-24 11:12:53 +01:00
Dietmar Maurer
1801bdaa93 replace the smartmatch operator 2016-05-12 11:37:00 +02:00
Wolfgang Bumiller
12a235d624 Fix #882: active state of interfaces depends on ipv6
read_etc_network_interfaces used the content of
/proc/net/if_inet6 to decide whether an interface's state is
"active", which means an interface is only active when it
has an ipv6 address, thus using net.ipv6.conf.*.disable_ipv6
on an interface will cause it to show as inactive in the web
interface.

We now filter the interfaces found in /proc/dev/net by their
IFF_UP flag read via an SIOCGIFFLAGS ioctl().
2016-02-10 12:20:21 +01:00
Wolfgang Bumiller
aeac55e138 half-revert: remove autostart property from bridge ports
In commit 21d32c95cd autostart was removed from all bridge
ports but should have only been removed from ovs bridge ports.
2015-10-19 11:11:29 +02:00
Wolfgang Bumiller
7a82210017 don't reorder unknown interface types
Giving unknown interfaces an order-id of 0 caused them to
always be on top of the interfaces file. This is often
undesired. Instead we now only take type-ordering into
account when both interfaces which are being compared have a
known type, and otherwise only use the priority attribute.
This should result in a more stable modification of
interfaces.

Fixes #747
2015-10-07 13:43:28 +02:00
Wolfgang Bumiller
21d32c95cd remove autostart property from bridge ports
Fixes #711
2015-09-14 12:42:47 +02:00
Wolfgang Bumiller
c7c4208a33 tests: list/create/update network interfaces 2015-06-26 07:51:26 +02:00
Wolfgang Bumiller
936218b86f importing etc_network_interfaces tests 2015-06-26 07:49:16 +02:00