]> git.proxmox.com Git - pve-ha-manager.git/blob - src/pve-ha-simulator
fix #3415: never switch in error state on recovery, try harder
[pve-ha-manager.git] / src / pve-ha-simulator
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use lib '/usr/share/pve-ha-simulator';
6 use Getopt::Long;
7 use JSON;
8
9 use PVE::Tools;
10 use PVE::HA::Sim::TestHardware;
11 use PVE::HA::Sim::RTHardware;
12
13 my $opt_batch;
14
15 sub show_usage {
16 print "usage: $0 <testdir> [--batch]\n";
17 exit(-1);
18 };
19
20 if (!GetOptions ("batch" => \$opt_batch)) {
21 show_usage();
22 }
23
24 my $testdir = shift || show_usage();
25
26 my $hardware;
27
28 if ($opt_batch) {
29 $hardware = PVE::HA::Sim::TestHardware->new($testdir);
30 } else {
31 $hardware = PVE::HA::Sim::RTHardware->new($testdir);
32 }
33
34 $hardware->log('info', "starting simulation");
35
36 eval { $hardware->run(); };
37 if (my $err = $@) {
38 $hardware->log('err', "exit simulation - $err ");
39 } else {
40 $hardware->log('info', "exit simulation - done");
41 }
42
43 exit(0);
44
45
46