Commit Graph

372 Commits

Author SHA1 Message Date
Aaron Lauterer
b2a2affa3f abstractconfig: add prototype for get_backup_volumes
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-03-10 12:13:07 +01:00
Thomas Lamprecht
67b3581e64 config: add missing use GuestHelpers module
import the typesafe_ne method when we're at it
2020-03-10 09:48:22 +01:00
Thomas Lamprecht
47d7954c59 config: return early if $opt is not partial fast pluggable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-10 09:43:56 +01:00
Oguz Bektas
866f5834fd 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>
2020-03-10 09:00:05 +01:00
Oguz Bektas
24d90d8d10 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>
2020-03-10 09:00:05 +01:00
Thomas Lamprecht
ab44df53f7 fix some typos
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-08 16:03:49 +01:00
Thomas Lamprecht
9420142c33 trivial whitespace fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-07 16:22:47 +01:00
Thomas Lamprecht
fde98d5e11 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>
2020-01-23 11:01:56 +01:00
Thomas Lamprecht
fb73d112aa grammar fix: s/does not exists/does not exist/g
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-13 12:08:06 +01:00
Wolfgang Bumiller
727080edd9 avoid cyclic reference in closure
otherwise this leaks memory

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-19 09:46:46 +01:00
Fabian Grünbichler
73427ae3cd 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>
2019-11-18 12:02:17 +01:00
Fabian Grünbichler
efd0b53cf1 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>
2019-11-18 12:01:39 +01:00
Fabian Grünbichler
9e61323e46 d/control: add (build-)depends on libpve-cluster-perl
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:01:39 +01:00
Fabian Grünbichler
0c85474f68 use PVE::SSHInfo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:01:39 +01:00
Fabian Grünbichler
96c08a9dcd use PVE::DataCenterConfig
to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:01:39 +01:00
Thomas Lamprecht
7a6a1a4b37 bump version to 3.0-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 21:12:04 +02:00
Thomas Lamprecht
4a8a1c83d8 d/control: break pve-manager (<< 6.0-10) due to vzdump parser move
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 21:11:54 +02:00
Thomas Lamprecht
6df4b6a8ea tests: remove some redundant trailing commas
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 21:05:53 +02:00
Thomas Lamprecht
c24919a9d7 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>
2019-10-18 20:32:30 +02:00
Thomas Lamprecht
28f1f21ca2 add cleanup_pending tests
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 20:29:20 +02:00
Thomas Lamprecht
975e60d986 tests: add map_expect_to_param_id feature for checking side-effects
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 20:28:59 +02:00
Thomas Lamprecht
e33cb61565 tests: add checks for remove_from_pending_delete
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 19:45:58 +02:00
Thomas Lamprecht
464a42c487 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>
2019-10-18 19:44:42 +02:00
Thomas Lamprecht
6f38ab5aec tests: add checks for add_to_pending_delete
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 19:35:06 +02:00
Thomas Lamprecht
51e827b8e3 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>
2019-10-18 19:35:06 +02:00
Thomas Lamprecht
6a6ad855b2 print_pending_delete: make deterministical
for tests and UX

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 18:04:07 +02:00
Thomas Lamprecht
51088c75f2 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>
2019-10-18 17:48:03 +02:00
Thomas Lamprecht
c29213f0ef tests: add print_pending_delete ones
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 17:48:03 +02:00
Thomas Lamprecht
7b9d1adeb2 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>
2019-10-18 17:48:03 +02:00
Thomas Lamprecht
fe82406191 add basic abstract config test system
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 17:48:03 +02:00
Thomas Lamprecht
550010301d helpers: s/conf_table_with_pending/config_with_pending_array/ and comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 17:48:03 +02:00
Oguz Bektas
151444810f 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>
2019-10-18 17:48:03 +02:00
Oguz Bektas
bd240228e0 helpers: add pending-aware guest config printer from qemu-server
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-10-18 17:46:59 +02:00
Oguz Bektas
61264e82be 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>
2019-10-18 09:28:34 +02:00
Oguz Bektas
810ee08809 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>
2019-10-18 09:28:34 +02:00
Thomas Lamprecht
1aa76f2f0b 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>
2019-10-18 08:47:33 +02:00
Christian Ebner
8c3af92574 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>
2019-10-18 07:47:23 +02:00
Christian Ebner
e2a0a93be0 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>
2019-10-18 07:47:23 +02:00
Thomas Lamprecht
5ee5f8873e 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>
2019-10-01 17:20:27 +02:00
Oguz Bektas
725dcadba3 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>
2019-10-01 17:15:04 +02:00
Christian Ebner
1daaf2ea3f 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>
2019-09-04 16:36:34 +02:00
Thomas Lamprecht
59af4860a1 buildsys: no need to include arch detection for arch-independent package
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 22:24:59 +02:00
Thomas Lamprecht
f7468cd95c buildsys: switch upload dist over to buster
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 21:08:05 +02:00
Thomas Lamprecht
8c0ad15e01 bump version to 3.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 21:03:47 +02:00
Thomas Lamprecht
130a35c615 buildsys: use dpkg-dev makefile helpers for pkg info
while we already dynamically resolved the version from the changelog
using dpkg-parsechangelog, and those dpkg-dev helpers also use that
tool, let's switch to them nonetheless to have a bit more stream
lined dev environment.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 21:00:51 +02:00
Thomas Lamprecht
eed4dab840 set debian source format to 1.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 21:00:13 +02:00
Wolfgang Link
3cdcfff633 increase max reading replication state file size.
In this file, the error of a failed job will also be stored.
The default 32768 bytes are not very much.

This file is on the local filesystem so there is no filesystem
size restrictions like in /etc/pve.
2019-04-17 07:26:53 +00:00
Thomas Lamprecht
a7b366396b bump version to 2.0-20
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-01 12:52:20 +01:00
Thomas Lamprecht
6ca3f296b6 d/control: bump version dependency of libpve-storage-perl
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-01 12:51:54 +01:00
Thomas Lamprecht
1c9da8ac5b follouwp: saner exception handling
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-01 10:10:48 +01:00