]> git.proxmox.com Git - pve-common.git/log
pve-common.git
23 months agobump version to 7.2-1
Thomas Lamprecht [Thu, 12 May 2022 12:43:11 +0000 (14:43 +0200)]
bump version to 7.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agopbs-client: namespace support
Wolfgang Bumiller [Thu, 12 May 2022 09:54:20 +0000 (11:54 +0200)]
pbs-client: namespace support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
23 months agobump version to 7.1-6
Thomas Lamprecht [Thu, 28 Apr 2022 14:40:49 +0000 (16:40 +0200)]
bump version to 7.1-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agoREST handler: get property description: escape curly braces for asciidoc
Fabian Ebner [Thu, 7 Apr 2022 10:05:38 +0000 (12:05 +0200)]
REST handler: get property description: escape curly braces for asciidoc

Text enclosed in unescaped curly braces will be interpreted as an
attribute reference breaking and e.g. lead to the description not
showing up at all a generated man page further down the line.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agosysfs: rename fixup_missing_domain to normalize_pci_id and make normal sub
Thomas Lamprecht [Mon, 25 Apr 2022 16:15:09 +0000 (18:15 +0200)]
sysfs: rename fixup_missing_domain to normalize_pci_id and make normal sub

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoSysFSTools: factor out the domain fixup and domain regex
Dominik Csapak [Thu, 17 Mar 2022 08:12:26 +0000 (09:12 +0100)]
SysFSTools: factor out the domain fixup and domain regex

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoformatter: render duration: support autolimiting accurarcy
Thomas Lamprecht [Fri, 1 Apr 2022 14:07:17 +0000 (16:07 +0200)]
formatter: render duration: support autolimiting accurarcy

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agojson schema: allow to export print_property_string
Thomas Lamprecht [Thu, 24 Mar 2022 11:56:39 +0000 (12:56 +0100)]
json schema: allow to export print_property_string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-5
Thomas Lamprecht [Fri, 18 Mar 2022 09:13:52 +0000 (10:13 +0100)]
bump version to 7.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonetwork: fix default of new bridge learning flag
Thomas Lamprecht [Fri, 18 Mar 2022 09:13:16 +0000 (10:13 +0100)]
network: fix default of new bridge learning flag

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-4
Thomas Lamprecht [Thu, 17 Mar 2022 13:11:11 +0000 (14:11 +0100)]
bump version to 7.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoswitch to using Proxmox::RS::CalendarEvent
Wolfgang Bumiller [Tue, 1 Mar 2022 14:55:49 +0000 (15:55 +0100)]
switch to using Proxmox::RS::CalendarEvent

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoschema: parse_config: optionally collect comments
Wolfgang Bumiller [Thu, 17 Mar 2022 10:26:03 +0000 (11:26 +0100)]
schema: parse_config: optionally collect comments

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoSysFSTools: allow longer pci domains
Dominik Csapak [Mon, 28 Feb 2022 13:48:19 +0000 (14:48 +0100)]
SysFSTools: allow longer pci domains

by default, there is only one pci domain ('0000'), but there are systems
where there are more, and they don't need to be exactly 4 characters
long (see [0]), so extend that regex to allow domains 4 characters or
longer

0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agonetwork: avoid module on imported run_command
Thomas Lamprecht [Wed, 16 Mar 2022 16:30:36 +0000 (17:30 +0100)]
network: avoid module on imported run_command

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonetwork: tap plug: switch to opts hash to avoid expanding long params
Thomas Lamprecht [Wed, 16 Mar 2022 16:30:16 +0000 (17:30 +0100)]
network: tap plug: switch to opts hash to avoid expanding long params

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoInotify: add bridge-disable-mac-learning option to bridges.
Alexandre Derumier [Fri, 24 Sep 2021 08:48:55 +0000 (10:48 +0200)]
Inotify: add bridge-disable-mac-learning option to bridges.

This is an internal option, only used by proxmox, and not ifupdown1/2

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agonetwork: add support for disabling bridge learning on tap|veth|fwln ports
Alexandre Derumier [Fri, 24 Sep 2021 08:48:54 +0000 (10:48 +0200)]
network: add support for disabling bridge learning on tap|veth|fwln ports

Currently, if bridge receive an unknown dest mac (network bug/attack/..),
we are flooding packets to all bridge ports.

This can waste cpu time, even more with firewall enabled.
Also, if firewall is used with reject action, the src mac of RST
packet is the original unknown dest mac.
(This can block the server at Hetzner for example)

So, we can disable learning && unicast_flood on tap|veth|fwln port interface.
Then mac address need to be add statically in bridge fdb.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agoRESTenv: fork worker: fallback to 'root@pam' for task log user-id
Oguz Bektas [Tue, 15 Mar 2022 11:52:39 +0000 (12:52 +0100)]
RESTenv: fork worker: fallback to 'root@pam' for task log user-id

The fallback had a "typo" in the realm and used 'root@pve' (pve vs.
pam) since initial import from SVN, but off-list talks with Dietmar
suggest that 'root@pam' was always the intended fallback value.

Call sites without a defined user parameter (found only push_file and
pull_file from pve-container) were logging the task-owner user as
'root@pve' which isn't a default one, so it wouldn't exist in most
setups.

For clarity, add a comment that this is only used for the task logs.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
[ T: Reword/add to commit message slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoREST environment: add static log_warn function
Fabian Ebner [Fri, 29 Oct 2021 11:16:22 +0000 (13:16 +0200)]
REST environment: add static log_warn function

which avoids the need for the caller to check whether the environment
was initialized or not.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoREST environment: allow export of log_warn
Fabian Ebner [Fri, 29 Oct 2021 11:16:23 +0000 (13:16 +0200)]
REST environment: allow export of log_warn

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreadme: update instructions for bullseye
Thomas Lamprecht [Thu, 17 Feb 2022 10:43:41 +0000 (11:43 +0100)]
readme: update instructions for bullseye

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-3
Thomas Lamprecht [Wed, 9 Feb 2022 17:36:49 +0000 (18:36 +0100)]
bump version to 7.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd 'map_id' helper for ID maps
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:30 +0000 (14:07 +0100)]
add 'map_id' helper for ID maps

currently these are used by qemu-server for mapping source and target
storages, but this mechanism will be extended to network bridge maps and
re-used in pve-container as well, so let's put it next to the schema
definitions/helpers.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.1-2
Thomas Lamprecht [Thu, 13 Jan 2022 16:13:15 +0000 (17:13 +0100)]
bump version to 7.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: hack: drop libpve-rs-perl dependency for now
Thomas Lamprecht [Thu, 13 Jan 2022 16:07:38 +0000 (17:07 +0100)]
d/control: hack: drop libpve-rs-perl dependency for now

not available on PMG and other places we use this lib (infra stuff)..

the perlmod stuff needs to be either more conditionally included, the
perlmod move to a more generic library (proxmox-rs?) or duplicated to
at least pmg-rs (albeit that wouldn't solve the infra pain points)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-1
Thomas Lamprecht [Thu, 13 Jan 2022 15:31:31 +0000 (16:31 +0100)]
bump version to 7.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoread_proc_stat: use total of fields to compute percentage
Alexandre Derumier [Mon, 10 Jan 2022 04:53:00 +0000 (05:53 +0100)]
read_proc_stat: use total of fields to compute percentage

2 years agoread_proc_stat: add irq/softirq/steal to total used cpu
Alexandre Derumier [Mon, 10 Jan 2022 04:52:59 +0000 (05:52 +0100)]
read_proc_stat: add irq/softirq/steal to total used cpu

2 years agoread_proc_stat: substract guest && guest_nice from user && nice time
Alexandre Derumier [Mon, 10 Jan 2022 04:52:58 +0000 (05:52 +0100)]
read_proc_stat: substract guest && guest_nice from user && nice time

user && nice time already include guest value
https://github.com/torvalds/linux/blob/4ec9f7a18/kernel/sched/cputime.c#L151-L158

Other monitoring tools are already substracting theses guest values

https://github.com/htop-dev/htop/blob/main/linux/LinuxProcessList.c
https://github.com/influxdata/telegraf/blob/c66ccee46f47717c399ccc0348d17c95d11f477d/plugins/inputs/cpu/cpu.go

2 years agoread_proc_stat : initialize newer fields to 0
Alexandre Derumier [Mon, 10 Jan 2022 04:52:57 +0000 (05:52 +0100)]
read_proc_stat : initialize newer fields to 0

new fields has been added recently, but values are not initialized
https://git.proxmox.com/?p=pve-common.git;a=commit;h=5a82eb712e4c879a271686f07c589fadc0b09185

as total of all fields is compute later, this can give undef values

2 years agod/control: depend on libpve-rs-perl (>= 0.5.0) for calendar event perlmod
Thomas Lamprecht [Thu, 13 Jan 2022 13:53:12 +0000 (14:53 +0100)]
d/control: depend on libpve-rs-perl (>= 0.5.0) for calendar event perlmod

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoCalendarEvent: use rust implementation
Dominik Csapak [Wed, 1 Dec 2021 08:55:14 +0000 (09:55 +0100)]
CalendarEvent: use rust implementation

by replacing the parsing code and 'compute_next_event' by their
PVE::RS::CalendarEvent equivalent

adapt the tests, since we do not have access to the internal structure
(and even if we had, it would be different) and the error messages
are different

the 'compute_next_event' and parsing tests still pass though

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agosmall code/comment cleanups
Thomas Lamprecht [Thu, 13 Jan 2022 13:50:14 +0000 (14:50 +0100)]
small code/comment cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-14
Thomas Lamprecht [Thu, 11 Nov 2021 11:33:52 +0000 (12:33 +0100)]
bump version to 7.0-14

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: record breaks for qemu-server << 7.0-19
Thomas Lamprecht [Thu, 11 Nov 2021 10:29:23 +0000 (11:29 +0100)]
d/control: record breaks for qemu-server << 7.0-19

due to the 'storagepair' -> 'storage-pair' format rename

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoschema: add proxmox-remote format/option
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:47 +0000 (14:03 +0100)]
schema: add proxmox-remote format/option

for usage in remote migration/replication.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoschema: add pve-bridge-id option/format/pair
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:46 +0000 (14:03 +0100)]
schema: add pve-bridge-id option/format/pair

for re-use in qemu-server/pve-container, which already have this option
duplicated. the '-pair' is needed for remote migration, but can also be
a nice addition to regular intra-cluster migration to lift the
restriction of having identically named bridges.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoschema: rename storagepair to storage-pair
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:45 +0000 (14:03 +0100)]
schema: rename storagepair to storage-pair

more consistent with the other options/formats like pve-storage-id

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.0-13
Thomas Lamprecht [Wed, 10 Nov 2021 10:51:11 +0000 (11:51 +0100)]
bump version to 7.0-13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoTicket: uri-escape colons
Wolfgang Bumiller [Tue, 9 Nov 2021 11:27:07 +0000 (12:27 +0100)]
Ticket: uri-escape colons

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agogetxattr: trim the returned buffer to the correct size
Thomas Lamprecht [Mon, 8 Nov 2021 15:19:54 +0000 (16:19 +0100)]
getxattr: trim the returned buffer to the correct size

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-12
Thomas Lamprecht [Sun, 7 Nov 2021 20:36:12 +0000 (21:36 +0100)]
bump version to 7.0-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocgroup v2: io stats: fix parsing disk writes
Dominik Csapak [Mon, 25 Oct 2021 14:24:25 +0000 (16:24 +0200)]
cgroup v2: io stats: fix parsing disk writes

'wbytes' is for writes, but we accidentally added the value to 'diskread'
which left 'diskwrite' statistics always zero

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocli format: refactoring and code bloat reduction
Thomas Lamprecht [Fri, 22 Oct 2021 15:48:02 +0000 (17:48 +0200)]
cli format: refactoring and code bloat reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocgroup: cpu quota: fix resetting period length for v1
Oguz Bektas [Thu, 21 Oct 2021 14:36:19 +0000 (16:36 +0200)]
cgroup: cpu quota: fix resetting period length for v1

The CFS period µs value for cgroup v1 needs to be >= 1 µs and <= 1 s,
so resetting it to -1 (like we cab do for the quota) cannot work.

So, when the period is passed as undefined it should be set to 100ms,
i.e., the actual default value:

>  - cpu.cfs_quota_us: the total available run-time within a period (in microseconds)
>  - cpu.cfs_period_us: the length of a period (in microseconds)
>  - cpu.stat: exports throttling statistics [explained further below]
>
> The default values are:
>     cpu.cfs_period_us=100ms
>     cpu.cfs_quota=-1
-- https://www.kernel.org/doc/html/v5.14/scheduler/sched-bwc.html

This issue was there since initial addition in its original repo,
pve-container commit 26b645e2.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
 [ Thomas: add more information, adapt commit subject to reduce
   redundancy, link to new RsT based doc page with a fixed version ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosafe_read_from: bump default size limit to 1 MiB to match pmxcfs
Thomas Lamprecht [Thu, 21 Oct 2021 09:40:23 +0000 (11:40 +0200)]
safe_read_from: bump default size limit to 1 MiB to match pmxcfs

Done in a similar spirit as commit 8fb28ab914a9a9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-11
Thomas Lamprecht [Tue, 19 Oct 2021 07:35:45 +0000 (09:35 +0200)]
bump version to 7.0-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: getxattr: document how to get actual argument size
Thomas Lamprecht [Tue, 19 Oct 2021 07:33:37 +0000 (09:33 +0200)]
tools: getxattr: document how to get actual argument size

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: getxattr: drop debug statement
Thomas Lamprecht [Tue, 19 Oct 2021 07:24:53 +0000 (09:24 +0200)]
tools: getxattr: drop debug statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: add set/get xattr methods
Thomas Lamprecht [Tue, 19 Oct 2021 06:18:00 +0000 (08:18 +0200)]
tools: add set/get xattr methods

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosyscalls: use new constants available in bullseyes perl
Thomas Lamprecht [Mon, 18 Oct 2021 08:24:14 +0000 (10:24 +0200)]
syscalls: use new constants available in bullseyes perl

All previously unkown are now defined, so drop the literal numbers

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosysfs tools: indentation + text-width fixes
Thomas Lamprecht [Mon, 18 Oct 2021 08:08:42 +0000 (10:08 +0200)]
sysfs tools: indentation + text-width fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotempfile: add some comment
Thomas Lamprecht [Fri, 15 Oct 2021 09:25:09 +0000 (11:25 +0200)]
tempfile: add some comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotempfile: improve base path selection
Thomas Lamprecht [Fri, 15 Oct 2021 09:23:22 +0000 (11:23 +0200)]
tempfile: improve base path selection

The path is not /that/ relevant privacy wise as we try to use
`O_TMPFILE` anyway and defaulting to /run generates trouble for calls
from non-root processes.

Try the user session run dir first, then /run if root or /tmp else.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: sendmail: code cleanup, factor out some noise
Thomas Lamprecht [Fri, 15 Oct 2021 09:21:17 +0000 (11:21 +0200)]
tools: sendmail: code cleanup, factor out some noise

Reduce by a few lines in general and move out checking the address to
avoid to much (repeated) inline noise..

no semantic change intended.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: fix some perlcritic lints
Thomas Lamprecht [Fri, 15 Oct 2021 08:36:09 +0000 (10:36 +0200)]
tools: fix some perlcritic lints

- Two-argument "open" used at line 462, column 3.  See page 207 of
  PBP. (Severity: 5)
- Subroutine "new" called using indirect syntax at line 487, column
  15. See page 349 of PBP.  (Severity: 5)
- Bareword file handle opened at line 1533, column 5. See pages 202,
  204 of PBP.  (Severity: 5)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-10
Thomas Lamprecht [Wed, 29 Sep 2021 08:01:11 +0000 (10:01 +0200)]
bump version to 7.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoinotify: network: improve "allow-hotplug" & "auto" interaction
Thomas Lamprecht [Fri, 24 Sep 2021 10:29:46 +0000 (12:29 +0200)]
inotify: network: improve "allow-hotplug" & "auto" interaction

commit c86cfb8bbd9b505d06b580582297fa670561437b dropped allow-hotplug
from the primary interfaces file completely on write, but that breaks
setups that come from plain Debian.

Instead, as stop-gap measurement, transform "allow-hotplug" to auto
in the PVE controlled config.

That avoids conflict and improves installing PVE on top of plain
Debian, as the interface still comes up after the first reboot.

But it is not ideal auto is not the same as hotplug, so we need to
also track that difference in the future, but that needs some
adaptions in the API too (change autostart from boolean to
string+enum or so=

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosubscription: switch verification domain over to shop.proxmox.com
Thomas Lamprecht [Mon, 27 Sep 2021 06:57:10 +0000 (08:57 +0200)]
subscription: switch verification domain over to shop.proxmox.com

With the merger the shop got moved from shop.maurer-it to
shop.proxmox.com, while we transparently redirect we also want to
stop doing that in a few years, so use new domain.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoinotify: network: detect "allow-auto" as "auto" synonym
Thomas Lamprecht [Fri, 24 Sep 2021 09:52:54 +0000 (11:52 +0200)]
inotify: network: detect "allow-auto" as "auto" synonym

> Note that "allow-auto" and "auto" are synonyms.
-- man 5 interfaces

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoinotify: network: code+whitespace+indentation cleanup
Thomas Lamprecht [Fri, 24 Sep 2021 09:51:52 +0000 (11:51 +0200)]
inotify: network: code+whitespace+indentation cleanup

no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotest: import JSON for quicker debugging
Thomas Lamprecht [Fri, 24 Sep 2021 10:36:53 +0000 (12:36 +0200)]
test: import JSON for quicker debugging

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: get local ip: catch any error from get_reachable_networks
Thomas Lamprecht [Mon, 20 Sep 2021 14:52:35 +0000 (16:52 +0200)]
net: get local ip: catch any error from get_reachable_networks

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: fix typo in comment
Thomas Lamprecht [Mon, 20 Sep 2021 14:52:03 +0000 (16:52 +0200)]
tools: fix typo in comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-9
Thomas Lamprecht [Sat, 18 Sep 2021 12:51:51 +0000 (14:51 +0200)]
bump version to 7.0-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: add get_local_ip helper
Thomas Lamprecht [Sat, 18 Sep 2021 12:38:59 +0000 (14:38 +0200)]
net: add get_local_ip helper

Sometimes we need to have a fallback for gai (get_ip_from_hostname)
but cannot yet rely on configured networks (get_reachable_networks)
from kernel POV (those may not have been configured yet, e.g., on
boot), so the ones configured in /etc/network/interfaces would be
nice too then, as they're the ones that will get configured soon
anyway on boot.

Add a new helper that takes in all those sources and allows to return
a single (first found) or all of those addresses.

Still prioritize the address we get from getaddrinfo, as there the
admin has control through /etc/hosts, DNS and gai.conf and treat the
remaining ones as fallback.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-8
Thomas Lamprecht [Fri, 17 Sep 2021 14:59:22 +0000 (16:59 +0200)]
bump version to 7.0-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: add get reachable networks: fix sorter closure
Thomas Lamprecht [Fri, 17 Sep 2021 15:47:14 +0000 (17:47 +0200)]
net: add get reachable networks: fix sorter closure

argh, perl sorters and nested greps are weird!

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: add get_reachable_networks
Thomas Lamprecht [Fri, 17 Sep 2021 14:25:51 +0000 (16:25 +0200)]
net: add get_reachable_networks

will be used for the issue banner generators and for some "get
nodeip" calls as fallback for get_ip_from_hostname, which tends to
fail in our CT envs (e.g., PMG)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: ip from host: code shrink
Thomas Lamprecht [Fri, 17 Sep 2021 09:35:06 +0000 (11:35 +0200)]
net: ip from host: code shrink

Return a suitable address directly instead of breaking out of the
loop to do that.

no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonet: ip from host: avoid using an undefined variable in die
Thomas Lamprecht [Fri, 17 Sep 2021 08:58:08 +0000 (10:58 +0200)]
net: ip from host: avoid using an undefined variable in die

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #2368: network: extend infiniband recognition in regex
Lorenz Stechauner [Fri, 6 Aug 2021 11:07:11 +0000 (13:07 +0200)]
fix #2368: network: extend infiniband recognition in regex

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
fixed RE

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.0-6
Fabian Grünbichler [Fri, 6 Aug 2021 11:53:03 +0000 (13:53 +0200)]
bump version to 7.0-6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoProcFSTools: read_proc_stat: add more cpu stats from /proc/stat
Dominik Csapak [Wed, 28 Jul 2021 12:12:43 +0000 (14:12 +0200)]
ProcFSTools: read_proc_stat: add more cpu stats from /proc/stat

those fields might be interesting to users. At the moment, this is
only used in the external metrics export.

These fields exist in the kernel since:
* irq - 2.6.0
* softirq - 2.6.0
* steal - 2.6.11
* guest - 2.6.24
* guest_nice - 2.6.33

so they must all exist

also add a 'total' field which simply sums up the (non-guest) fields

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agointerfaces: do not warn about FD if it was not set explicitly
Thomas Lamprecht [Fri, 16 Jul 2021 10:54:14 +0000 (12:54 +0200)]
interfaces: do not warn about FD if it was not set explicitly

As that would be weird, the use explicitly did not configure it,
which is OK, and we'd then warn due to *our* fallback to `0`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agointerfaces: code cleanup and use some more actual telling variable names
Thomas Lamprecht [Fri, 16 Jul 2021 10:52:29 +0000 (12:52 +0200)]
interfaces: code cleanup and use some more actual telling variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agointerfaces: improve bridge_fd handling
Fabian Grünbichler [Fri, 16 Jul 2021 07:40:50 +0000 (09:40 +0200)]
interfaces: improve bridge_fd handling

and ignore values with a warning that are outside of the kernels
expected range.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #2831: never set bridge_fd to 0 with STP on
Fabian Grünbichler [Fri, 16 Jul 2021 07:40:49 +0000 (09:40 +0200)]
fix #2831: never set bridge_fd to 0 with STP on

it's an invalid combination that causes the network reload/setup to
fail. unfortunately, this is not caught by ifupdown2 itself, but only
rejected by the kernel with ERANGE over netlink.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.0-5
Thomas Lamprecht [Wed, 14 Jul 2021 09:50:51 +0000 (11:50 +0200)]
bump version to 7.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3527: cgroup: drop file buffers from memory usage
Wolfgang Bumiller [Wed, 14 Jul 2021 07:42:15 +0000 (09:42 +0200)]
fix #3527: cgroup: drop file buffers from memory usage

matches the behavior of lxcfs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump version to 7.0-4
Thomas Lamprecht [Mon, 28 Jun 2021 12:57:24 +0000 (14:57 +0200)]
bump version to 7.0-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3153: INotify: adding comment of interface to inet6 section when this is the...
Lorenz Stechauner [Fri, 25 Jun 2021 12:29:37 +0000 (14:29 +0200)]
fix #3153: INotify: adding comment of interface to inet6 section when this is the only section

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2 years agotools: followup: fix comment length and rename to upid_normalize_status_type
Thomas Lamprecht [Mon, 28 Jun 2021 12:51:54 +0000 (14:51 +0200)]
tools: followup: fix comment length and rename to upid_normalize_status_type

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoPVE/Tools: add 'upid_get_status_type'
Dominik Csapak [Thu, 24 Jun 2021 07:10:11 +0000 (09:10 +0200)]
PVE/Tools: add 'upid_get_status_type'

as a single point where we get the type of upid status

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoPVE/JSONSchema: add pve-task-status-type
Dominik Csapak [Thu, 24 Jun 2021 07:10:10 +0000 (09:10 +0200)]
PVE/JSONSchema: add pve-task-status-type

to have a format that contains the possible worker task states

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoinotify/network: indentation fix
Thomas Lamprecht [Thu, 24 Jun 2021 13:36:04 +0000 (15:36 +0200)]
inotify/network: indentation fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-3
Thomas Lamprecht [Wed, 23 Jun 2021 10:08:00 +0000 (12:08 +0200)]
bump version to 7.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosystemd: allow SendSIGKILL and TimeoutStopUSec dbus properties
Stefan Reiter [Mon, 21 Jun 2021 16:35:42 +0000 (18:35 +0200)]
systemd: allow SendSIGKILL and TimeoutStopUSec dbus properties

Used in qemu-server for avoiding KillMode 'none'. SendSIGKILL is a
boolean, so we need to use dbus_boolean to serialize it.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoSysFSTools: change 'product' to 'device'
Dominik Csapak [Mon, 21 Jun 2021 13:55:16 +0000 (15:55 +0200)]
SysFSTools: change 'product' to 'device'

so it is more consistend with the source (it comes from the file
'device') as well as the subsytem_device field

the only place we use that field is in the same file in pci_dev_bind_to_vfio,
which we also change here, so that should not be a breaking change
(in qemu-server we only really use the existance and the has_fl_reset
flag)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoSysFSTools: add verbose flag to pci_device_info
Dominik Csapak [Mon, 21 Jun 2021 13:55:15 +0000 (15:55 +0200)]
SysFSTools: add verbose flag to pci_device_info

to also get the subsystem_vendor and device, as well as the
iommu group and mediated device support

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.0-2
Thomas Lamprecht [Thu, 17 Jun 2021 14:41:57 +0000 (16:41 +0200)]
bump version to 7.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: add upid_status_is_error function
Fabian Ebner [Wed, 12 May 2021 12:32:50 +0000 (14:32 +0200)]
tools: add upid_status_is_error function

There's also support for ending a task with warnings now, so the logic "status
not 'OK' means error" does not work anymore.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agod/control: record new dependency for libnetaddr-ip-perl
Thomas Lamprecht [Thu, 17 Jun 2021 13:20:14 +0000 (15:20 +0200)]
d/control: record new dependency for libnetaddr-ip-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonetwork: add unique_ips function
Fabian Ebner [Mon, 10 May 2021 12:18:16 +0000 (14:18 +0200)]
network: add unique_ips function

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agonetwork: add canonical_ip function
Fabian Ebner [Mon, 10 May 2021 12:18:15 +0000 (14:18 +0200)]
network: add canonical_ip function

Net::IP doesn't seem to have a function for it and normalizing to the full
quad-form is less then ideal if we inted to output IPv6 addresses returned by
that function at some point.

Instead, use NetAddr::IP, which is already used in pve-network.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agonetwork: is_ip_in_cidr: avoid warning when versions don't match
Fabian Ebner [Mon, 10 May 2021 12:18:14 +0000 (14:18 +0200)]
network: is_ip_in_cidr: avoid warning when versions don't match

is_ip_in_cidr('fd80:1::10', '127.0.0.1/24') would result in
    Use of uninitialized value in numeric eq (==)
as overlaps() returns undef in such a case.

Note that there are (albeit few) existing callers that don't specify $version.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agonetwork: is_ip_in_cidr: correctly handle the CIDR being a singleton range
Fabian Ebner [Mon, 10 May 2021 12:18:13 +0000 (14:18 +0200)]
network: is_ip_in_cidr: correctly handle the CIDR being a singleton range

i.e.  is_ip_in_cidr('127.0.0.1', '127.0.0.1/32', 4) should return 1;

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agotools: download from url: add option to allow overriding existing files
Thomas Lamprecht [Wed, 16 Jun 2021 10:41:33 +0000 (12:41 +0200)]
tools: download from url: add option to allow overriding existing files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotools: download_file_from_url: move check for existing file outside eval
Lorenz Stechauner [Wed, 16 Jun 2021 09:35:58 +0000 (11:35 +0200)]
tools: download_file_from_url: move check for existing file outside eval

it is not necessary to include this block in the eval which when it
fails tries to unlink $tmpdest, because in the check for the existing
file $tmpdest is not used.