mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-02 11:21:12 +00:00
2b4e353168
This exports 3 basic routines: - virHookInitialize() initializing the hook support by looking for scripts availability - virHookPresent() used to test if there is a hook for a given driver - virHookCall() which actually calls a synchronous script hook with the needed parameters Note that this doesn't expose any public API except for the locations and arguments passed to the scripts * src/Makefile.am: add the 2 new files * src/util/hooks.h src/util/hooks.c: implements the 3 functions * src/libvirt_private.syms: export the 3 symbols internally * po/POTFILES.in: add src/util/hooks.c to translatables modules
76 lines
2.4 KiB
C
76 lines
2.4 KiB
C
/*
|
|
* hook.h: internal entry points needed for synchronous hooks support
|
|
*
|
|
* Copyright (C) 2010 Red Hat, Inc.
|
|
* Copyright (C) 2010 Daniel Veillard
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* Author: Daniel Veillard <veillard@redhat.com>
|
|
*/
|
|
|
|
#ifndef __VIR_HOOKS_H__
|
|
# define __VIR_HOOKS_H__
|
|
|
|
# include "internal.h"
|
|
# include "util.h"
|
|
|
|
enum virHookDriverType {
|
|
VIR_HOOK_DRIVER_DAEMON = 0, /* Daemon related events */
|
|
VIR_HOOK_DRIVER_QEMU, /* QEmu domains related events */
|
|
VIR_HOOK_DRIVER_LXC, /* LXC domains related events */
|
|
|
|
VIR_HOOK_DRIVER_LAST,
|
|
};
|
|
|
|
enum virHookDaemonOpType {
|
|
VIR_HOOK_DAEMON_OP_START, /* daemon is about to start */
|
|
VIR_HOOK_DAEMON_OP_SHUTDOWN, /* daemon is about to shutdown */
|
|
VIR_HOOK_DAEMON_OP_RELOAD, /* driver reload with SIGHUP */
|
|
|
|
VIR_HOOK_DAEMON_OP_LAST,
|
|
};
|
|
|
|
enum virHookSubopType {
|
|
VIR_HOOK_SUBOP_NONE, /* no sub-operation */
|
|
VIR_HOOK_SUBOP_BEGIN, /* beginning of the operation */
|
|
VIR_HOOK_SUBOP_END, /* end of the operation */
|
|
|
|
VIR_HOOK_SUBOP_LAST,
|
|
};
|
|
|
|
enum virHookQemuOpType {
|
|
VIR_HOOK_QEMU_OP_START, /* domain is about to start */
|
|
VIR_HOOK_QEMU_OP_STOPPED, /* domain has stopped */
|
|
|
|
VIR_HOOK_QEMU_OP_LAST,
|
|
};
|
|
|
|
enum virHookLxcOpType {
|
|
VIR_HOOK_LXC_OP_START, /* domain is about to start */
|
|
VIR_HOOK_LXC_OP_STOPPED, /* domain has stopped */
|
|
|
|
VIR_HOOK_LXC_OP_LAST,
|
|
};
|
|
|
|
int virHookInitialize(void);
|
|
|
|
int virHookPresent(int driver);
|
|
|
|
int virHookCall(int driver, const char *id, int op, int sub_op,
|
|
const char *extra, const char *input);
|
|
|
|
#endif /* __VIR_HOOKS_H__ */
|