]> git.proxmox.com Git - pve-cluster.git/commitdiff
generate vzdump setup file /etc/pve/vzdump
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 24 Oct 2011 05:33:27 +0000 (07:33 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 24 Oct 2011 05:33:27 +0000 (07:33 +0200)
Also create a symlink /etc/cron.d/vzdump to that file.

data/PVE/Cluster.pm
data/PVE/pvecm

index e10e848bed1aefc8efef6dfdcbcb6bbf37aa3323..9a7e2c77971e3545b20da3e67a4c20bf8db20dba 100644 (file)
@@ -320,6 +320,36 @@ sub gen_pve_node_files {
     gen_pve_ssl_cert($force, $nodename, $ip);
 }
 
+my $vzdump_cron_dummy = <<__EOD;
+# cluster wide vzdump cron schedule
+# Atomatically generated file - do not edit
+
+PATH="/usr/sbin:/usr/bin:/sbin:/bin"
+
+__EOD
+
+sub gen_pve_vzdump_symlink {
+
+    my $filename = "/etc/pve/vzdump";
+
+    my $link_fn = "/etc/cron.d/vzdump";
+
+    if ((-f $filename) && (! -l $link_fn)) {
+       rename($link_fn, "/root/etc_cron_vzdump.org"); # make backup if file exists
+       symlink($filename, $link_fn);
+    }
+}
+
+sub gen_pve_vzdump_files {
+
+    my $filename = "/etc/pve/vzdump";
+
+    PVE::Tools::file_set_contents($filename, $vzdump_cron_dummy)
+       if ! -f $filename;
+
+    gen_pve_vzdump_symlink();
+};
+
 my $versions = {};
 my $vmlist = {};
 my $clinfo = {};
index 30f47800a244b3d197ce32da4f19c0562e6839a0..78e8e7a898e9f4da932d857177bb9c1726b457c1 100755 (executable)
@@ -580,7 +580,7 @@ __PACKAGE__->register_method ({
     name => 'updatecerts', 
     path => 'updatecerts',
     method => 'PUT',
-    description => "Update node certificates.",
+    description => "Update node certificates (and generate all needed files/directories).",
     parameters => {
        additionalProperties => 0,
        properties => {
@@ -600,6 +600,8 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
+       PVE::Cluster::gen_pve_vzdump_symlink();
+
        if (!PVE::Cluster::check_cfs_quorum(1)) {
            return undef if $param->{silent};
            die "no quorum - unable to update files\n";
@@ -608,6 +610,7 @@ __PACKAGE__->register_method ({
        PVE::Cluster::gen_pve_node_files($nodename, $local_ip_address, $param->{force});
        PVE::Cluster::ssh_merge_keys();
        PVE::Cluster::ssh_merge_known_hosts($nodename, $local_ip_address);
+       PVE::Cluster::gen_pve_vzdump_files();
 
        return undef;
     }});