Commit Graph

613 Commits

Author SHA1 Message Date
Alexandre Derumier
1663671958 ProcFSTools:read_proc_mounts: increase read size
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2017-12-13 08:11:34 +01:00
Thomas Lamprecht
608b99cdd7 wait_for_vnc_port: die if port did not get ready
All of our users expected this behavior and did not check for undef

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-13 08:10:55 +01:00
Thomas Lamprecht
379b383772 daemon: fix send termination to all workers on exit
The hash slice did not work as intented here, it only return the keys
from the last elemend defined in the slice, thus not all workers got
a TERM.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-13 08:09:31 +01:00
Wolfgang Bumiller
647bd25d41 partially revert: daemon: refactor and cleanup
Reverts a hunk of 0da5a3e43b which removed checking &
untainting of pids from the PVE_DAEMON_WORKER_PIDS env var.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-12-13 08:09:24 +01:00
Wolfgang Bumiller
7d05441aa1 daemon: add missing parenthesis around list
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 0da5a3e43b ("daemon: refactor and cleanup")
2017-12-13 08:09:18 +01:00
Thomas Lamprecht
f345c9dba1 daemon: terminate_server reduce code reuse
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-13 08:09:15 +01:00
Thomas Lamprecht
47d964fb0c daemon: refactor and cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-13 08:09:11 +01:00
Thomas Lamprecht
1841cc37d2 daemon: don't send SIGTERM before restart on leave_children_open_on_reload
Else this options is not really useful. First, sending a SIGTERM lets
the children exit, not quite what "leave_children_open_on_reload"
promises.

The problem this causes is that we may get a time window where no
worker is active and thus, for example, our API daemon would not
accept connections during a restart (or better said, reload).

So, don't request termination of any child worker, if this option is
set, but rather just restart (re-exec) ourself, startup a new set of
workers and only then request the termination of the old ones,
allowing a fully seamless reload.

This is only done on `$daemon-exe restart` and thus on
`systemctl reload $daemon`, systemctl restart or any other stop start
cycles always exit all other workers first.

This expects that the worker can do a graceful termination on
SIGTERM, which is already the case for anything using our AnyEvent
based class (which is base of our HTTPServer module).
With graceful termination is meant the following: the worker accepts
no new work and exits immediately after the current queued work is
done.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-13 08:09:08 +01:00
Wolfgang Bumiller
da0d213987 tools: df: handle a failing df
This function assumed df() will work or hang, but it can
also actually fail and return undef which results in
warnings - let's silence those.
2017-10-25 08:51:56 +02:00
Wolfgang Bumiller
f2a39aa465 bump version to 4.0-96 2017-07-14 13:25:38 +02:00
Wolfgang Bumiller
380896f1cf tools: next_unused_port: use IPPROTO_TCP explicitly
Otherwise perl tries to bind+listen on a UDP socket if the
TCP socket fails - which is a waste since we're looking for
TCP ports.
Additionall since UDP doesn't support listen(), perl will
return EOPNOTSUPP instead of, say, EADDRINUSE. (We don't
care about the error in this code though.)
2017-07-14 13:17:32 +02:00
Emmanuel Kasper
094115958f Add utility subroutine to get the fully qualified domain name of a host 2017-07-14 13:17:32 +02:00
Wolfgang Bumiller
d01fc8a328 tools: unused ports: optional address parameter
While it should be impossible to bind to a wildcard address
when the port is in use by any other address there's one
case where this is allowed, and that's when the port is in
use by an ipv6 address while trying to bind to an ipv4
wildcard.
This currently happens when qemu finds ::1 for the
'localhost' we pass to qemu's spice address while we're
resolving the local nodename via IPv4.
2017-07-14 13:17:32 +02:00
Wolfgang Bumiller
ddcbc8fbcf 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-07-14 13:17:31 +02:00
Wolfgang Bumiller
f09f8bb49b net: only disable ipv6 on actual creation
And leave it alone if the interface already existed.
2017-06-12 11:17:15 +02:00
Dietmar Maurer
26aa53f248 INotify.pm: use Clone::clone instead of Storable::dclone
I run into seroius troubles with dclone, which seem to be
buggy with tainted flag ...

Also, documentation states Clone::clone is much faster.
2017-06-12 11:15:22 +02:00
Wolfgang Bumiller
96745ebcf1 fix #1388: cpuset: sort members numerically
(cherry picked from commit 1cffb285c5)
2017-05-18 09:08:43 +02:00
Dietmar Maurer
7c3d50790a bump version to 4.0-95 2017-05-04 10:04:12 +02:00
Thomas Lamprecht
28c5d5e681 Network: add helpers to resolve hostnames to IPs
Add addr_to_ip and get_ip_from_hostname helpers to PVE::Network

The first helper, addr_to_ip, is based on Wolfgangs version of this
[0]
I just moved it from PVE::Tools to PVE::Network, as it seems a more
fitting place.
It uses getnameinfo to extract information from the paddr parameter,
which is sockaddr struct
It gets used in the second helper and in a bug fix series from
Wolfgang [1]

The second helper, get_ip_from_hostname, resolves an hostname to an
IP and checks if it isn't one from the for loopback reserved 127/8
subnet. It will be used in get_remote_nodeip from PVE::CLuster and
for a bugfix in pvecm.

[0]: http://pve.proxmox.com/pipermail/pve-devel/2017-April/026099.html
[1]: http://pve.proxmox.com/pipermail/pve-devel/2017-April/026098.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 87aa00de73)
2017-05-04 10:03:27 +02:00
Dietmar Maurer
4519675783 bump version to 4.0-94 2017-03-09 09:28:28 +01:00
Dominik Csapak
9a38f4ece0 add keeplocale parameter to run_command
since the "lang" param has not worked, introduce a "keeplocale"
parameter instead.

the default behaviour is the same (set LC_ALL to 'C'), but we can use
the parameter to keep the locale from the host (eg. for the vncshell)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 0f3f314ed7)
2017-03-09 09:26:12 +01:00
Dietmar Maurer
8d8869aeff Makefile: use "--product pve --dist jessie" for upload 2017-03-08 10:18:23 +01:00
Dietmar Maurer
657d77df4c bump version to 4.0-93 2017-03-08 06:18:32 +01:00
Dietmar Maurer
bbca3bdc48 SectionConfig::check_value: return bool/numbers as numeric value
This is important when we convert the result to JSON.
Else the GUI receives booleans as "0", which evaluate to true
in JS!

NOTE: "0" evaluates to false with perl.
2017-02-25 09:41:17 +01:00
Dietmar Maurer
79501b2a58 JSONSchema::check_type: return success (not value) 2017-02-25 09:24:24 +01:00
Dietmar Maurer
dc9c3ffa6c RESTEnvironment->init_request: reset result_attributes 2017-02-24 06:30:16 +01:00
Dietmar Maurer
9c2e403407 SectionConfig: add new parameter $skip_type to createSchema()
This is useful when there is only a single type of entries.
2017-02-20 12:40:33 +01:00
Dietmar Maurer
df89e5eb15 SectionConfig:write_config: sort options by key name
Else we can get different config digest...
2017-02-19 14:47:00 +01:00
Dietmar Maurer
885641fb6a SectionConfig: allow to get class specific updateSchema()
Useful when you have different section types, and you want to have
separate update API methods.
2017-02-19 11:17:34 +01:00
Dominik Csapak
3c476ed580 (maybe) fixes #1229: fix port reservation
when reserving ports, we use lock_file to lock the
reservation file, but then use file_set_content which
writes a new file and renames it, making the lock invalid
and different processes waiting for the lock get inconsistent
data

instead we use a designated lock file for the lock, so that we don't
lose the lock when writing the reservation file

this should fix the problem that sometimes multiple vms get the
same vnc/spice port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-02-16 15:02:55 +01:00
Dominik Csapak
813a5c0d26 fix trailing whitespaces
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-02-16 09:15:47 +01:00
Emmanuel Kasper
ef73f03b60 Fix example to latest RestHandler
looking at the handle() sub from RestHandler.pm

    my $result = &$func($param);

this parameters are not passed anymore
2017-02-15 11:14:59 +01:00
Wolfgang Bumiller
f5a73bff2c bump version to 4.0-92 2017-02-09 11:40:07 +01:00
Wolfgang Bumiller
0c0304c0d9 deps: moving skiplock breaks qemu-server << 4.0-109 2017-02-08 09:56:43 +01:00
Wolfgang Bumiller
26bcdf92d5 JSONSchema: adding skiplock option here 2017-02-07 14:54:31 +01:00
Wolfgang Bumiller
86330049be Network: stop using ifconfig
We shouldn't mix different tool sets on the one hand, and on
the other hand net-tools is an optional package in stretch
and there's no real need for us to depend on it.
2017-02-07 14:54:31 +01:00
Fabian Grünbichler
aa6e988099 bump version to 4.0-91 2017-02-06 14:45:47 +01:00
Fabian Grünbichler
c5df85be73 add Breaks for upgrade path 2017-02-06 14:44:48 +01:00
Wolfgang Bumiller
87cd38946e buildsys: missing build-dependencies 2017-02-03 12:12:54 +01:00
Fabian Grünbichler
fb3a6db16c cleanup previous commit 2017-01-27 15:21:54 +01:00
Wolfgang Link
affde347f1 Fix interface writer for bridge_ports and slaves.
The pve-iface-list allow to separate interfaces with [;,\s].
But in the interface file are only whitespace allowed to separate interfaces.
2017-01-27 14:45:54 +01:00
Fabian Grünbichler
a056df6bda bump version to 4.0-90 2017-01-27 10:57:59 +01:00
Wolfgang Bumiller
a313fe7335 RESTEnvironment: let check_worker take a $self 2017-01-27 10:27:38 +01:00
Fabian Grünbichler
7788d7e523 bump version to 4.0-89 2017-01-25 10:01:55 +01:00
Fabian Grünbichler
c480d509e9 remove AbstractConfig and AbstractMigrate
they have their own repo / package now (pve-guest-common)
2017-01-25 10:01:55 +01:00
Dietmar Maurer
5f9861ad1f set compat level to 9
To avoid warnings on debian stretch.
2017-01-24 11:16:32 +01: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
Wolfgang Bumiller
e0a862e2c0 fix #1232: cleanup bridges on veth_delete
When a container stops or hotplug changes are applied we
do a veth_delete() which does not cleanup the firewall
bridges or OVS ports. This is problematic at the next
startup. When creating a network device we usually want to
copy the MTU of the bridge we intend to put it on, however,
with OVS still having the old port lying around the
recreated device gets associated with the bridge before we
read its MTU, potentially reducing it to that of the newly
created device.

This cleanup also gets rid of stale fwbr/fwln devices from
stopped containers.
2017-01-20 10:05:10 +01:00
Dietmar Maurer
2aabf653ad bump version to 4.0-88 2017-01-19 12:53:30 +01:00
Dietmar Maurer
2b4582cb92 remove libmime-base32-perl - we do not need that 2017-01-19 12:52:32 +01:00