#!/usr/bin/perl
#
# BackupPC_ovz
+# Version: __appVersion__
#
# OpenVZ integration for BackupPC allowing the latter to backup OpenVZ VE's
# with ovz awareness to improve backup and restore efficiency and features.
-
+#
# FIXME: signal handling to clean up mount point and snapshot on termination
use strict;
use Proc::PID::File;
# Various constants
-my @HNS = ('pe18001.titaniummirror.com', 'pe18002.titaniummirror.com');
my @script_ext = qw(start stop mount umount);
my @velist = ();
my $pidfile = "/tmp/".basename($0).".pid";
my $vzsnap = 'vzsnap'; # Mount point and lv names. Mount is relative to /.
my $snapsize = '1g';
+my $hnlistFile = "/etc/backuppc/".basename($0).".hnlist";
my $velistFile = $ENV{HOME}."/log/".basename($0).".velist";
sub cmdExecOrEval
{
# Write the VEs on all HNs to a config file on the BackupPC server for
# later use.
+ my @HNS = ();
+ open my $cfg, "<$hnlistFile" || die "Cannot read $hnlistFile";
+ while (<$cfg>) {
+ chomp;
+ push(@HNS, split(' ')) if (! /^#/);
+ }
+ close($cfg);
+ die "No HNs defined in $hnlistFile" if ($#HNS < 0);
+
open my $out, ">$velistFile" || die "Cannot write to $velistFile";
foreach my $hn (@HNS) {
open my $fh, "ssh -l root $hn vzlist -a |" ||
die "Failed to create snapshot device"
}
$ve->{'snapdev'} = $snapdev;
- cmdSystemOrEval("mount -o nouuid $snapdev $snaproot");
+ cmdSystemOrEval("mount -o nouuid,noatime,nodiratime $snapdev $snaproot");
my $snapprivate = $ve->{'private'};
$snapprivate =~ s|/?$lvmpath/?|/$vzsnap/|;