]> git.proxmox.com Git - pve-common.git/log
pve-common.git
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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

5 years 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

5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years agonew helper get_host_arch
Dietmar Maurer [Thu, 20 Sep 2018 04:21:55 +0000 (06:21 +0200)]
new helper get_host_arch

5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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)

5 years 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>
5 years 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>
5 years agoRework of the installation documentation
Martin Beckert [Fri, 24 Aug 2018 10:26:45 +0000 (12:26 +0200)]
Rework of the installation documentation

5 years 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>
5 years 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>
5 years 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).

5 years 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>
5 years 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>
5 years agogenerate_usage_str: do not group sub-commands
Dietmar Maurer [Tue, 31 Jul 2018 08:38:46 +0000 (10:38 +0200)]
generate_usage_str: do not group sub-commands

Usually, sub commands already form a logical group, so further grouping
just adds confusion (see 'qm' as example)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoprint_api_result: fix test for undefined $result_schema
Dietmar Maurer [Tue, 31 Jul 2018 06:29:45 +0000 (08:29 +0200)]
print_api_result: fix test for undefined $result_schema

5 years agoprint_api_result: allow to pass undefined schema
Dietmar Maurer [Mon, 30 Jul 2018 13:09:33 +0000 (15:09 +0200)]
print_api_result: allow to pass undefined schema

This is useful if we do not have a fixed schema, for example to
print results from qemu agent commands.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoprint_api_result_plain: new helper
Dietmar Maurer [Fri, 27 Jul 2018 13:22:30 +0000 (15:22 +0200)]
print_api_result_plain: new helper

Usefull to print result without borders an headers.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoprint_text_table: align numbers to the right side
Dietmar Maurer [Fri, 27 Jul 2018 12:00:28 +0000 (14:00 +0200)]
print_text_table: align numbers to the right side

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoprint_text_table: untaint $width
Dietmar Maurer [Fri, 27 Jul 2018 12:55:17 +0000 (14:55 +0200)]
print_text_table: untaint $width

The value of $width depends on possible untainted $data (for example
task logs read from external files).

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agobump version to 5.0-38
Dietmar Maurer [Fri, 27 Jul 2018 08:56:13 +0000 (10:56 +0200)]
bump version to 5.0-38

5 years agogetopt_usage: always remove $standard_output_options
Dietmar Maurer [Fri, 27 Jul 2018 05:23:39 +0000 (07:23 +0200)]
getopt_usage: always remove $standard_output_options

Tools like pvesh and pveclient pass them as normal arguments. We use
a simply heuristic to test if there is an 'output_format' parameter.
If so, we remove all $standard_output_options and display [FORMAT_OPTIONS]
instead.

5 years agogetopt_usage: do not display $standard_output_options
Dietmar Maurer [Thu, 26 Jul 2018 11:58:50 +0000 (13:58 +0200)]
getopt_usage: do not display $standard_output_options

Instead, simply add [FORMAT_OPTIONS] to the usage string.

5 years agointrocude new output format 'yaml'
Dietmar Maurer [Thu, 26 Jul 2018 10:02:45 +0000 (12:02 +0200)]
introcude new output format 'yaml'

5 years agoPVE::CLIFormatter - pass terminal option as separate parameter
Dietmar Maurer [Thu, 26 Jul 2018 09:25:37 +0000 (11:25 +0200)]
PVE::CLIFormatter - pass terminal option as separate parameter

This simplifies usage, because we can simple omit the $terminal_opts
parameter in most cases (automatically call query_terminal_option) while
still setting $options.

5 years agoPVE::Certificate - set renderers for unix epoch and 'san'
Dietmar Maurer [Wed, 25 Jul 2018 12:59:25 +0000 (14:59 +0200)]
PVE::Certificate - set renderers for unix epoch and 'san'

5 years agoPVE::CLIFormatter - new 'yaml' renderer
Dietmar Maurer [Thu, 26 Jul 2018 07:50:25 +0000 (09:50 +0200)]
PVE::CLIFormatter - new 'yaml' renderer

Generates nice and readable output for list of string and simple objects.

5 years agocli: print_text_table: correctly handle sort_key 0
Dietmar Maurer [Wed, 25 Jul 2018 12:55:30 +0000 (14:55 +0200)]
cli: print_text_table: correctly handle sort_key 0

5 years agoPVE::CLIHandler - allow to define additional parameters for output formatter
Dietmar Maurer [Wed, 25 Jul 2018 07:13:34 +0000 (09:13 +0200)]
PVE::CLIHandler - allow to define additional parameters for output formatter

Best shown with a example:

my $test_formatter = sub {
    my ($res, $result_schema, $fmt_param) = @_;
    PVE::CLIFormatter::print_api_result($res, $result_schema, undef, $fmt_param);
};

$cmddef = [ __PACKAGE__, 'test', [], undef, $test_formatter, $PVE::RESTHandler::standard_output_options],

5 years agocli: remove all output formatter magic from CLIHandler
Dietmar Maurer [Tue, 24 Jul 2018 11:36:42 +0000 (13:36 +0200)]
cli: remove all output formatter magic from CLIHandler

- and rename format to 'output-format'

- provide a method to add properties to schema:
PVE::RESTHandler::add_standard_output_properties

- provide methods to extract output properties:
PVE::RESTHandler::extract_standard_output_properties()

5 years agoPVE::ACME - untaint saved account data
Dietmar Maurer [Thu, 26 Jul 2018 08:45:25 +0000 (10:45 +0200)]
PVE::ACME - untaint saved account data

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoapi dump: do not skip indexed params with only one index
Dominik Csapak [Mon, 23 Jul 2018 10:11:09 +0000 (12:11 +0200)]
api dump: do not skip indexed params with only one index

We transform indexed parameters (like scsi0 scsi1 ...) to a single
scsi[n]. The check if we should transform did not handle the case
where a parameter was indexed but (currently) only index 0 existed.
Such definitions where simply skipped and seemed then to miss from
places using the API dump, like the api-viewer.

We now only skip those parameters with an index > 0 where the same
parameter with index 0 is defined.

This fixes a missing efidisk0 entry in an API dump[0].

[0]: https://forum.proxmox.com/threads/efidisk0-creation-missing-from-api.45624/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version to 5.0-37
Thomas Lamprecht [Wed, 18 Jul 2018 08:48:05 +0000 (10:48 +0200)]
bump version to 5.0-37

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofixup: parameters vs properties typo
Wolfgang Bumiller [Wed, 18 Jul 2018 08:42:24 +0000 (10:42 +0200)]
fixup: parameters vs properties typo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocli_handler: make standard options opt-in
Thomas Lamprecht [Tue, 17 Jul 2018 14:19:31 +0000 (16:19 +0200)]
cli_handler: make standard options opt-in

The new standard options overwrite some already existing options in
already existing CLI tools, which is surely no good, e.g. vzdump
already has an quiet option which now gets overwritten, thus any
backup triggered by CRON always sents out an (additional) email.

Further, they may even only have an effect if the respective CLI
command uses an CLIFormatter print* method to output things.

And for some commands, like 'pvecm status' they may even never make
sense, as they exec an external program which doesn't honors nor gets
those std options...
Also some internal commands, like 'qm mtunnel' will never use it, as
probably even "normal" commands, as it may simply not make sense for
every command..

So make it opt-in for now, any CLI command can set std-output-opts to
get them.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version to 5.0-36
Thomas Lamprecht [Tue, 10 Jul 2018 12:02:35 +0000 (14:02 +0200)]
bump version to 5.0-36

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoprint_api_result: skip undefined object values
Dietmar Maurer [Tue, 10 Jul 2018 11:51:28 +0000 (13:51 +0200)]
print_api_result: skip undefined object values

We use objects to return VM configurations, so we uónly want to display
defined values.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agooutput format options: remove 'plain', add 'json-pretty'
Dietmar Maurer [Tue, 10 Jul 2018 11:51:27 +0000 (13:51 +0200)]
output format options: remove 'plain', add 'json-pretty'

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIFormatter::print_api_result - remove parameter $format
Dietmar Maurer [Tue, 10 Jul 2018 11:51:26 +0000 (13:51 +0200)]
PVE::CLIFormatter::print_api_result - remove parameter $format

Instead, we pass it within $options.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli_handler: pass common output options as separate parameter
Dietmar Maurer [Tue, 10 Jul 2018 11:51:25 +0000 (13:51 +0200)]
cli_handler: pass common output options as separate parameter

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIFormatter - implement new output options
Dietmar Maurer [Tue, 10 Jul 2018 11:51:24 +0000 (13:51 +0200)]
PVE::CLIFormatter - implement new output options

quiet: dont print anything
noheader: supres headers
noborder: no borders
human-readable: use renderers
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agotests: test newly added interfaces individually
Wolfgang Bumiller [Tue, 10 Jul 2018 10:27:29 +0000 (12:27 +0200)]
tests: test newly added interfaces individually

And add eth2/3 to /proc/net/dev, that way we don't need to
create them "virtually" (which we shouldn't, for physical
interfaces).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agofixup: don't use exists boolean
Wolfgang Bumiller [Tue, 10 Jul 2018 10:00:14 +0000 (12:00 +0200)]
fixup: don't use exists boolean

The previous condition didn't fail tests because it was
always false. The 'exists' property is not actually usable
when writing the interface file. It is merely a hint that
the interface existed in /proc/net/dev while parsing the
interfaces file and is otherwise actually unused here.

Simply check for the existence of the interface in $ifaces.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agofixup: compare MTUs numerically
Wolfgang Bumiller [Tue, 10 Jul 2018 09:55:39 +0000 (11:55 +0200)]
fixup: compare MTUs numerically

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agowhitespace fixup
Wolfgang Bumiller [Tue, 10 Jul 2018 09:55:21 +0000 (11:55 +0200)]
whitespace fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup: whitespace and error message consistency
Wolfgang Bumiller [Tue, 10 Jul 2018 09:53:01 +0000 (11:53 +0200)]
cleanup: whitespace and error message consistency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoInotify : add mtu option
Alexandre Derumier [Thu, 5 Jul 2018 00:56:34 +0000 (02:56 +0200)]
Inotify : add mtu option

also check if mtu value is lower than parent interface

fixme: vxlan interface should be 50bytes lower than outgoing interface
       we need to find which interface is used (unicast/multicast/frr)

5 years agoInotify : add check vlan
Alexandre Derumier [Thu, 5 Jul 2018 00:56:33 +0000 (02:56 +0200)]
Inotify : add check vlan

verify than parent interface exist
verify than parent interface type is eth,bond,bridge
verify than parent bridge is vlan aware if type bridge

5 years agoInotify : add check_bond
Alexandre Derumier [Thu, 5 Jul 2018 00:56:32 +0000 (02:56 +0200)]
Inotify : add check_bond

verify than bond slaves exist && type is eth

5 years agoInotify : add bridge ports options
Alexandre Derumier [Thu, 5 Jul 2018 00:56:31 +0000 (02:56 +0200)]
Inotify : add bridge ports options

5 years agoInotify : add vxlan interface support
Alexandre Derumier [Thu, 5 Jul 2018 00:56:30 +0000 (02:56 +0200)]
Inotify : add vxlan interface support

5 years agoPVE::RESTHandler::generate_usage_str - new static method to generate usage from ...
Dietmar Maurer [Fri, 6 Jul 2018 07:30:07 +0000 (09:30 +0200)]
PVE::RESTHandler::generate_usage_str - new static method to generate usage from $info

This is useful to generate usage information with pveclient, where we do not have
handler classes at all.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIFormatter::print_api_result - use print_api_list to print arrays
Dietmar Maurer [Thu, 5 Jul 2018 07:26:27 +0000 (09:26 +0200)]
PVE::CLIFormatter::print_api_result - use print_api_list to print arrays

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoCLIFormatter - implement renderer for timestamps using GMT
Dietmar Maurer [Thu, 5 Jul 2018 06:48:03 +0000 (08:48 +0200)]
CLIFormatter - implement renderer for timestamps using GMT

5 years agoPVE::CLIFormatter::data_to_text - add parameter $options
Dietmar Maurer [Wed, 4 Jul 2018 13:24:52 +0000 (15:24 +0200)]
PVE::CLIFormatter::data_to_text - add parameter $options

Also pass $options to renderer functions.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoCLIFormatter - implement renderer for timestamps
Dietmar Maurer [Wed, 4 Jul 2018 11:28:27 +0000 (13:28 +0200)]
CLIFormatter - implement renderer for timestamps

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIHandler - allow to set LOG ID with $ENV{PVE_LOG_ID}
Dietmar Maurer [Wed, 4 Jul 2018 08:52:26 +0000 (10:52 +0200)]
PVE::CLIHandler - allow to set LOG ID with $ENV{PVE_LOG_ID}

We use this with 'pvesh'.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoJSONSchema: register new standard option 'pve-output-format'
Dietmar Maurer [Mon, 2 Jul 2018 11:34:16 +0000 (13:34 +0200)]
JSONSchema: register new standard option 'pve-output-format'

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIFormatter::extract_properties_to_print - new helper
Dietmar Maurer [Mon, 2 Jul 2018 11:34:15 +0000 (13:34 +0200)]
PVE::CLIFormatter::extract_properties_to_print - new helper

This improves sort order. We now priorize required values, and list
them before optional values.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoCLIFormatter: define some commonly useful rendering functions
Dietmar Maurer [Tue, 3 Jul 2018 11:11:01 +0000 (13:11 +0200)]
CLIFormatter: define some commonly useful rendering functions

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoJSONSchema: define 'renderer' property
Dietmar Maurer [Mon, 2 Jul 2018 11:34:13 +0000 (13:34 +0200)]
JSONSchema: define 'renderer' property

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli: print_text_table: restore autoformat behavior
Thomas Lamprecht [Fri, 29 Jun 2018 12:50:08 +0000 (14:50 +0200)]
cli: print_text_table: restore autoformat behavior

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agocli: print_text_table: support multiline data
Dietmar Maurer [Fri, 29 Jun 2018 11:15:26 +0000 (13:15 +0200)]
cli: print_text_table: support multiline data

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli: data_to_text: never render undefined values
Dietmar Maurer [Fri, 29 Jun 2018 11:15:25 +0000 (13:15 +0200)]
cli: data_to_text: never render undefined values

To make it visible when the API return undefined values.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::CLIFormatter::query_terminal_options - new helper
Dietmar Maurer [Fri, 29 Jun 2018 11:15:24 +0000 (13:15 +0200)]
PVE::CLIFormatter::query_terminal_options - new helper

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli: print_api_result: add/use new encoding option
Dietmar Maurer [Fri, 29 Jun 2018 11:15:23 +0000 (13:15 +0200)]
cli: print_api_result: add/use new encoding option

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoCLIFormatter: implement tables with utf8 borders
Dietmar Maurer [Fri, 29 Jun 2018 11:15:22 +0000 (13:15 +0200)]
CLIFormatter: implement tables with utf8 borders

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoCLIFormatter: pass options as hash
Dietmar Maurer [Fri, 29 Jun 2018 11:15:21 +0000 (13:15 +0200)]
CLIFormatter: pass options as hash

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli: print_text_table: allow to limit output width
Dietmar Maurer [Fri, 29 Jun 2018 11:15:20 +0000 (13:15 +0200)]
cli: print_text_table: allow to limit output width

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agocli: data_to_text: pass property info
Dietmar Maurer [Fri, 29 Jun 2018 11:15:19 +0000 (13:15 +0200)]
cli: data_to_text: pass property info

So that we can display defaults, render boolean nicely, or call arbitrary render
functions ...

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 years agoPVE::JSONSchema::register_renderer - allow to register renderers by name
Dietmar Maurer [Fri, 29 Jun 2018 11:15:18 +0000 (13:15 +0200)]
PVE::JSONSchema::register_renderer - allow to register renderers by name

We want to use those renderer to format CLI output nicely.

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