]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
add command line tool
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Mar 2015 05:55:19 +0000 (06:55 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Mar 2015 05:55:19 +0000 (06:55 +0100)
src/Makefile
src/ha-manager [new file with mode: 0755]

index 688b0978ca9ef849d5a3d834367452fc6dfe0838..4c6c519af899c2582494bbbd571bf2b0fb3940ce 100644 (file)
@@ -23,16 +23,21 @@ pve-ha-crm.1.pod: pve-ha-crm
 pve-ha-lrm.1.pod: pve-ha-lrm
        perl -I. ./pve-ha-lrm printmanpod >$@
 
+ha-manager.1.pod: ha-manager
+       perl -I. ./ha-manager printmanpod >$@
+
 watchdog-mux: watchdog-mux.c
        gcc watchdog-mux.c -o watchdog-mux -Wall -Wl,-z,relro $$(pkg-config --libs --cflags libsystemd-daemon)
 
 .PHONY: install
-install: watchdog-mux pve-ha-crm pve-ha-lrm pve-ha-crm.1.pod pve-ha-crm.1.gz pve-ha-lrm.1.pod pve-ha-lrm.1.gz
+install: watchdog-mux pve-ha-crm pve-ha-lrm ha-manager.1.pod ha-manager.1.gz pve-ha-crm.1.pod pve-ha-crm.1.gz pve-ha-lrm.1.pod pve-ha-lrm.1.gz
        perl -I. ./pve-ha-crm verifyapi
        perl -I. ./pve-ha-lrm verifyapi
+       perl -I. ./ha-manager verifyapi
        install -d ${DESTDIR}${SBINDIR}
        install -m 0755 pve-ha-crm ${DESTDIR}${SBINDIR}
        install -m 0755 pve-ha-lrm ${DESTDIR}${SBINDIR}
+       install -m 0755 ha-manager ${DESTDIR}${SBINDIR}
        install -m 0755 watchdog-mux ${DESTDIR}${SBINDIR}
        make -C PVE install
        install -d ${DESTDIR}/usr/share/man/man1
@@ -41,6 +46,8 @@ install: watchdog-mux pve-ha-crm pve-ha-lrm pve-ha-crm.1.pod pve-ha-crm.1.gz pve
        install -m 0644 pve-ha-crm.1.pod ${DESTDIR}/${PODDIR}
        install -m 0644 pve-ha-lrm.1.gz ${DESTDIR}/usr/share/man/man1/
        install -m 0644 pve-ha-lrm.1.pod ${DESTDIR}/${PODDIR}
+       install -m 0644 ha-manager.1.gz ${DESTDIR}/usr/share/man/man1/
+       install -m 0644 ha-manager.1.pod ${DESTDIR}/${PODDIR}
 
 .PHONY: installsim
 installsim: pve-ha-simulator
diff --git a/src/ha-manager b/src/ha-manager
new file mode 100755 (executable)
index 0000000..b7e7eff
--- /dev/null
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use PVE::INotify;
+use PVE::JSONSchema;
+use PVE::CLIHandler;
+use PVE::Cluster;
+
+use base qw(PVE::CLIHandler);
+
+$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+$ENV{LC_ALL} = 'C';
+
+die "please run as root\n" if $> != 0;
+
+my $nodename = PVE::INotify::nodename();
+
+__PACKAGE__->register_method ({
+    name => 'test', 
+    path => 'test',
+    method => 'GET',
+    description => "A stupid test.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+       },
+    },
+    returns => { type => 'null' },
+    code => sub {
+       my ($param) = @_;
+
+       print "TEST\n";
+       
+       return undef;
+    }});
+
+my $cmddef = {
+    test => [ __PACKAGE__, 'test', []],
+};
+my $cmd = shift;
+
+if ($cmd && $cmd ne 'printmanpod' && $cmd ne 'verifyapi') {
+    PVE::Cluster::check_cfs_is_mounted();
+    PVE::Cluster::cfs_update();
+}
+
+PVE::CLIHandler::handle_cmd($cmddef, "ha-manager", $cmd, \@ARGV, undef, $0);
+
+exit 0;
+
+__END__
+
+=head1 NAME
+
+pvecm - Proxmox VE HA Command Line Interface
+
+=head1 SYNOPSIS
+
+=include synopsis
+
+=head1 DESCRIPTION
+
+ha-manager is a program to manage the HA configuration.
+
+=include pve_copyright
+
+