The purge option allows to remove the vmid from the vzdump.cron jobs.

Signed-off-by: Christian Ebner <c.eb...@proxmox.com>
---
 src/PVE/API2/LXC.pm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index cf14d75..563cfb9 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -18,6 +18,7 @@ use PVE::LXC;
 use PVE::LXC::Create;
 use PVE::LXC::Migrate;
 use PVE::GuestHelpers;
+use PVE::VZDump::Plugin;
 use PVE::API2::LXC::Config;
 use PVE::API2::LXC::Status;
 use PVE::API2::LXC::Snapshot;
@@ -627,6 +628,11 @@ __PACKAGE__->register_method({
        properties => {
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid', { completion => 
\&PVE::LXC::complete_ctid_stopped }),
+           purge => {
+               type => 'boolean',
+               description => "Remove vmid from backup cron jobs.",
+               optional => 1,
+           },
        },
     },
     returns => {
@@ -636,16 +642,12 @@ __PACKAGE__->register_method({
        my ($param) = @_;
 
        my $rpcenv = PVE::RPCEnvironment::get();
-
        my $authuser = $rpcenv->get_user();
-
        my $vmid = $param->{vmid};
 
        # test if container exists
        my $conf = PVE::LXC::Config->load_config($vmid);
-
        my $storage_cfg = cfs_read_file("storage.cfg");
-
        PVE::LXC::Config->check_protection($conf, "can't remove CT $vmid");
 
        die "unable to remove CT $vmid - used in HA resources\n"
@@ -669,6 +671,7 @@ __PACKAGE__->register_method({
            PVE::LXC::destroy_lxc_container($storage_cfg, $vmid, $conf);
            PVE::AccessControl::remove_vm_access($vmid);
            PVE::Firewall::remove_vmfw_conf($vmid);
+           PVE::VZDump::Plugin::remove_vmid_from_cronjobs($vmid) if 
($param->{purge});
        };
 
        my $realcmd = sub { PVE::LXC::Config->lock_config($vmid, $code); };
-- 
2.11.0

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to