]> git.proxmox.com Git - pve-guest-common.git/log
pve-guest-common.git
3 years agod/control: update meta information
Thomas Lamprecht [Wed, 12 May 2021 11:03:09 +0000 (13:03 +0200)]
d/control: update meta information

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobuildsys: split packaging and source build-systems
Thomas Lamprecht [Sun, 9 May 2021 18:10:14 +0000 (20:10 +0200)]
buildsys: split packaging and source build-systems

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomention prune behavior for the remove parameter
Fabian Ebner [Wed, 3 Mar 2021 11:50:40 +0000 (12:50 +0100)]
mention prune behavior for the remove parameter

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-5
Thomas Lamprecht [Fri, 19 Feb 2021 15:32:26 +0000 (16:32 +0100)]
bump version to 3.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: mailto: use email-or-username-list format
Fabian Ebner [Mon, 15 Feb 2021 12:24:59 +0000 (13:24 +0100)]
vzdump: mailto: use email-or-username-list format

because it is a more complete pattern. Also, 'mailto' was a '-list' format in
PVE 6.2 and earlier, so this also fixes whitespace-related backwards
compatibility. In particular, this fixes creating a backup job in the GUI
without setting an address, which passes along ''.

For example,
> vzdump 153 --mailto " ,,,admin@proxmox.com;;; developer@proxmox.com , ; "
was valid and worked in PVE 6.2.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: command line: make sure mailto is comma-separated
Fabian Ebner [Mon, 15 Feb 2021 12:24:58 +0000 (13:24 +0100)]
vzdump: command line: make sure mailto is comma-separated

In addition to relying on shellquote(), it's still nice to avoid printing out
unnecessary whitespaces, especially newlines.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: command line: refactor handling prune-backups
Fabian Ebner [Mon, 15 Feb 2021 12:24:57 +0000 (13:24 +0100)]
vzdump: command line: refactor handling prune-backups

to re-use a line here and with the next patch.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: correctly handle prune-backups option in commandline and cron config
Fabian Ebner [Tue, 24 Nov 2020 11:27:28 +0000 (12:27 +0100)]
vzdump: correctly handle prune-backups option in commandline and cron config

Previously only the hash reference was printed instead of the property string.
It's also necessary to parse the property string when reading the cron config.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: add explicit reminder for breaking schema change for PVE 7.0
Fabian Ebner [Fri, 15 Jan 2021 12:59:30 +0000 (13:59 +0100)]
vzdump: add explicit reminder for breaking schema change for PVE 7.0

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-4
Thomas Lamprecht [Tue, 15 Dec 2020 14:52:58 +0000 (15:52 +0100)]
bump version to 3.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: update exclude-path description
Fabian Ebner [Fri, 20 Nov 2020 14:50:41 +0000 (15:50 +0100)]
vzdump: update exclude-path description

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agojob_status: simplify fixup of jobs for stolen guests
Fabian Ebner [Thu, 29 Oct 2020 13:31:29 +0000 (14:31 +0100)]
job_status: simplify fixup of jobs for stolen guests

by using switch_replication_job_target_nolock.

If a job is scheduled for removal and the guest was
stolen, it still makes sense to correct the job entry,
which didn't happen previously.

AFAICT, this was the only user of swap_source_target_nolock.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agocreate nolock variant for switch_replication_job_target
Fabian Ebner [Thu, 29 Oct 2020 13:31:28 +0000 (14:31 +0100)]
create nolock variant for switch_replication_job_target

so that it can be used within job_status

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoalso update sources in switch_replication_job_target
Fabian Ebner [Thu, 29 Oct 2020 13:31:27 +0000 (14:31 +0100)]
also update sources in switch_replication_job_target

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoclarify what the source property is used for in a replication job
Fabian Ebner [Thu, 29 Oct 2020 13:31:26 +0000 (14:31 +0100)]
clarify what the source property is used for in a replication job

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agojob_status: read only after acquiring the lock
Fabian Ebner [Thu, 29 Oct 2020 13:31:25 +0000 (14:31 +0100)]
job_status: read only after acquiring the lock

to get the current replication config and have the VM list
and state object as recent as possible.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprint snapshot tree: reduce indentation
Thomas Lamprecht [Sat, 24 Oct 2020 14:56:54 +0000 (16:56 +0200)]
print snapshot tree: reduce indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: use regex check for 'mailto'
Oguz Bektas [Tue, 7 Jul 2020 12:55:40 +0000 (14:55 +0200)]
vzdump: use regex check for 'mailto'

add a new string format to allow local usernames like 'root' but also
limit which characters can be used in the 'mailto' address.

Co-Authored-by: Fabian Gruenbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agobump version to 3.1-3
Thomas Lamprecht [Mon, 24 Aug 2020 08:12:34 +0000 (10:12 +0200)]
bump version to 3.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomove config: add comment about node owning configs
Thomas Lamprecht [Mon, 24 Aug 2020 07:45:30 +0000 (09:45 +0200)]
move config: add comment about node owning configs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoAdd move_config_to_node method
Fabian Ebner [Thu, 20 Aug 2020 09:11:38 +0000 (11:11 +0200)]
Add move_config_to_node method

allows to mock it when testing and a few lines less duplication
between the migration modules.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoAdd prune-backups option to vzdump parameters
Fabian Ebner [Thu, 9 Jul 2020 12:45:44 +0000 (14:45 +0200)]
Add prune-backups option to vzdump parameters

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-2
Fabian Grünbichler [Wed, 5 Aug 2020 10:15:00 +0000 (12:15 +0200)]
bump version to 3.1-2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agounbreak config_with_pending_array
Fabian Grünbichler [Wed, 5 Aug 2020 10:05:18 +0000 (12:05 +0200)]
unbreak config_with_pending_array

which lead to current and pending/delete values being returned
separately, and being misinterpreted by the web interface (and probably
other clients as well).

Fixes: daf8fca57a34417365c873ed91f3a52bf0002a4f
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 3.1-1
Thomas Lamprecht [Mon, 13 Jul 2020 07:08:57 +0000 (09:08 +0200)]
bump version to 3.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup: add comment to avoid same mistake again
Thomas Lamprecht [Sat, 11 Jul 2020 16:47:53 +0000 (18:47 +0200)]
followup: add comment to avoid same mistake again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2834: skip refs in config_with_pending_array
Stoiko Ivanov [Fri, 10 Jul 2020 18:11:28 +0000 (20:11 +0200)]
fix #2834: skip refs in config_with_pending_array

With the refactoring of config_with_pending_array in
daf8fca57a34417365c873ed91f3a52bf0002a4f a few sanity checks on parsed configs
were dropped.

One case where a config value should be skipped, instead of parsed and added
is when the value is not scalar. This is the case for the raw lxc keys
(e.g. lxc.init.cmd, lxc.apparmor.profile) - which get added as array to the
'lxc' key.

This patch reintroduces the skipping of non-scalar values, when parsing the
config but not for the pending values.
From a short look through the commit history the sanity checks were in place
since 2014 (introduced in qemu-server for handling pending configuration
changes), and their removal did not cause any other regressions.
To my knowledge only the raw lxc config keys are parsed into a non-scalar
value.

Tested by adding a 'lxc.init.cmd' key to a container config.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 3.0-11
Thomas Lamprecht [Tue, 7 Jul 2020 16:42:41 +0000 (18:42 +0200)]
bump version to 3.0-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoAdapt description of get_backup_volumes
Aaron Lauterer [Mon, 22 Jun 2020 14:34:39 +0000 (16:34 +0200)]
Adapt description of get_backup_volumes

as `data` was a bit too generic we now use `volume_config` in the actual
implementations. Thus we should adapt the description as well.

Tab spacing for the other keys has been adapted for easier readabilty.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agorefactor config_with_pending_array
Thomas Lamprecht [Wed, 20 May 2020 15:08:09 +0000 (17:08 +0200)]
refactor config_with_pending_array

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix config_with_pending_array for falsy current values
Thomas Lamprecht [Wed, 20 May 2020 15:00:55 +0000 (17:00 +0200)]
fix config_with_pending_array for falsy current values

one could have a config with:
> acpi: 0

and a pending deletion for that to restore the default 1 value.

The config_with_pending_array method then pushed the key twice, one
in the loop iterating the config itself correctly and once in the
pending delete hash, which is normally only for those options not yet
referenced in the config at all. Here the check was on "truthiness"
not definedness, fix that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 3.0-10
Fabian Grünbichler [Tue, 5 May 2020 09:41:48 +0000 (11:41 +0200)]
bump version to 3.0-10

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 3.0-9
Fabian Grünbichler [Tue, 5 May 2020 09:19:59 +0000 (11:19 +0200)]
bump version to 3.0-9

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: break older pve-container
Fabian Grünbichler [Tue, 5 May 2020 09:24:14 +0000 (11:24 +0200)]
d/control: break older pve-container

since the changed locking exposes a bug that requires fixing on the
pve-container side.

4 years agod/control: break older qemu-server
Fabian Grünbichler [Tue, 5 May 2020 09:18:38 +0000 (11:18 +0200)]
d/control: break older qemu-server

since we renamed lock_config_mode to lock_config_shared

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agolock_config: rename lock_config_mode -> lock_config_shared
Fabian Grünbichler [Tue, 5 May 2020 08:27:22 +0000 (10:27 +0200)]
lock_config: rename lock_config_mode -> lock_config_shared

and pull the actual lock_file_full handling into a helper, to make the
public interface clearer:

lock_config -> standard exclusive lock with 10s timeout
lock_config_full -> exclusive lock with configurable timeout
lock_config_shared -> shared lock with configurable timeout

the latter only has a single user (qemu-server's clone API call)
currently.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_delete: check for concurrent modifications at each step
Fabian Grünbichler [Tue, 5 May 2020 08:27:21 +0000 (10:27 +0200)]
snapshot_delete: check for concurrent modifications at each step

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_rollback: make sure newer replication snapshots are deleted
Fabian Ebner [Tue, 5 May 2020 08:27:19 +0000 (10:27 +0200)]
snapshot_rollback: make sure newer replication snapshots are deleted

Commit a1dfeff3a8502544123245ea61ad62cbe97803b7 changed the behavior
for Replication::prepare with last_sync=0, so use last_sync=1 instead.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_rollback: flock earlier
Fabian Grünbichler [Tue, 5 May 2020 08:27:18 +0000 (10:27 +0200)]
snapshot_rollback: flock earlier

to protect checks against concurrent modifications

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agofix 2682: make sure configuration file is up-to-date for lock_config-variants
Fabian Ebner [Tue, 5 May 2020 08:27:17 +0000 (10:27 +0200)]
fix 2682: make sure configuration file is up-to-date for lock_config-variants

See [0] for the details. The call tree for the variants is
lock_config -> lock_config_full -> lock_config_mode
so it is sufficient to adapt lock_config_mode.

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=2682

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoAvoid duplication by using lock_config_mode
Fabian Ebner [Tue, 5 May 2020 08:27:16 +0000 (10:27 +0200)]
Avoid duplication by using lock_config_mode

No functional change is intended.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobump version to 3.0-8
Fabian Grünbichler [Mon, 4 May 2020 12:11:12 +0000 (14:11 +0200)]
bump version to 3.0-8

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoFix: #2124 add zstd support
Alwin Antreich [Tue, 28 Apr 2020 13:58:11 +0000 (15:58 +0200)]
Fix: #2124 add zstd support

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
4 years agobump version to 3.0-7
Fabian Grünbichler [Thu, 9 Apr 2020 06:47:22 +0000 (08:47 +0200)]
bump version to 3.0-7

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: depend on pve-storage with new storage_migrate
Fabian Grünbichler [Thu, 9 Apr 2020 06:45:06 +0000 (08:45 +0200)]
d/control: depend on pve-storage with new storage_migrate

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoAdd update_volume_ids
Fabian Ebner [Wed, 8 Apr 2020 09:25:03 +0000 (11:25 +0200)]
Add update_volume_ids

This function is intened to be used after doing a migration where some
of the volume IDs changed.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoUse new storage_migrate interface
Fabian Ebner [Wed, 8 Apr 2020 09:25:00 +0000 (11:25 +0200)]
Use new storage_migrate interface

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoreplicaiton: log rate and transport type
Thomas Lamprecht [Wed, 8 Apr 2020 11:27:34 +0000 (13:27 +0200)]
replicaiton: log rate and transport type

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoreplication: dont declare variable in post-if scope
Thomas Lamprecht [Wed, 8 Apr 2020 11:20:02 +0000 (13:20 +0200)]
replication: dont declare variable in post-if scope

If a variable is defined and assigned in a conditional statement, it
is not defined behavior in Perl.

For more information about this behaviour see
https://perldoc.perl.org/perlsyn.html#Statement-Modifiers

> NOTE: The behaviour of a my, state, or our modified with a
> statement modifier conditional or loop construct (for example,
> `my $x if ...`) is undefined.
> The value of the my variable may be undef, any previously assigned
> value, or possibly anything else.
> Don't rely on it. Future versions of perl might do something
> different from the version of perl you try it out on. Here be
> dragons."

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 3.0-6
Fabian Grünbichler [Mon, 30 Mar 2020 07:21:20 +0000 (09:21 +0200)]
bump version to 3.0-6

and add versioned breaks for foreach_volume changes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoforeach_volume(_full): generalize and implement function
Fabian Ebner [Thu, 26 Mar 2020 08:09:35 +0000 (09:09 +0100)]
foreach_volume(_full): generalize and implement function

Introduce a parameter $opts to allow for better control of which
keys/volumes to use for the iteration and ability to reverse the order.
Also, allow extra parameters for the function.

Removes the '__snapshot'-prefix for future use from outside the module.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoAdd foreach_unused_volume
Fabian Ebner [Thu, 26 Mar 2020 08:09:34 +0000 (09:09 +0100)]
Add foreach_unused_volume

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoAdd interfaces for volume-related helpers
Fabian Ebner [Thu, 26 Mar 2020 08:09:33 +0000 (09:09 +0100)]
Add interfaces for volume-related helpers

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobump version to 3.0-5
Thomas Lamprecht [Thu, 12 Mar 2020 10:10:06 +0000 (11:10 +0100)]
bump version to 3.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agomake GuestHelpers a subclass of Exporter
Dominik Csapak [Thu, 12 Mar 2020 09:57:14 +0000 (10:57 +0100)]
make GuestHelpers a subclass of Exporter

or else the Exports will not work

found by hotplugging nics with current master from qemu-server
which resulted in a
'undefined subroutine &PVE::QemuServer::safe_string_ne'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump version to 3.0-4
Thomas Lamprecht [Tue, 10 Mar 2020 13:03:53 +0000 (14:03 +0100)]
bump version to 3.0-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoget_backup_volumes: clarifcation and indentation improvements to comment
Thomas Lamprecht [Tue, 10 Mar 2020 11:17:00 +0000 (12:17 +0100)]
get_backup_volumes: clarifcation and indentation improvements to comment

Aaron clarified that one documented element actually slipped through
and won't be returned.

Also firx the mixed tab/space indentation, for such comments we can
be pretty liberal and I just went with the two spaces per level, as
some part already had that.

Clarify that both array and hash are refs.

[0]: https://pve.proxmox.com/pipermail/pve-devel/2020-March/042070.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoabstractconfig: add prototype for get_backup_volumes
Aaron Lauterer [Thu, 27 Feb 2020 10:01:11 +0000 (11:01 +0100)]
abstractconfig: add prototype for get_backup_volumes

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agoconfig: add missing use GuestHelpers module
Thomas Lamprecht [Tue, 10 Mar 2020 08:46:41 +0000 (09:46 +0100)]
config: add missing use GuestHelpers module

import the typesafe_ne method when we're at it

4 years agoconfig: return early if $opt is not partial fast pluggable
Thomas Lamprecht [Tue, 10 Mar 2020 08:43:56 +0000 (09:43 +0100)]
config: return early if $opt is not partial fast pluggable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoabstractconfig: add partial_fast_plug
Oguz Bektas [Wed, 19 Feb 2020 16:07:58 +0000 (17:07 +0100)]
abstractconfig: add partial_fast_plug

allows partial fast plugging of functions as defined in the
$partial_fast_plug_option in qemuserver (and possibly lxc later on)

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoguesthelpers: move/add safe comparison functions from lxc and qemu
Oguz Bektas [Wed, 19 Feb 2020 16:07:55 +0000 (17:07 +0100)]
guesthelpers: move/add safe comparison functions from lxc and qemu

move the safe_string_ne and safe_num_ne functions to guesthelpers to
remove duplicate code.

add the new safe_boolean_ne and typesafe_ne helper functions

also add them in @EXPORT_OK

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofix some typos
Thomas Lamprecht [Sat, 8 Feb 2020 15:03:49 +0000 (16:03 +0100)]
fix some typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotrivial whitespace fix
Thomas Lamprecht [Fri, 7 Feb 2020 15:22:47 +0000 (16:22 +0100)]
trivial whitespace fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoconfig trait: allow to pass lock to create_and_lock_config
Thomas Lamprecht [Thu, 23 Jan 2020 10:01:55 +0000 (11:01 +0100)]
config trait: allow to pass lock to create_and_lock_config

allows us to reuse this for clone, where we want to create a "clone"
locked config for the target guest.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agogrammar fix: s/does not exists/does not exist/g
Thomas Lamprecht [Fri, 13 Dec 2019 11:07:58 +0000 (12:07 +0100)]
grammar fix: s/does not exists/does not exist/g

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoavoid cyclic reference in closure
Wolfgang Bumiller [Tue, 19 Nov 2019 08:46:44 +0000 (09:46 +0100)]
avoid cyclic reference in closure

otherwise this leaks memory

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-3
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:23 +0000 (11:28 +0100)]
bump version to 3.0-3

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: add more missing build-dependencies
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:22 +0000 (11:28 +0100)]
d/control: add more missing build-dependencies

pve-cluster is used by the test cases

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add (build-)depends on libpve-cluster-perl
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:21 +0000 (11:28 +0100)]
d/control: add (build-)depends on libpve-cluster-perl

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::SSHInfo
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:20 +0000 (11:28 +0100)]
use PVE::SSHInfo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::DataCenterConfig
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:19 +0000 (11:28 +0100)]
use PVE::DataCenterConfig

to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 3.0-2
Thomas Lamprecht [Fri, 18 Oct 2019 19:12:04 +0000 (21:12 +0200)]
bump version to 3.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: break pve-manager (<< 6.0-10) due to vzdump parser move
Thomas Lamprecht [Fri, 18 Oct 2019 19:11:54 +0000 (21:11 +0200)]
d/control: break pve-manager (<< 6.0-10) due to vzdump parser move

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotests: remove some redundant trailing commas
Thomas Lamprecht [Fri, 18 Oct 2019 19:05:53 +0000 (21:05 +0200)]
tests: remove some redundant trailing commas

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocleanup_pending: refactor and fix $force
Thomas Lamprecht [Fri, 18 Oct 2019 18:31:10 +0000 (20:31 +0200)]
cleanup_pending: refactor and fix $force

pull out $conf->{pending} in a intermediate variable.

While for now only a force key could be in a pending delete value it
still is completely wrong to say the whole hash value is thus $force.

Fix that by omitting that intermediate variable completely and copy
over directly from the source hash.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd cleanup_pending tests
Thomas Lamprecht [Fri, 18 Oct 2019 18:29:20 +0000 (20:29 +0200)]
add cleanup_pending tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotests: add map_expect_to_param_id feature for checking side-effects
Thomas Lamprecht [Fri, 18 Oct 2019 18:28:59 +0000 (20:28 +0200)]
tests: add map_expect_to_param_id feature for checking side-effects

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotests: add checks for remove_from_pending_delete
Thomas Lamprecht [Fri, 18 Oct 2019 17:45:58 +0000 (19:45 +0200)]
tests: add checks for remove_from_pending_delete

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor/cleanup remove_from_pending_delete sligthly
Thomas Lamprecht [Fri, 18 Oct 2019 17:44:40 +0000 (19:44 +0200)]
refactor/cleanup remove_from_pending_delete sligthly

return $conf for tests, use intermediate variable for
$conf->{pending}, which besides shorter lines avoids also the
autovification of $config stuff.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotests: add checks for add_to_pending_delete
Thomas Lamprecht [Fri, 18 Oct 2019 17:26:51 +0000 (19:26 +0200)]
tests: add checks for add_to_pending_delete

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor/cleanup add_to_pending_delete sligthly
Thomas Lamprecht [Fri, 18 Oct 2019 17:27:31 +0000 (19:27 +0200)]
refactor/cleanup add_to_pending_delete sligthly

no need to delete, then re-fill by autovification; just explicitly
overwrite with new value.

Also explicitly populate pending hash if not defined, avoids
auto-vivification which is a bit intransparent.

explicitly return $conf for tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoprint_pending_delete: make deterministical
Thomas Lamprecht [Fri, 18 Oct 2019 15:55:28 +0000 (17:55 +0200)]
print_pending_delete: make deterministical

for tests and UX

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor print_pending_delete slightly
Thomas Lamprecht [Fri, 18 Oct 2019 15:15:46 +0000 (17:15 +0200)]
refactor print_pending_delete slightly

while this was much better than the old mess from
parse_pending_delete it still was a bit much nested into one line.

split that up a bit, add a render_key helper which does the clunky
"add !" check and just call that one in the map {}

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotests: add print_pending_delete ones
Thomas Lamprecht [Fri, 18 Oct 2019 15:15:07 +0000 (17:15 +0200)]
tests: add print_pending_delete ones

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor parse_pending_delete to sane implemenation
Thomas Lamprecht [Fri, 18 Oct 2019 14:43:25 +0000 (16:43 +0200)]
refactor parse_pending_delete to sane implemenation

this was quite the mess, a perl greedy match over non-whitespace
character is equivalent to a split on whitespace on, but the latter
is much easier to grasp when looking at this the first time.

Do a real for loop with real variable names and less nest everything
into one line.

the test added in the previous commit should give use the safety net
for that cleanup.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd basic abstract config test system
Thomas Lamprecht [Fri, 18 Oct 2019 14:42:36 +0000 (16:42 +0200)]
add basic abstract config test system

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agohelpers: s/conf_table_with_pending/config_with_pending_array/ and comment
Thomas Lamprecht [Fri, 18 Oct 2019 10:53:43 +0000 (12:53 +0200)]
helpers: s/conf_table_with_pending/config_with_pending_array/ and comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agohelpers: add method to represent config as a table
Oguz Bektas [Mon, 14 Oct 2019 08:28:36 +0000 (10:28 +0200)]
helpers: add method to represent config as a table

in vm_pending API, this method is used to represent the configuration as
a table with current, pending and delete columns.

by adding it as a guesthelper, we can also use it for container pending
changes.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agohelpers: add pending-aware guest config printer from qemu-server
Oguz Bektas [Mon, 14 Oct 2019 08:28:35 +0000 (10:28 +0200)]
helpers: add pending-aware guest config printer from qemu-server

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoabstractconfig: add load_current_config and load_snapshot_config
Oguz Bektas [Mon, 14 Oct 2019 08:28:34 +0000 (10:28 +0200)]
abstractconfig: add load_current_config and load_snapshot_config

this code is already used by qemu-server's GET config API call. it is
however better to split this into to methods and decide what to run in
the API call.

this general implementation uses some $class helpers which allow to abstract
away the difference in the child classes. this will be used for
containers once they can do pending changes.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoabstractconfig: add pending changes related helpers
Oguz Bektas [Mon, 14 Oct 2019 08:28:33 +0000 (10:28 +0200)]
abstractconfig: add pending changes related helpers

use a better naming scheme for methods from qemuserver:

split_flagged_list -> parse_pending_delete
join_flagged_list -> print_pending_delete
vmconfig_delete_pending_option -> add_to_pending_delete
vmconfig_undelete_pending_option -> remove_from_pending_delete
vmconfig_cleanup_pending -> cleanup_pending

parse_pending_delete now has a better representation of the force value,
which is encoded in a perl hash i.e. $conf->{$opt}->{force} = 1 or 0
depending on if the string in config has '!' or not.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agobase guest config: add common destroy_config implementation
Thomas Lamprecht [Fri, 18 Oct 2019 06:47:31 +0000 (08:47 +0200)]
base guest config: add common destroy_config implementation

copied over from pve-containers implementation with the same name.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #1291: implement remove_vmid_from_backup_jobs
Christian Ebner [Tue, 15 Oct 2019 11:00:20 +0000 (13:00 +0200)]
fix #1291: implement remove_vmid_from_backup_jobs

remove_vmid_from_backup_jobs updates the vzdump.cron backup jobs,
excluding the given vmid.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 years agovzdump: move registration of vzdump.cron from manager to guest-common to avoid cyclic...
Christian Ebner [Tue, 15 Oct 2019 11:00:19 +0000 (13:00 +0200)]
vzdump: move registration of vzdump.cron from manager to guest-common to avoid cyclic dependency

The registration of the vzdump.cron file was handled in pve-manager.
By moving the relevant code to pve-guest-common, cyclic dependencies
for cfs registration are avoided.
This makes this patch of guest-common a build dependency for the other
packages touched in this patch series.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 years agofollowup: rename to print_snapshot_tree, add comment and rename $res param
Thomas Lamprecht [Tue, 1 Oct 2019 15:20:21 +0000 (17:20 +0200)]
followup: rename to print_snapshot_tree, add comment and rename $res param

This was taken from a CLI helper, there $res is a common parameter
name which denotes that it's the res from the API call the CLI
command bases on. But here that makes no sense and is not really
telling about what the value(s) of $res could be. Further explain
that with a comment.

As this also prints uncoditionally to STDOUT let's say so through the
method name.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoreformat code for snapshot tree into GuestHelpers
Oguz Bektas [Tue, 1 Oct 2019 07:32:45 +0000 (09:32 +0200)]
reformat code for snapshot tree into GuestHelpers

qm/pct listsnapshot lack feature parity w.r.t. showing snapshots in a
tree ordered by the date. by moving this code into GuestHelpers, it can
be shared.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoimplement remove_vmid_jobs for ReplicationConfig
Christian Ebner [Mon, 1 Jul 2019 13:43:48 +0000 (15:43 +0200)]
implement remove_vmid_jobs for ReplicationConfig

Allows to remove replication jobs from the config based on the vmid.

Preparations for #1291 fix

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
5 years agobuildsys: no need to include arch detection for arch-independent package
Thomas Lamprecht [Tue, 21 May 2019 20:24:59 +0000 (22:24 +0200)]
buildsys: no need to include arch detection for arch-independent package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobuildsys: switch upload dist over to buster
Thomas Lamprecht [Tue, 21 May 2019 19:08:05 +0000 (21:08 +0200)]
buildsys: switch upload dist over to buster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>