Commit Graph

1545 Commits

Author SHA1 Message Date
Thomas Lamprecht
b863860407 network: avoid module on imported run_command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-03-16 17:30:36 +01:00
Thomas Lamprecht
93cc2aa9b2 network: tap plug: switch to opts hash to avoid expanding long params
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-03-16 17:30:16 +01:00
Alexandre Derumier
25558f136b 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>
2022-03-16 17:20:12 +01:00
Alexandre Derumier
354ec8dee3 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>
2022-03-16 17:20:12 +01:00
Oguz Bektas
f44838ff41 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>
2022-03-16 07:58:35 +01:00
Fabian Ebner
06885ac8bb 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>
2022-03-04 11:39:07 +01:00
Fabian Ebner
cc78c1eba2 REST environment: allow export of log_warn
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-03-04 11:21:17 +01:00
Thomas Lamprecht
b096f49c1a readme: update instructions for bullseye
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-02-17 11:43:41 +01:00
Thomas Lamprecht
4e70970c89 bump version to 7.1-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-02-09 18:36:49 +01:00
Fabian Grünbichler
f627fab7dc 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>
2022-02-09 18:31:27 +01:00
Thomas Lamprecht
ac47f1e617 bump version to 7.1-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-01-13 17:13:41 +01:00
Thomas Lamprecht
10b92f6d5c 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>
2022-01-13 17:07:40 +01:00
Thomas Lamprecht
a00ce8efc3 bump version to 7.1-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-01-13 16:31:31 +01:00
Alexandre Derumier
faa1b46f08 read_proc_stat: use total of fields to compute percentage 2022-01-13 16:11:01 +01:00
Alexandre Derumier
24f19ef7a1 read_proc_stat: add irq/softirq/steal to total used cpu 2022-01-13 16:05:26 +01:00
Alexandre Derumier
c140206bf8 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
c66ccee46f/plugins/inputs/cpu/cpu.go
2022-01-13 16:03:49 +01:00
Alexandre Derumier
5224b31bbd 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
2022-01-13 16:03:15 +01:00
Thomas Lamprecht
964684b5e2 d/control: depend on libpve-rs-perl (>= 0.5.0) for calendar event perlmod
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-01-13 14:53:12 +01:00
Dominik Csapak
9572e1046b 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>
2022-01-13 14:50:47 +01:00
Thomas Lamprecht
a45a1df1ed small code/comment cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-01-13 14:50:14 +01:00
Thomas Lamprecht
3efa9ecd60 bump version to 7.0-14
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-11 12:33:52 +01:00
Thomas Lamprecht
0d30351227 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>
2021-11-11 11:29:25 +01:00
Fabian Grünbichler
b75893ddf4 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>
2021-11-11 10:39:58 +01:00
Fabian Grünbichler
6e55ce7d0f 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>
2021-11-11 10:39:58 +01:00
Fabian Grünbichler
da9f41f5ce 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>
2021-11-11 10:39:58 +01:00
Thomas Lamprecht
fa83d271df bump version to 7.0-13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-10 11:51:11 +01:00
Wolfgang Bumiller
c4c8a33d67 Ticket: uri-escape colons
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-09 13:13:46 +01:00
Thomas Lamprecht
d9339d016a getxattr: trim the returned buffer to the correct size
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-08 16:19:54 +01:00
Thomas Lamprecht
7b6b494fff bump version to 7.0-12
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-07 21:36:12 +01:00
Dominik Csapak
194f706b5d 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>
2021-10-27 12:03:03 +02:00
Thomas Lamprecht
507310df34 cli format: refactoring and code bloat reduction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-22 17:48:02 +02:00
Oguz Bektas
d37a718672 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>
2021-10-22 11:38:08 +02:00
Thomas Lamprecht
d94f7005ce safe_read_from: bump default size limit to 1 MiB to match pmxcfs
Done in a similar spirit as commit 8fb28ab914

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-21 11:40:27 +02:00
Thomas Lamprecht
8145f9affd bump version to 7.0-11
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-19 09:35:45 +02:00
Thomas Lamprecht
c1e4c83ceb tools: getxattr: document how to get actual argument size
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-19 09:33:37 +02:00
Thomas Lamprecht
2e14735a84 tools: getxattr: drop debug statement
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-19 09:24:53 +02:00
Thomas Lamprecht
4c0c5c905d tools: add set/get xattr methods
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-19 08:18:00 +02:00
Thomas Lamprecht
bfa10639d9 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>
2021-10-18 10:24:18 +02:00
Thomas Lamprecht
57426c93c9 sysfs tools: indentation + text-width fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-18 10:08:42 +02:00
Thomas Lamprecht
85237c0b68 tempfile: add some comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 11:25:09 +02:00
Thomas Lamprecht
9cccad5e3e 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>
2021-10-15 11:23:24 +02:00
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