5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-01-06 21:17:37 +03:00
Commit Graph

1454 Commits

Author SHA1 Message Date
Thomas Lamprecht
9915a41bb6 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>
2021-10-15 11:22:41 +02:00
Thomas Lamprecht
7ac222d137 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>
2021-10-15 10:46:06 +02:00
Thomas Lamprecht
7d91b7b83e bump version to 7.0-10
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-29 10:01:11 +02:00
Thomas Lamprecht
0dc7fd7b50 inotify: network: improve "allow-hotplug" & "auto" interaction
commit c86cfb8bbd 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>
2021-09-29 09:57:59 +02:00
Thomas Lamprecht
ed94660616 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>
2021-09-27 08:58:23 +02:00
Thomas Lamprecht
0dcace5a6e 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>
2021-09-24 12:56:09 +02:00
Thomas Lamprecht
75a2a1c658 inotify: network: code+whitespace+indentation cleanup
no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-24 12:56:09 +02:00
Thomas Lamprecht
89075c3505 test: import JSON for quicker debugging
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-24 12:56:09 +02:00
Thomas Lamprecht
97809c6906 net: get local ip: catch any error from get_reachable_networks
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-20 16:52:35 +02:00
Thomas Lamprecht
b296c4dd81 tools: fix typo in comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-20 16:52:03 +02:00
Thomas Lamprecht
236e86cac5 bump version to 7.0-9
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-18 14:51:51 +02:00
Thomas Lamprecht
ac487a888b 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>
2021-09-18 14:51:01 +02:00
Thomas Lamprecht
ebbbb05e00 bump version to 7.0-8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-17 18:38:47 +02:00
Thomas Lamprecht
4e4059580a 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>
2021-09-17 18:38:47 +02:00
Thomas Lamprecht
d7cafe5124 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>
2021-09-17 16:25:52 +02:00
Thomas Lamprecht
29dde5f46b 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>
2021-09-17 11:37:00 +02:00
Thomas Lamprecht
c45692e04a net: ip from host: avoid using an undefined variable in die
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-17 11:14:02 +02:00
Lorenz Stechauner
1981940474 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>
2021-08-12 11:51:09 +02:00
Fabian Grünbichler
22529da434 bump version to 7.0-6
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-08-06 13:53:03 +02:00
Dominik Csapak
5a82eb712e 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>
2021-07-29 10:29:05 +02:00
Thomas Lamprecht
576dadb137 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>
2021-07-16 12:54:17 +02:00
Thomas Lamprecht
43997e844e interfaces: code cleanup and use some more actual telling variable names
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 12:52:29 +02:00
Fabian Grünbichler
abf1f9cf19 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>
2021-07-16 11:50:40 +02:00
Fabian Grünbichler
e960f7948f 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>
2021-07-16 11:50:40 +02:00
Thomas Lamprecht
0966f99ccc bump version to 7.0-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-14 11:50:51 +02:00
Wolfgang Bumiller
61f1cb1a92 fix #3527: cgroup: drop file buffers from memory usage
matches the behavior of lxcfs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-14 11:45:21 +02:00
Thomas Lamprecht
228ab4b408 bump version to 7.0-4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-28 14:57:24 +02:00
Lorenz Stechauner
f2ac9dd3b4 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>
2021-06-28 14:53:34 +02:00
Thomas Lamprecht
ae54eabff9 tools: followup: fix comment length and rename to upid_normalize_status_type
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-28 14:51:54 +02:00
Dominik Csapak
4e5360384c 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>
2021-06-28 14:47:53 +02:00
Dominik Csapak
f43ace29ca 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>
2021-06-28 14:47:53 +02:00
Thomas Lamprecht
13c771819a inotify/network: indentation fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-24 15:36:04 +02:00
Thomas Lamprecht
0438d431e4 bump version to 7.0-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-23 12:08:00 +02:00
Stefan Reiter
ffe48b8e8a 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>
2021-06-22 07:45:21 +02:00
Dominik Csapak
9d065c72fb 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>
2021-06-21 17:24:06 +02:00
Dominik Csapak
aa59b1121c 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>
2021-06-21 17:24:06 +02:00
Thomas Lamprecht
a03e5b39e1 bump version to 7.0-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-17 16:41:57 +02:00
Fabian Ebner
4cc5b13dfc 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>
2021-06-17 15:22:56 +02:00
Thomas Lamprecht
20000e9ff6 d/control: record new dependency for libnetaddr-ip-perl
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-17 15:20:14 +02:00
Fabian Ebner
8f75194cd8 network: add unique_ips function
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-17 15:17:37 +02:00
Fabian Ebner
8286ef53bb 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>
2021-06-17 15:17:37 +02:00
Fabian Ebner
b0e3bcc186 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>
2021-06-17 15:17:37 +02:00
Fabian Ebner
123c310474 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>
2021-06-17 15:17:37 +02:00
Thomas Lamprecht
06c1c13f1c tools: download from url: add option to allow overriding existing files
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-16 12:43:36 +02:00
Lorenz Stechauner
f52ecff957 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.
2021-06-16 12:14:52 +02:00
Lorenz Stechauner
43cb80c5f2 tools: download_file_from_url: adapt error messages to start at new line
the front end expects the error message to be the first part of the
last line. putting the new line at the beginning of the die message
does not work, either.

https://lists.proxmox.com/pipermail/pve-devel/2021-June/048676.html
2021-06-16 12:14:52 +02:00
Thomas Lamprecht
9fffe4bc89 inotify: also detect VLAN id from "vlan\d+" ifaces
We support also vlanX, with X being a integer for the VLAN id, as
valid vlan iface name, so support that too here.

and make the dev name check for definedness, even if "0" is currently
not really supported (officially) it is still a valid iface name for
the kernel (which takes any byte).

The VLAN id is in the range of [2, 4094] (inclusive) so defined check
is not required there.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-15 16:45:33 +02:00
Lorenz Stechauner
eca898c0c1 tools: download_file_from_url: fix typo 2021-06-15 16:24:16 +02:00
Aaron Lauterer
b818066a85 inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces
Setting the vlan-id and vlan-raw-device value for vlan devices that
follow the dot notaton (interface.vlan) aligns how dot notation vlan
devices and vlan devices that use the explicit vlan-id and
vlan-raw-device options, available with ifupdown2, are represented in
API return values.

Previously the type for both was 'vlan' but only the latter showed more
details.

Setting these values here should not have any influence on how the
interfaces file is being written as these two values are already
filtered in __write_etc_network_interfaces for dot notation devices.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2021-06-15 14:41:46 +02:00
Wolfgang Bumiller
bd9eb367a0 Syscalls/Tools: add renameat2
Mostly for the ability to atomically swap files.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-15 14:35:26 +02:00