[PATCH 4/7] kvmtool: Add hook support for kvmtool domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just like QEMU and LXC, kvm driver intends to support running hook
script before domain starting and after domain shutdown too.
---
 src/util/hooks.c |   11 ++++++++++-
 src/util/hooks.h |    8 ++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/src/util/hooks.c b/src/util/hooks.c
index 110a94b..765cb68 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -52,12 +52,14 @@ VIR_ENUM_DECL(virHookDaemonOp)
 VIR_ENUM_DECL(virHookSubop)
 VIR_ENUM_DECL(virHookQemuOp)
 VIR_ENUM_DECL(virHookLxcOp)
+VIR_ENUM_DECL(virHookKvmToolOp)
 
 VIR_ENUM_IMPL(virHookDriver,
               VIR_HOOK_DRIVER_LAST,
               "daemon",
               "qemu",
-              "lxc")
+              "lxc",
+              "kvmtool")
 
 VIR_ENUM_IMPL(virHookDaemonOp, VIR_HOOK_DAEMON_OP_LAST,
               "start",
@@ -79,6 +81,10 @@ VIR_ENUM_IMPL(virHookLxcOp, VIR_HOOK_LXC_OP_LAST,
               "start",
               "stopped")
 
+VIR_ENUM_IMPL(virHookKvmToolOp, VIR_HOOK_KVMTOOL_OP_LAST,
+              "start",
+              "stopped")
+
 static int virHooksFound = -1;
 
 /**
@@ -230,6 +236,9 @@ virHookCall(int driver, const char *id, int op, int sub_op, const char *extra,
         case VIR_HOOK_DRIVER_LXC:
             opstr = virHookLxcOpTypeToString(op);
             break;
+        case VIR_HOOK_DRIVER_KVMTOOL:
+            opstr = virHookKvmToolOpTypeToString(op);
+            break;
     }
     if (opstr == NULL) {
         virHookReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/util/hooks.h b/src/util/hooks.h
index fd7411c..69081c4 100644
--- a/src/util/hooks.h
+++ b/src/util/hooks.h
@@ -31,6 +31,7 @@ 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_KVMTOOL,           /* KVMTOOL domains related events */
 
     VIR_HOOK_DRIVER_LAST,
 };
@@ -67,6 +68,13 @@ enum virHookLxcOpType {
     VIR_HOOK_LXC_OP_LAST,
 };
 
+enum virHookKvmToolOpType {
+    VIR_HOOK_KVMTOOL_OP_START,            /* domain is about to start */
+    VIR_HOOK_KVMTOOL_OP_STOPPED,          /* domain has stopped */
+
+    VIR_HOOK_KVMTOOL_OP_LAST,
+};
+
 int virHookInitialize(void);
 
 int virHookPresent(int driver);
-- 
1.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]