Commit Graph

933 Commits

Author SHA1 Message Date
Dietmar Maurer
2244b2711a CalendarEvent.pm: implement parser/utils for systemd like calender exents
Not complete, but useful.
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
2d63b598e1 SectionConfig.pm: pass section data to format_section_header
So that we can store data in section headers
2017-05-10 11:32:08 +02:00
Dietmar Maurer
b6501c2fd9 JSONSchema.pm: register new standard option pve-replicate 2017-05-08 11:23:39 +02:00
Fabian Grünbichler
03c2655620 bump version to 5.0-11 2017-05-05 12:39:24 +02:00
Thomas Lamprecht
c990256896 get_options: handle array and scalar refs on decoding
get_options is for parsing CLI options, here we decode after using
Getopt as we are not sure how well it handles already decoded data.
But as Gettopt can produces references for the parsed data we must
handle them explictily.
So check if we have a ARRAY or SCALAR reference and decode them
respectively.
All other reference types should not get returned from Getopt so
error out on them.

This bug was seen when viewing backup jobs, as we save the job as a
comand entry in /etc/pve/vzdump.cron and parse it then with this
function on reading.
Besides the use there we use it in the RESTHandler Packages
cli_handler sub method, so some CLI tools could be possibly affected
by this.

Fixes: 24197a9f6c
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-05-05 12:37:50 +02:00
Thomas Lamprecht
87aa00de73 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>
2017-05-04 08:42:55 +02:00
Dietmar Maurer
09f8882f6c bump version to 5.0-10 2017-05-02 11:52:41 +02:00
Dietmar Maurer
6d46baf63a mark decode_utf8_parameters() as depreciated 2017-05-02 11:51:29 +02:00
Dietmar Maurer
24197a9f6c use Encode::Locale to encode parameters read from console(getopt) 2017-05-02 11:14:36 +02:00
Dietmar Maurer
4ebd59685d bump version to 5.0-9 2017-04-29 08:28:30 +02:00
Dietmar Maurer
8e6019b12c PVE::RESTEnvironment::get_user - add $noerr parameter 2017-04-29 08:27:09 +02:00
Wolfgang Bumiller
4860c2b79d bump version to 5.0-8 2017-04-20 12:29:48 +02:00
Wolfgang Bumiller
3f76dabad9 cpuset: remove max-cpu range check
CpuSets usually come from (or a built using) values read
from cgroups anyway. (Eg. for container balancing we only
use ids found in lxc/cpuset.effective_cpus.)
2017-04-20 10:35:54 +02:00
Fabian Grünbichler
d40809208d bump version to 5.0-7 2017-04-10 16:09:46 +02:00
Thomas Lamprecht
38d9aa1247 run_command: default exit code to -1
When the child process running the command got  an signal or failed
to execute exitcode was still undefined as we extract it just only
after the signal/failed to execute check.
This led to:
 > Use of uninitialized value in numeric ne (!=) at
 > /usr/share/perl5/PVE/API2/Qemu.pm line 1433.
errors if we used run_commands `noerr` param and checked for the
commands exit code.

So just default the exit code to -1 for such cases.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-04-10 14:50:13 +02:00
Wolfgang Bumiller
86b8423739 net: only disable ipv6 on actual creation
And leave it alone if the interface already existed.
2017-04-10 14:50:13 +02:00
Dietmar Maurer
7ea9cb6d62 Makefile(clean): remove *.buildinfo 2017-04-04 09:32:59 +02:00
Dietmar Maurer
ccf60d3bb8 PVE::Tools::dump_journal: allow to filter a specific service 2017-04-04 06:35:24 +02:00
Dietmar Maurer
755396b9f6 bump version to 5.0-6 2017-04-03 11:07:56 +02:00
Emmanuel Kasper
d3c8f0c182 Add utility subroutine to get the fully qualified domain name of a host 2017-04-03 11:07:01 +02:00
Dietmar Maurer
7fdae31200 bump version to 5.0-4 2017-03-30 17:51:06 +02:00
Dietmar Maurer
9867ff7a83 PVE::Tools::encrypt_pw() - new helper copied from pve-access-control 2017-03-30 17:49:26 +02:00
Dietmar Maurer
9b8c792f1d bump version to 5.0-4 2017-03-30 17:42:16 +02:00
Dietmar Maurer
cee25a8af9 depend on libmime-base32-perl (required by OTP.pm) 2017-03-30 17:42:16 +02:00
Dietmar Maurer
06a0313f5a OTP.pm: new class with OTP helpers
Copied from pve-access-control.
2017-03-30 17:38:22 +02:00
Fabian Grünbichler
692160c16c README.dev: remove vlan and ifenslave-2.6 packages
we have a conflict on the former and the latter does not
even exist in Jessie.
2017-03-29 14:22:02 +02:00
Fabian Grünbichler
b55b958dfc README.dev: remove '-y' from apt-get 2017-03-29 14:01:19 +02:00
Dietmar Maurer
dc3954cafd bump version to 5.0-3 2017-03-21 12:07:34 +01:00
Dietmar Maurer
32ef45aee2 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-03-21 11:59:08 +01:00
Wolfgang Bumiller
e04b9f4c43 bump version to 5.0-2 2017-03-13 15:07:18 +01:00
Dietmar Maurer
520eab5b38 README.dev: add libiscsi-dev libiscsi7 2017-03-13 12:58:51 +01:00
Dietmar Maurer
25cf5a58e5 README.dev: change build order (pve-firewall before qemu-server) 2017-03-13 12:54:05 +01:00
Dietmar Maurer
b92b9140a5 README.dev: remove lvm.git 2017-03-13 12:41:52 +01:00
Dietmar Maurer
ee45626ada README.dev: add extjs.git and pve-guest-common.git 2017-03-13 12:39:15 +01:00
root
3ffb13953e README.dev: add missing build depends for pve-cluster 2017-03-13 12:26:21 +01:00
root
67b18b3538 add missing build dependencies 2017-03-13 12:22:48 +01:00
root
37640d6262 README.dev: adopt package list for stretch 2017-03-13 11:22:54 +01:00
Dominik Csapak
0f3f314ed7 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>
2017-03-09 09:24:52 +01:00
Dietmar Maurer
a8e49285a5 Makefile: upload to --product pve,pmg
We use the same library for new proxmox mail gateway (pmg).
2017-03-08 12:14:43 +01:00
Fabian Grünbichler
2ebffe56db bump version to 5.0-1 2017-03-08 10:27:29 +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