to call out/err/logfunc with each line, we search for a newline and call
outfunc/logfunc with everything before that
since we do a select/read (with 4096 size) in a loop, this means
that if we have very long lines, we search for a newline in an
ever growing buffer (for which we know does not contain a newline)
so instead, only search the new data for newlines
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
this is (via file_get_contents and file_copy) used for reading from
pmxcfs, which has a file size limit of 512k. since quite a number of
call sites would need to explicitly override this (and then get updated
if we bump the limit on the pmxcfs side again in the future), making our
default file reader compatible by default seems the better solution.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Adds a third, optional parameter to register_format that allows specifying
a function that will be called after parsing and can validate the parsed
data. A validator should die on failed validation, and can also change the
parsed object by returning a modified version of it.
This is useful so one can register a format with its hash, thus allowing
documentation to be generated automatically, while still enforcing certain
validation rules.
The validator only needs to be called in parse_property_string, since
check_format always calls parse_property_string if there is a
possibility of a validator existing at all. parse_property_string should
then be called with named formats for best effect, as only then can
validators be used.
Clean up 'check_format' as well (which pretty much amounts to a rewrite).
No existing functionality is intentionally changed.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
/usr/share/zoneinfo/zone.tab has the valid list of time zones.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
bridge-ports is an optional parameter but was assumed to be defined in
the code. This resulted in 'use of uninitialized value' warnings.
By reordering of the $ports definition before the replace, we get rid of
the 'use of uninitialized value' when no bridge-port is specified.
In the second case we set it to an empty string when it is undefined.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Currently, bond slaves are mostly working without autostart,
because bond slaves scripts from ifupdown1 && also ifupdown2
have some kind of hacks to start the slaves.
But if users want to do some tuning on the ifaces, they are not applied.
Also, with ifupdown2 + ovs, this kind of hack is not implemented (yet), so the
slaves of the bond are still down.
Debian/Ubuntu official docs always set "auto ethX" for bond slaves,
it's really more clean like this.
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This is useful for when collecting data for Guest OS licensing (Microsoft)
where physical core count matters, not socket or thread count.
The "cpus" value counts threads when Hyperthreading is enabled.
Signed-off-by: Mike Beattie <mike@ethernal.org>
Currently, when a trunks is defined, the vlan tag is not used
for pvid with vlan-aware bridge. (It's ok with ovs switch)
example:
net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,tag=2,trunks=2-11
before
------
tap100i0 2-11
after
-----
tap100i0 2 PVID Egress Untagged
3-11
No regression for other configurations:
net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1
before
------
tap100i0 1 PVID Egress Untagged
2-4094
after
-----
tap100i0 1 PVID Egress Untagged
2-4094
net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,tag=2
before
------
tap100i0 2 PVID Egress Untagged
after
-----
tap100i0 2 PVID Egress Untagged
net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,trunks=2-11
before
------
tap100i0 1 PVID Egress Untagged
2-11
after
-----
tap100i0 1 PVID Egress Untagged
2-11
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
fixes commit 89ea13ef6b and
restores old behavior, the "if !$trunks" post-if was a bit suble, it
did not guard the die, but the system command previously - the die
was || (ORd) to the command, bad code style to begin with..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
on kernel configs where KSM is not enabled (e.g. an openstack instance at
OVH) the file /sys/kernel/mm/ksm/pages_sharing does not exist.
In that case there is no memory shared so assuming 0 is reasonable.
While this is not the case with our shipped kernel, and thus will probably
not happen on a PVE installation, PMG can run quite happily with a different
kernel (the reporter had this on an openstack instance at OVH).
a quick grep through our codebase showed only the API2::Nodes::Nodeinfo::status
call as user of the memshared property.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
by introducing a safe_compare helper. Fixes warnings, e.g.
pvesh get /nodes/<NODE>/network
would print "use of uninitialized"-warnings if there are inactive
network interfaces, because for those, 'active' is undef.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
we use this format for all 'delete' options but we have some options
that have a '-' in the name (e.g. 'sync-defaults-options') that cannot
be deleted if it is not included
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
By using "exists" when checking if a hash entry is set, else things
like "0" could get accepted by mistake.
Also cleanup the code a little, like dropping the "PVE::JSONSchema::"
prefix, this is now in that module after all.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
generalized from the start to support extension to bridges or other
entities as well.
this gets us incremental support for the CLI, e.g.:
--targetstorage foo:bar --targetstorage bar:baz --targetstorage foo
creates a mapping of
foo=>bar
bar=>baz
with a default of foo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This is explicitly allowed in the documentation and happens
easily with cgroupv2 as there it is used to inherit from the
closest ancestor.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
All of our users of this function currently either pass
'effective_cpus' or nothing (undef), and in cgroupv2 the
effective-cpuset file uses a different naming scheme.
Since this is only a distinction between "intended" and
"effective", use this as a boolean instead, for easier
future cgroupv2 support.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>