pve-common.git
5 months agoassemble_spice_ticket: ensure variable in interpolated string are correct
Thomas Lamprecht [Thu, 23 May 2019 10:52:18 +0000 (12:52 +0200)]
assemble_spice_ticket: ensure variable in interpolated string are correct

In older perl the following two where the same:

"$foo::$bar" == "${foo}::${bar}"

But in perl 5, version 28 it's not anymore,

"$foo::$bar" would be equivalent to "${foo::}${bar}", the double
colons are now not used as variable name boundary, so mark that
explicitly in the affected case and surrounding ones preventively

This fixes authentication with spice* related stuff again.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agobuildsys: change upload dist to buster
Thomas Lamprecht [Tue, 21 May 2019 12:10:03 +0000 (14:10 +0200)]
buildsys: change upload dist to buster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agobump version for buster
Thomas Lamprecht [Tue, 21 May 2019 12:09:26 +0000 (14:09 +0200)]
bump version for buster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agod/control: fix priority-extra-is-replaced-by-priority-optional
Thomas Lamprecht [Thu, 16 May 2019 15:12:51 +0000 (17:12 +0200)]
d/control: fix priority-extra-is-replaced-by-priority-optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agobump version to 5.0-52
Thomas Lamprecht [Wed, 15 May 2019 12:16:17 +0000 (14:16 +0200)]
bump version to 5.0-52

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoJSONSchema: sort keys when dumping config for stabillity
Thomas Lamprecht [Wed, 17 Apr 2019 06:56:23 +0000 (06:56 +0000)]
JSONSchema: sort keys when dumping config for stabillity

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agofollowup: use defined to check if a hash element can be accessed
Thomas Lamprecht [Wed, 15 May 2019 08:20:01 +0000 (10:20 +0200)]
followup: use defined to check if a hash element can be accessed

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoprevent autovivification of sectionconfig options
Dominik Csapak [Wed, 15 May 2019 08:03:50 +0000 (10:03 +0200)]
prevent autovivification of sectionconfig options

If, somehow, someone passes a config to check_config with keys set
that are not in the options for that type, this fixed check
lead to autovivification, meaning that any future calls to the same
worker had an additional option for that type which is not optional

this lead to a wrongfully deleting of entries when updating an entry of
a different type, since all entries of the original types suddenly
did not satisfy their required options and would not get parsed
by read_file anymore (thus missing when a successful write_file was done)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 months agoprint api res: always allow result to be undef if optional
Thomas Lamprecht [Mon, 13 May 2019 06:52:19 +0000 (06:52 +0000)]
print api res: always allow result to be undef if optional

If the return schema says that it's optionally returns something then
we want to allow returning nothing, i.e., undef

Co-developed-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agofollowup code cleanup
Thomas Lamprecht [Wed, 8 May 2019 15:36:14 +0000 (15:36 +0000)]
followup code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoINotify: map address/netmask to cidr while parsing interfaces
Dominik Csapak [Fri, 3 May 2019 07:28:51 +0000 (09:28 +0200)]
INotify: map address/netmask to cidr while parsing interfaces

this allows us to always show the 'address' the 'netmask' and the 'cidr'
both for ipv4 and ipv6

there is a small api change involved in one scenario:
if one manually changed the address to cidr format like
    '10.0.0.4/24'

we now get from the api the parsed values
    addr => 10.0.0.4
    netmask => 24
    cidr => 10.0.0.4/24

instead of
    addr => 10.0.0.4/24
    netmask =>

but i think that circumventing our api when writing the file, but still
relying on the api for reading is not a valid use case, i would argue
that we can change this, especially since we have a new field that
contains that information again (cidr)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 months agoJSONSchema: add get_netmask_bits and missing netmask
Dominik Csapak [Fri, 3 May 2019 07:28:50 +0000 (09:28 +0200)]
JSONSchema: add get_netmask_bits and missing netmask

so one can use the mapping from outside the module

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agobump version to 5.0-51
Thomas Lamprecht [Thu, 18 Apr 2019 11:08:32 +0000 (11:08 +0000)]
bump version to 5.0-51

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agoTools: add setresuid syscall
Stoiko Ivanov [Wed, 17 Apr 2019 08:51:36 +0000 (10:51 +0200)]
Tools: add setresuid syscall

See `man 2 setresuid`. The code was tested with small UIDs (109) and
one which does not fit into 16 bit (100000000), since I wasn't too
sure about the workings of setresuid vs. setresuid32 (see NOTES of
the manpage) - it worked with both.

Linux on amd64 has only a single setresuid, as it the 64 bit arch
came after the setresuid32 syscall, and thus it started with the
later one as single common one

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agofixup comments about RESTEnv access types
Thomas Lamprecht [Wed, 17 Apr 2019 09:06:32 +0000 (09:06 +0000)]
fixup comments about RESTEnv access types

were pretty outdated

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agobump version to 5.0-50
Thomas Lamprecht [Wed, 3 Apr 2019 11:54:39 +0000 (13:54 +0200)]
bump version to 5.0-50

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agoadd request host to RESTEnvironment
Wolfgang Bumiller [Tue, 2 Apr 2019 10:22:01 +0000 (12:22 +0200)]
add request host to RESTEnvironment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agoadd u2f challenge accessors to RESTEnvironment
Wolfgang Bumiller [Tue, 2 Apr 2019 10:22:00 +0000 (12:22 +0200)]
add u2f challenge accessors to RESTEnvironment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agoJSONSchema: fix units of bwlimit
Stoiko Ivanov [Mon, 1 Apr 2019 09:30:57 +0000 (11:30 +0200)]
JSONSchema: fix units of bwlimit

the description of bwlimit wrote MiB/s, the use in restore operation is KiB/s

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
7 months agobump version to 5.0-49
Thomas Lamprecht [Thu, 21 Mar 2019 11:56:58 +0000 (12:56 +0100)]
bump version to 5.0-49

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agoJSONSchema: register 'pve-snapshot-name' here to avoid cyclic dependencies
Thomas Lamprecht [Thu, 21 Mar 2019 11:48:54 +0000 (12:48 +0100)]
JSONSchema: register 'pve-snapshot-name' here to avoid cyclic dependencies

move it from qemu-server as it was also used in pve-container and
pve-manager (pvesr), while guest-commons AbstractConfig could be a
fit too, just move it here as all depending on this already use
JSONSchema and it just fits here...

Break respective qemu-server version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agobump version to 5.0-48
Thomas Lamprecht [Thu, 14 Mar 2019 08:52:22 +0000 (09:52 +0100)]
bump version to 5.0-48

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agofollowup: add verbose_description to new mac-addr standard option
Thomas Lamprecht [Thu, 14 Mar 2019 08:49:54 +0000 (09:49 +0100)]
followup: add verbose_description to new mac-addr standard option

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agoJSONSchema: Adapt MAC address format to unicast
Stoiko Ivanov [Tue, 12 Mar 2019 15:07:41 +0000 (16:07 +0100)]
JSONSchema: Adapt MAC address format to unicast

MAC-addresses having the LSB of the first octet set, are considered
multicast-addresses (see [0,1]).

the 'mac-addr' format got changed to only permit unicast addresses, which should
work for its current use-case (WOL for nodes).
additionally a default option was registered via register_standard_option to be
used in both PVE::LXC::Config and PVE::QemuServer.

[0] https://lists.linuxcontainers.org/pipermail/lxc-users/2010-August/000783.html
[1] https://en.wikipedia.org/wiki/MAC_address

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
8 months agofix #2111: regex match for email addresses
Oguz Bektas [Thu, 28 Feb 2019 14:00:04 +0000 (15:00 +0100)]
fix #2111: regex match for email addresses

now allows:
* addresses without tld (f.e. user@localhost per bug)
* remove limits for number of subdomains
* allow +, -, ~ in local part
* disallow double dots (.. .a. etc) and dots in the end (abc.@mail.com)

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agobump version to 5.0-47
Thomas Lamprecht [Wed, 20 Feb 2019 11:24:19 +0000 (12:24 +0100)]
bump version to 5.0-47

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agoFix 1891: Add zsh command completion generator
Christian Ebner [Wed, 20 Feb 2019 10:59:14 +0000 (11:59 +0100)]
Fix 1891: Add zsh command completion generator

This adds the function needed to generate the zsh autocompletion scripts.
Using the bash completion code path, this generates the list of possible
completions and adds them to the zsh completion by compadd.
For the autocompletion scripts to be loaded automatically, the following two
lines have to be placed in the .zshrc:

autoload -U compinit
compinit

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
8 months agopartially fix #2023: Switch to https for yubico.com API
Rhonda D'Vine [Mon, 18 Feb 2019 10:59:17 +0000 (11:59 +0100)]
partially fix #2023: Switch to https for yubico.com API

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agobump version to 5.0-46
Wolfgang Bumiller [Mon, 11 Feb 2019 09:55:27 +0000 (10:55 +0100)]
bump version to 5.0-46

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agod/control: add missing dependencies
Fabian Grünbichler [Fri, 8 Feb 2019 20:57:07 +0000 (21:57 +0100)]
d/control: add missing dependencies

used by the ACME standalone challenge.

these were previously already depended on by pve-manager, where they were
recently removed - exposing the fact they are in fact required by
libpve-common-perl.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
9 months agobump version to 5.0-45
Thomas Lamprecht [Mon, 4 Feb 2019 10:46:08 +0000 (11:46 +0100)]
bump version to 5.0-45

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agotools: add dev_t_major/minor
Wolfgang Bumiller [Mon, 4 Feb 2019 09:42:03 +0000 (10:42 +0100)]
tools: add dev_t_major/minor

Extract major/minor from `dev_t` values as found in stat()
calls, with support for the full 32 bit values.

The device value returned by stat() is 32 bits long and encoded as
high 12 bit of the minor value as in the 12 MSBs, 12 bit major value,
then the low 8 bit of the minor value in the low byte.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agoTools: add fsync sycall
Thomas Lamprecht [Wed, 30 Jan 2019 16:17:14 +0000 (17:17 +0100)]
Tools: add fsync sycall

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agobump version to 5.0-44
Thomas Lamprecht [Tue, 22 Jan 2019 10:56:40 +0000 (11:56 +0100)]
bump version to 5.0-44

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agoJSONSchema: Add format for MAC address verification
Christian Ebner [Tue, 22 Jan 2019 10:01:39 +0000 (11:01 +0100)]
JSONSchema: Add format for MAC address verification

Adds a format to verify MAC addresses to JSONSchema.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
10 months agofix defaults for standard_output_options
Oguz Bektas [Fri, 4 Jan 2019 11:39:19 +0000 (12:39 +0100)]
fix defaults for standard_output_options

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
10 months agoadd builddeps in readme for qemu
Oguz Bektas [Mon, 7 Jan 2019 10:43:55 +0000 (11:43 +0100)]
add builddeps in readme for qemu

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
10 months agoFixup testcases for the previous commit
Wolfgang Bumiller [Thu, 3 Jan 2019 08:05:46 +0000 (09:05 +0100)]
Fixup testcases for the previous commit

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 months agoINotify: fix wording in networkdoc
Tim Marx [Tue, 4 Dec 2018 09:56:19 +0000 (10:56 +0100)]
INotify: fix wording in networkdoc

Signed-off-by: Tim Marx <t.marx@proxmox.com>
11 months agoupdate builddeps in readme
Oguz Bektas [Thu, 29 Nov 2018 08:40:35 +0000 (09:40 +0100)]
update builddeps in readme

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
11 months agoSysFSTools: add return format comments
Dominik Csapak [Fri, 23 Nov 2018 13:50:11 +0000 (14:50 +0100)]
SysFSTools: add return format comments

for lspci and get_mdev_types

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agobump version to 5.0-43
Thomas Lamprecht [Thu, 22 Nov 2018 10:19:23 +0000 (11:19 +0100)]
bump version to 5.0-43

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobreak qemu-server << 5.0-42
Thomas Lamprecht [Thu, 22 Nov 2018 10:18:25 +0000 (11:18 +0100)]
break qemu-server << 5.0-42

changed the lspci return format

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoSysFSTools.pm: improve and extend lspci
Dominik Csapak [Tue, 20 Nov 2018 16:13:38 +0000 (17:13 +0100)]
SysFSTools.pm: improve and extend lspci

this implements following improvements and optimizations for lspci

* removes the unecessary split between id and function
  since everywhere we need that information, we stitch them together
  anyway. to preserve ordering, simply order by id with string
  comparison 'cmp' (this is important for the shorthand syntax '00:01' in
  the config)
* returns now a list directly, instead of an hash with lists
* returns now always the vendor/device id and class[1]
* filter is now either a string (matches the id partially), or a
  sub, which filters the device out if it returns a falsy value
* adds a verbose flag to include more information about the device,
  such as device/vendor name, iommu-group, mdev support, etc.
  this will be used for the pci scan api call for the gui

1: https://pci-ids.ucw.cz/read/PD/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agoSysFSTools.pm: add mediated devices subs
Dominik Csapak [Tue, 20 Nov 2018 16:13:37 +0000 (17:13 +0100)]
SysFSTools.pm: add mediated devices subs

adds helpers for listing/creating/removing mediated devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agoNetwork : veth pair : fix mtu
Alexandre Derumier [Wed, 21 Nov 2018 16:34:29 +0000 (17:34 +0100)]
Network : veth pair : fix mtu

The ip link set command which create the veth pair is not setting mtu on both peers

example:
vm 106 is on a bridge with mtu 9000

222: tap160i1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast master fwbr160i1 state UNKNOWN group default qlen 1000
223: fwbr160i1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
224: fwpr160p1@fwln160i1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
225: fwln160i1@fwpr160p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000

fwpr160p1@fwln160i1 is correctly created with mtu 9000
but
fwln160i1@fwpr160p1 is created with mtu 1500.
(and then vmbr106i1 is lowered to 1500 too).

This is doing network problem, as tap160i1 is mtu9000.

After this patch:

222: tap160i1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast master fwbr160i1 state UNKNOWN group default qlen 1000
223: fwbr160i1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
224: fwpr160p1@fwln160i1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
225: fwln160i1@fwpr160p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000

11 months agoTools.pm: do not ignore "0" in split_list
Dominik Csapak [Tue, 20 Nov 2018 11:45:15 +0000 (12:45 +0100)]
Tools.pm: do not ignore "0" in split_list

giving split_list the string "0" would actually return
an empty list instead of a list with the element "0"

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agofork_worker: readd the kill safety for _exit again
Thomas Lamprecht [Tue, 20 Nov 2018 09:07:33 +0000 (10:07 +0100)]
fork_worker: readd the kill safety for _exit again

to be sure, plus we have this in other places too here, so be
consistent and double safe(tm)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #1956: return controlling terminal to parent
Stoiko Ivanov [Tue, 20 Nov 2018 08:46:32 +0000 (09:46 +0100)]
fix #1956: return controlling terminal to parent

The changes introduced in e97f807c388c10250f442b1f16c5315df2ffc2af let the
child in fork_worker take the controlling terminal of the session, without
returning it after finishing.
This breaks using/reading from the terminal after both parent and child exit
- e.g. when the code is called from within a shellscript.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
11 months agofork_worker: refactor child exit
Stoiko Ivanov [Tue, 20 Nov 2018 08:46:31 +0000 (09:46 +0100)]
fork_worker: refactor child exit

* factor out duplicated code.
* drop final kill(-9, $$), since the POSIX:_exit call does not return
  (see man 2 _exit).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
11 months agobump version to 5.0-42
Thomas Lamprecht [Mon, 19 Nov 2018 12:46:25 +0000 (13:46 +0100)]
bump version to 5.0-42

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoSysFSTools: lspci: fixup: improve naming and refactor a bit
Thomas Lamprecht [Mon, 19 Nov 2018 10:18:02 +0000 (11:18 +0100)]
SysFSTools: lspci: fixup: improve naming and refactor a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoSysFSTools: iommu_support: improve comment
Thomas Lamprecht [Mon, 19 Nov 2018 10:17:44 +0000 (11:17 +0100)]
SysFSTools: iommu_support: improve comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoSysFSTools: copy over scan_usb from PVE::Storage
Dominik Csapak [Fri, 16 Nov 2018 15:17:50 +0000 (16:17 +0100)]
SysFSTools: copy over scan_usb from PVE::Storage

it makes more sense to have this (not storage dependent) method here,
than in pve-storage

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agoSysFSTools: implement IOMMU check
Dominik Csapak [Fri, 16 Nov 2018 15:17:49 +0000 (16:17 +0100)]
SysFSTools: implement IOMMU check

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agoSysFSTools: implement filter by id in lspci
Dominik Csapak [Fri, 16 Nov 2018 15:17:48 +0000 (16:17 +0100)]
SysFSTools: implement filter by id in lspci

use the new filter parameter as a filter for devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoSysFSTools: factor out PCI regex
Dominik Csapak [Fri, 16 Nov 2018 15:17:47 +0000 (16:17 +0100)]
SysFSTools: factor out PCI regex

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agointroduce SysFSTools
Dominik Csapak [Fri, 16 Nov 2018 15:17:46 +0000 (16:17 +0100)]
introduce SysFSTools

initially, copy pci related subs from PVE::QemuServer we want to have
it in common, so we can maybe reuse them later, also the code is not
really qemu-server related

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoreadme.dev: s/needed/required/ packages
Thomas Lamprecht [Mon, 19 Nov 2018 11:05:31 +0000 (12:05 +0100)]
readme.dev: s/needed/required/ packages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agominor updates to README.dev
Oguz Bektas [Mon, 19 Nov 2018 10:10:49 +0000 (11:10 +0100)]
minor updates to README.dev

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
11 months agotools: template_replace: esacpe braces
Thomas Lamprecht [Sun, 18 Nov 2018 15:06:19 +0000 (16:06 +0100)]
tools: template_replace: esacpe braces

To avoid warnings (and in the future, errors) like:

> Unescaped left brace in regex is deprecated here (and will be fatal
> in Perl 5.32), passed through in regex; marked by <-- HERE in
> m/([^{]+)?({ <-- HERE ([^}]+)})?/ at /usr/share/perl5/PVE/Tools.pm
> line 673.

with future perl versions, like Debian Buster for example has.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agofix #1548: replace perl use vars with our
Tim Marx [Thu, 15 Nov 2018 08:47:41 +0000 (09:47 +0100)]
fix #1548: replace perl use vars with our

replace deprecated 'use vars qw($frob @mung %seen);' with the now in favor
'our $foo;' declaration
see NOTE at: http://perldoc.perl.org/vars.html

Signed-off-by: Tim Marx <t.marx@proxmox.com>
12 months agobump version to 5.0-41
Thomas Lamprecht [Wed, 31 Oct 2018 14:03:56 +0000 (15:03 +0100)]
bump version to 5.0-41

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotests: update to utc flag and add daylight savings test
Wolfgang Bumiller [Wed, 31 Oct 2018 09:54:18 +0000 (10:54 +0100)]
tests: update to utc flag and add daylight savings test

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agoCalendarEvent: add 'utc' flag to calendar specs
Wolfgang Bumiller [Wed, 31 Oct 2018 09:54:17 +0000 (10:54 +0100)]
CalendarEvent: add 'utc' flag to calendar specs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agofix #1963: don't do day-time related math on time stamps
Wolfgang Bumiller [Wed, 31 Oct 2018 09:54:16 +0000 (10:54 +0100)]
fix #1963: don't do day-time related math on time stamps

Since our schedules are usually written in local time, we
cannot actually perform calculations using time stamps as
for instance adding 3600 (1 hour) may yield the exact same
local time as before when translated to the current timezone
during a DST change, or might skip an hour. Thus, 2:30am + 1
hour can be all of 2:30am, 3:30am or 4:30am.

Instead, perform the translation to a "day time" array once,
then search for the scheduled time, and only at the end
translate to a time stamp again. This means adding helpers
to wrap around minutes, hours, days (of month)...

Previously, the following code looped endlessly in
compute_next_event under CEST:
    my $dst_time = timelocal(0, 0, 0, 28, 9, 2018);
    my $t = PVE::CalendarEvent::parse_calendar_event('mon..fri');
    my $next = PVE::CalendarEvent::compute_next_event($t, $dst_time);
Afterwards $next will be '2018-10-29 00:00 CET' as expected.

Of course, a day in which 3am appears twice with a scheduled
event for 3am will cause the event to be scheduled twice
now. Ideally we add the ability to make calendar specs use
UTC (and actually use the $utc parameter we have in
compute_next_event()). systemd.time(7) seems to allow simply
suffixing the spec with the string " UTC" for that purpose,
so we should follow this.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/control: wrap-and-sort
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:09 +0000 (14:36 +0200)]
d/control: wrap-and-sort

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobuild: base BUILDDIR on VERSION
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:08 +0000 (14:36 +0200)]
build: base BUILDDIR on VERSION

this is the standard naming used in Debian/dpkg

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agod/control: bump standards version
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:07 +0000 (14:36 +0200)]
d/control: bump standards version

to current one.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agod/source/format: set format
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:06 +0000 (14:36 +0200)]
d/source/format: set format

removes a warning during build

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agod/control: bump compat to 10
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:05 +0000 (14:36 +0200)]
d/control: bump compat to 10

and debhelper dependency accordingly

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobuild: inline $GITVERSION
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:04 +0000 (14:36 +0200)]
build: inline $GITVERSION

since the top-level Makefile is called during build now, where we might
no be in a git working tree.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agod/control: add missing build-dependencies
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:03 +0000 (14:36 +0200)]
d/control: add missing build-dependencies

found by building in a clean minimal chroot

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobuild: split deb target into deb and src
Fabian Grünbichler [Wed, 17 Oct 2018 12:36:02 +0000 (14:36 +0200)]
build: split deb target into deb and src

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agoINotify: simplify lookup_type_prio
Wolfgang Bumiller [Thu, 4 Oct 2018 11:34:22 +0000 (13:34 +0200)]
INotify: simplify lookup_type_prio

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agoimprove lookup_type_prio
Alexandre Derumier [Mon, 1 Oct 2018 09:14:50 +0000 (11:14 +0200)]
improve lookup_type_prio

- use d->{type} instead regex on ifname
- add stacked vlan support

13 months agoInotify: add support for 802.1ad stacked vlans
Alexandre Derumier [Mon, 1 Oct 2018 09:14:49 +0000 (11:14 +0200)]
Inotify: add support for 802.1ad stacked vlans

13 months agofix #1938: increase filesize limit for /proc/mounts
David Limbeck [Wed, 3 Oct 2018 14:14:10 +0000 (16:14 +0200)]
fix #1938: increase filesize limit for /proc/mounts

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
13 months agoversion bump fixup
Wolfgang Bumiller [Tue, 25 Sep 2018 09:33:46 +0000 (11:33 +0200)]
version bump fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agobump version to 5.0-40
Wolfgang Bumiller [Tue, 25 Sep 2018 08:39:29 +0000 (10:39 +0200)]
bump version to 5.0-40

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agoJSONSchema: typo fixup
Wolfgang Bumiller [Tue, 25 Sep 2018 08:38:04 +0000 (10:38 +0200)]
JSONSchema: typo fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agobump version to 5.0-39
Thomas Lamprecht [Thu, 20 Sep 2018 07:39:13 +0000 (09:39 +0200)]
bump version to 5.0-39

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agofix some erro mesage and comment typos
Thomas Lamprecht [Thu, 20 Sep 2018 07:31:12 +0000 (09:31 +0200)]
fix some erro mesage and comment typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agonew helper get_host_arch
Dietmar Maurer [Thu, 20 Sep 2018 04:21:55 +0000 (06:21 +0200)]
new helper get_host_arch

14 months agofix #1914: CLIFormatter: check also for existence of 'type'
Dominik Csapak [Mon, 17 Sep 2018 08:32:03 +0000 (10:32 +0200)]
fix #1914: CLIFormatter: check also for existence of 'type'

we sometimes define

result => {}

on an api call, so check that result->{type} is defined
and guess the type if not

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoINotify.pm: add methods for reading/writing /etc/hosts
Dominik Csapak [Wed, 12 Sep 2018 08:24:11 +0000 (10:24 +0200)]
INotify.pm: add methods for reading/writing /etc/hosts

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoINotify.pm: use run_command instead of open for calling diff
Dominik Csapak [Thu, 13 Sep 2018 12:55:52 +0000 (14:55 +0200)]
INotify.pm: use run_command instead of open for calling diff

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agodecode comments in /etc/network/interfaces as utf8
Dominik Csapak [Thu, 13 Sep 2018 12:55:51 +0000 (14:55 +0200)]
decode comments in /etc/network/interfaces as utf8

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoapi_dump_full: use api_clone_schema() for 'returns' schema
Dietmar Maurer [Thu, 13 Sep 2018 10:53:36 +0000 (12:53 +0200)]
api_dump_full: use api_clone_schema() for 'returns' schema

This  convert indexed parameters like -net\d+ to -net[n], so resulting dump
is smaller.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
14 months agoINotify: add tests for non-defined vlan bridge ports
Wolfgang Bumiller [Tue, 11 Sep 2018 12:10:36 +0000 (14:10 +0200)]
INotify: add tests for non-defined vlan bridge ports

This tests the case covered by the previous commit

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoInotify: check bridgeport: fix vlan interface not defined
Alexandre Derumier [Tue, 28 Aug 2018 11:31:53 +0000 (13:31 +0200)]
Inotify: check bridgeport: fix vlan interface not defined

We can add to a bridge a non defined vlan interface.
We only need to check that physical interface exist

example:
    auto eno1
    iface eno1 inet manual

    auto vmbr0
    iface vmbr0 inet manual
        bridge_ports eno1.1

[w.bumiller@proxmox.com: style & commit message fixup]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoInotify: fix mtu check
Alexandre Derumier [Tue, 4 Sep 2018 14:36:49 +0000 (16:36 +0200)]
Inotify: fix mtu check

- special check for bond, set parent mtu from slaves mtu if no defined.

- error if parent mtu is lower than child mtu (not bigger)

- return if child mtu is not defined

- fix vlan check (parent/child was inverted)

14 months agoREADME.dev: enhance installing build-dependcy section
Thomas Lamprecht [Wed, 5 Sep 2018 08:57:49 +0000 (10:57 +0200)]
README.dev: enhance installing build-dependcy section

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoREADME.dev: note that one can start from a PVE installation
Thomas Lamprecht [Wed, 5 Sep 2018 08:26:37 +0000 (10:26 +0200)]
README.dev: note that one can start from a PVE installation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoRework of the installation documentation
Martin Beckert [Fri, 24 Aug 2018 10:26:45 +0000 (12:26 +0200)]
Rework of the installation documentation

14 months agorun_fork_with_timeout: handle SIGTERM
Dominik Csapak [Tue, 21 Aug 2018 13:07:25 +0000 (15:07 +0200)]
run_fork_with_timeout: handle SIGTERM

when stopping a worker while doing a run_fork_with_timeout,
we want to handle that there and send the child the SIGTERM
so that it can clean up

for this we have to use readline_nointr,
because the read from the pipe gets interrupted by the signal

this partially fixes #1874
as we now correctly clean up the new disk, except if it is
on lvm/lvmthin (possibly other storages as well), and use the old disk
in the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoadd readline_nointr to Tools
Dominik Csapak [Tue, 21 Aug 2018 13:07:24 +0000 (15:07 +0200)]
add readline_nointr to Tools

this is a wrapper to have an uninterruptible readline
so that we can read e.g. from a pipe even if interrupted by
a signal

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agorender_bytes: avoid untaint by simply change the sprintf call
Dietmar Maurer [Mon, 6 Aug 2018 11:36:23 +0000 (13:36 +0200)]
render_bytes: avoid untaint by simply change the sprintf call

There is no need to untaint if we do it this way (no idea why).

15 months agorender_bytes: check format, untaint before calling sprintf
Dietmar Maurer [Mon, 6 Aug 2018 11:05:23 +0000 (13:05 +0200)]
render_bytes: check format, untaint before calling sprintf

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
15 months agoprint_usage_short: do not group subcommands
Dietmar Maurer [Tue, 31 Jul 2018 09:55:42 +0000 (11:55 +0200)]
print_usage_short: do not group subcommands

For examply, do not group 'qm guest' usage.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>