[RFC PATCH v1 2/4] Register cpu hotplug netlink handler for libvirtd.

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

 



Signed-off-by: Tang Chen <tangchen@xxxxxxxxxxxxxx>
---
 daemon/libvirtd.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 19dd26b..e71cd79 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -56,6 +56,8 @@
 #include "uuid.h"
 #include "viraudit.h"
 #include "locking/lock_manager.h"
+#include "hotplug.h"
+#include "cgroup.h"
 
 #ifdef WITH_DRIVER_MODULES
 # include "driver.h"
@@ -948,6 +950,7 @@ int main(int argc, char **argv) {
     bool implicit_conf = false;
     char *run_dir = NULL;
     mode_t old_umask;
+    virCgroupPtr rootgrp = NULL;
 
     struct option opts[] = {
         { "verbose", no_argument, &verbose, 1},
@@ -1324,6 +1327,13 @@ int main(int argc, char **argv) {
         goto cleanup;
     }
 
+    /* Register cpu hotplug netlink handler for libvirtd */
+    if (virCgroupAppRoot(privileged, &rootgrp, 0) != 0 ||
+        virCpuHotplugRegisterCallback(rootgrp) < 0) {
+        ret = VIR_DAEMON_ERR_NETWORK;
+        goto cleanup;
+    }
+
     /* Run event loop. */
     virNetServerRun(srv);
 
@@ -1352,6 +1362,7 @@ cleanup:
     if (pid_file_fd != -1)
         virPidFileReleasePath(pid_file, pid_file_fd);
 
+    virCgroupFree(&rootgrp);
     VIR_FREE(sock_file);
     VIR_FREE(sock_file_ro);
     VIR_FREE(pid_file);
-- 
1.7.10.1

--
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]