Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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
Wolfgang Bumiller
90fba9cdf3 replace complete_snapshot_name with snapshot_list
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-01-03 10:22:26 +01:00
Rhonda D'Vine
eb50bb6141 Bash completion helper for snapshot name
This is the bash completion helper function for completing the snapshot
name.  This is used both in qemu-server and pve-container.

This patch is the base for the patches in qemu-server and pve-container.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2018-11-14 11:55:08 +01:00
Dominik Csapak
3fa4ce4516 add snapshot rollback hook and remove qemu machine code
instead move the QEMU machine logic inside qemu-server package with
the help of the new snapshot rollback hook

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-17 15:21:22 +02:00
Thomas Lamprecht
cbbb06a5ae add create_and_lock_config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-12 09:45:40 +02:00
Alwin Antreich
4c3144eaa6 Fix #1480: die if snapshot name is not found before set_lock is used
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2017-09-01 09:06:24 +02:00
Dietmar Maurer
c324e90764 call get_replicatable_volumes with $vmid parameter 2017-06-13 09:17:50 +02:00
Dietmar Maurer
54b79ff5e2 get_replicatable_volumes: add $vmid parameter 2017-06-13 09:00:24 +02:00
Dietmar Maurer
14f17b497a PVE/AbstractConfig.pm - include missing classes 2017-06-13 06:13:39 +02:00
Wolfgang Link
683a30e062 Make rollback compatible with storage replica.
If we rollback we have to clean up all local replication snapshots.
2017-06-12 10:54:33 +02:00
Dietmar Maurer
3f85b14d89 PVE::AbstractConfig - add prototype for get_replicatable_volumes 2017-06-12 09:03:14 +02:00
Dietmar Maurer
eb74d48313 AbstractConfig.pm: remove code for replicate configuration
It is no longer used.
2017-05-29 07:33:38 +02:00
Dietmar Maurer
bff37779c0 AbstractConfig.pm: do not copy/store replicate parameter in snapshot config 2017-05-06 11:40:22 +02:00
Wolfgang Link
38532f70ad Replica parameters should be ignored by snapshot and restore.
The replica are parameter that should not be changed by a rollback.
2017-04-28 10:46:57 +02:00
Fabian Grünbichler
58a3c91ced initial commit
AbstractConfig.pm and AbstractMigrate.pm copied from
pve-common

added use statements for PVE::Cluster and PVE::Storage to
AbstractConfig
2017-01-24 14:03:24 +01:00