5
0
mirror of git://git.proxmox.com/git/pve-ha-manager.git synced 2025-02-01 09:47:24 +03:00

groups: register groups directly

and use PVE::HA::Groups to parse the config when testing/simulating.

this allows us to drop the dependency on PVE::HA::Config, which would
otherwise pull in a lot of additional depdendencies that we don't want
in the simulator.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2018-09-28 12:48:51 +02:00 committed by Thomas Lamprecht
parent f503a7bf77
commit 7d33cb12de
5 changed files with 8 additions and 9 deletions

View File

@ -9,10 +9,6 @@ use PVE::HA::Groups;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file);
use PVE::HA::Resources;
PVE::HA::Groups->register();
PVE::HA::Groups->init();
my $manager_status_filename = "ha/manager_status";
my $ha_groups_config = "ha/groups.cfg";
my $ha_resources_config = "ha/resources.cfg";

View File

@ -99,4 +99,7 @@ sub parse_section_header {
return undef;
}
__PACKAGE__->register();
__PACKAGE__->init();
1;

View File

@ -14,8 +14,8 @@ use IO::File;
use Fcntl qw(:DEFAULT :flock);
use File::Copy;
use File::Path qw(make_path remove_tree);
use PVE::HA::Config;
use PVE::HA::FenceConfig;
use PVE::HA::Groups;
my $watchdog_timeout = 60;
@ -292,7 +292,7 @@ sub read_group_config {
my $raw = '';
$raw = PVE::Tools::file_get_contents($filename) if -f $filename;
return PVE::HA::Config::parse_groups_config($filename, $raw);
return PVE::HA::Groups->parse_config($filename, $raw);
}
sub read_service_status {

View File

@ -7,8 +7,8 @@ use JSON;
use lib '.';
use PVE::Tools;
use PVE::HA::Config;
use PVE::HA::Groups;
use PVE::HA::Sim::TestHardware;
sub show_usage {

View File

@ -4,10 +4,10 @@ use strict;
use warnings;
use lib '..';
use PVE::HA::Config;
use PVE::HA::Groups;
use PVE::HA::Manager;
my $groups = PVE::HA::Config::parse_groups_config("groups.tmp", <<EOD);
my $groups = PVE::HA::Groups->parse_config("groups.tmp", <<EOD);
group: prefer_node1
nodes node1
EOD