]> git.proxmox.com Git - pve-ha-manager.git/blame - src/pve-ha-simulator
fix variable name typo
[pve-ha-manager.git] / src / pve-ha-simulator
CommitLineData
80e7574f
DM
1#!/usr/bin/perl
2
3use strict;
4use warnings;
460f26d3 5use lib '/usr/share/pve-ha-simulator';
80e7574f
DM
6use Getopt::Long;
7use JSON;
8
9use PVE::Tools;
bf93e2a2 10use PVE::HA::Sim::TestHardware;
9de9a6ce 11use PVE::HA::Sim::RTHardware;
80e7574f 12
460f26d3 13my $opt_batch;
80e7574f
DM
14
15sub show_usage {
460f26d3 16 print "usage: $0 <testdir> [--batch]\n";
80e7574f
DM
17 exit(-1);
18};
19
460f26d3 20if (!GetOptions ("batch" => \$opt_batch)) {
80e7574f
DM
21 show_usage();
22}
23
24my $testdir = shift || show_usage();
25
9de9a6ce
DM
26my $hardware;
27
460f26d3 28if ($opt_batch) {
9de9a6ce 29 $hardware = PVE::HA::Sim::TestHardware->new($testdir);
460f26d3
DM
30} else {
31 $hardware = PVE::HA::Sim::RTHardware->new($testdir);
9de9a6ce 32}
80e7574f 33
caa07bae 34$hardware->log('info', "starting simulation");
80e7574f
DM
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