]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
add new class to handle configuration
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 11 Mar 2015 08:29:30 +0000 (09:29 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 11 Mar 2015 08:29:30 +0000 (09:29 +0100)
src/PVE/HA/Config.pm [new file with mode: 0644]
src/PVE/HA/Makefile
src/PVE/HA/Sim/Hardware.pm

diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
new file mode 100644 (file)
index 0000000..225f68c
--- /dev/null
@@ -0,0 +1,30 @@
+package PVE::HA::Config;
+
+use strict;
+use warnings;
+
+use PVE::HA::Groups;
+use PVE::HA::Resources;
+
+PVE::HA::Groups->register();
+
+PVE::HA::Groups->init();
+
+PVE::HA::Resources::PVEVM->register();
+PVE::HA::Resources::IPAddr->register();
+
+PVE::HA::Resources->init();
+
+sub parse_groups_config {
+    my ($filename, $raw) = @_;
+
+    return PVE::HA::Groups->parse_config($filename, $raw);
+}
+
+sub parse_resource_config {
+    my ($filename, $raw) = @_;
+    
+    return PVE::HA::Resources->parse_config($filename, $raw);
+}
+
+1;
index 078a9083ae6ce2b55d9028c6463497faf94aa85a..4357015f0a450dd6f9dfbd52f8b1ac13e1e59cc8 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=CRM.pm Env.pm Groups.pm LRM.pm Manager.pm NodeStatus.pm Tools.pm
+SOURCES=CRM.pm Env.pm Groups.pm Resources.pm Config.pm LRM.pm Manager.pm NodeStatus.pm Tools.pm
 
 .PHONY: install
 install:
index f702210a879a1039786f10af5b0ab92228791254..2c30b0955099c0514bc58156a8c6cd49f35448a0 100644 (file)
@@ -15,10 +15,7 @@ use IO::File;
 use Fcntl qw(:DEFAULT :flock);
 use File::Copy;
 use File::Path qw(make_path remove_tree);
-use PVE::HA::Groups;
-
-PVE::HA::Groups->register();
-PVE::HA::Groups->init();
+use PVE::HA::Config;
 
 my $watchdog_timeout = 60;
 
@@ -174,7 +171,7 @@ sub read_group_config {
     my $raw = '';
     $raw = PVE::Tools::file_get_contents($filename) if -f $filename;
 
-    return PVE::HA::Groups->parse_config($filename, $raw);
+    return PVE::HA::Config::parse_groups_config($filename, $raw);
 }
 
 sub read_service_status {