]> git.proxmox.com Git - pve-ha-manager.git/blame_incremental - src/pve-ha-simulator
sim hardware: avoid hard error on usage stats parsing
[pve-ha-manager.git] / src / pve-ha-simulator
... / ...
CommitLineData
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use lib '/usr/share/pve-ha-simulator';
6use Getopt::Long;
7use JSON;
8
9use PVE::Tools;
10use PVE::HA::Sim::TestHardware;
11use PVE::HA::Sim::RTHardware;
12
13my $opt_batch;
14
15sub show_usage {
16 print "usage: $0 <testdir> [--batch]\n";
17 exit(-1);
18};
19
20if (!GetOptions ("batch" => \$opt_batch)) {
21 show_usage();
22}
23
24my $testdir = shift || show_usage();
25
26my $hardware;
27
28if ($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
36eval { $hardware->run(); };
37if (my $err = $@) {
38 $hardware->log('err', "exit simulation - $err ");
39} else {
40 $hardware->log('info', "exit simulation - done");
41}
42
43exit(0);
44
45
46