]> git.proxmox.com Git - qemu-server.git/commitdiff
do not allow destroy if there are replication jobs
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 23 May 2017 16:01:13 +0000 (18:01 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 31 May 2017 05:53:58 +0000 (07:53 +0200)
PVE/API2/Qemu.pm

index 3342458929cff5176d7ad734854bdd112a94d16f..bc9f7274b1c198a67fce31fdadee87d61a8bc34e 100644 (file)
@@ -15,6 +15,7 @@ use PVE::Exception qw(raise raise_param_exc raise_perm_exc);
 use PVE::Storage;
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::RESTHandler;
+use PVE::ReplicationConfig;
 use PVE::QemuConfig;
 use PVE::QemuServer;
 use PVE::QemuMigrate;
@@ -1279,6 +1280,10 @@ __PACKAGE__->register_method({
        die "unable to remove VM $vmid - used in HA resources\n"
            if PVE::HA::Config::vm_is_ha_managed($vmid);
 
+       # do not allow destroy if there are replication jobs
+       my $repl_conf = PVE::ReplicationConfig->new();
+       $repl_conf->check_for_existing_jobs($vmid);
+
        # early tests (repeat after locking)
        die "VM $vmid is running - destroy failed\n"
            if PVE::QemuServer::check_running($vmid);