5
0
mirror of git://git.proxmox.com/git/pve-ha-manager.git synced 2025-01-10 05:18:04 +03:00
pve-ha-manager/pve-ha-simulator
2015-02-19 09:12:36 +01:00

47 lines
781 B
Perl
Executable File

#!/usr/bin/perl
use strict;
use warnings;
use lib '/usr/share/pve-ha-simulator';
use Getopt::Long;
use JSON;
use PVE::Tools;
use PVE::HA::Sim::TestHardware;
use PVE::HA::Sim::RTHardware;
my $opt_batch;
sub show_usage {
print "usage: $0 <testdir> [--batch]\n";
exit(-1);
};
if (!GetOptions ("batch" => \$opt_batch)) {
show_usage();
}
my $testdir = shift || show_usage();
my $hardware;
if ($opt_batch) {
$hardware = PVE::HA::Sim::TestHardware->new($testdir);
} else {
$hardware = PVE::HA::Sim::RTHardware->new($testdir);
}
$hardware->log('info', "starting simulation");
eval { $hardware->run(); };
if (my $err = $@) {
$hardware->log('err', "exit simulation - $err ");
} else {
$hardware->log('info', "exit simulation - done");
}
exit(0);