]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
groups: register groups directly
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 28 Sep 2018 10:48:51 +0000 (12:48 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 28 Sep 2018 12:06:59 +0000 (14:06 +0200)
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>
src/PVE/HA/Config.pm
src/PVE/HA/Groups.pm
src/PVE/HA/Sim/Hardware.pm
src/pve-ha-tester
src/test/test_failover1.pl

index bf37b04ff193969f8eed6592c6287e6fdba1faaf..5de4779ec4af4aac473b9336569004804bf1114a 100644 (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";
index 4816f3eb1bfcb1f258bdc339ecdea0dca7ffb378..40666f6ec50900cf0b54ff974ae24efa7556467d 100644 (file)
@@ -99,4 +99,7 @@ sub parse_section_header {
     return undef;
 }
 
+__PACKAGE__->register();
+__PACKAGE__->init();
+
 1;
index 2019d8f158e16bbb8f0b862ed529200fc33846f4..3b192b0589f1a50c965bd152316e9f965e1ef50f 100644 (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 {
index 0f1f14e1629aaa44b9f35f4026665a1afbaef15a..aa214d77c985afcf5649177470ce617c460a811f 100755 (executable)
@@ -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 {
index d72617e5e033a9a8322005a01123ca4da149bedd..67573a2f036e8a3ca8a968071750332818cefb64 100755 (executable)
@@ -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