From ed12e2fbed3d4298ebff9da54fe56b91fa75c41e Mon Sep 17 00:00:00 2001 From: Jared Bents Date: Fri, 11 Jun 2021 09:07:32 -0500 Subject: [PATCH] package/libvirt: add lxc and qemu options Update to add lxc and qemu options for libvirt under the daemon config option Signed-off-by: Jared Bents Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- package/libvirt/Config.in | 28 +++++++++++++++++++++++++++ package/libvirt/libvirt.mk | 39 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/package/libvirt/Config.in b/package/libvirt/Config.in index deb1636c9f..1d17fc1621 100644 --- a/package/libvirt/Config.in +++ b/package/libvirt/Config.in @@ -56,4 +56,32 @@ config BR2_PACKAGE_LIBVIRT_DAEMON Build the libvirt daemon (libvirtd) otherwise build only the utility programs. +# Stateful drivers are useful only when building the daemon. +if BR2_PACKAGE_LIBVIRT_DAEMON + +config BR2_PACKAGE_LIBVIRT_QEMU + bool "qemu" + depends on BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS # libseccomp + depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET + select BR2_PACKAGE_HWDATA # libpciaccess + select BR2_PACKAGE_HWDATA_PCI_IDS # libpciaccess + select BR2_PACKAGE_LIBSECCOMP + select BR2_PACKAGE_QEMU + select BR2_PACKAGE_QEMU_SYSTEM if BR2_PACKAGE_QEMU_CUSTOM_TARGETS = "" + select BR2_PACKAGE_YAJL + help + QEMU/KVM support + +config BR2_PACKAGE_LIBVIRT_LXC + bool "lxc" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # lxc + select BR2_PACKAGE_LXC + help + Linux Container support + +comment "lxc needs a toolchain w/ gcc >= 4.7" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 + +endif + endif diff --git a/package/libvirt/libvirt.mk b/package/libvirt/libvirt.mk index a8099c936a..eeedfbdc51 100644 --- a/package/libvirt/libvirt.mk +++ b/package/libvirt/libvirt.mk @@ -24,9 +24,7 @@ LIBVIRT_CONF_OPTS = \ -Ddriver_hyperv=disabled \ -Ddriver_interface=enabled \ -Ddriver_libxl=disabled \ - -Ddriver_lxc=disabled \ -Ddriver_openvz=disabled \ - -Ddriver_qemu=disabled \ -Ddriver_remote=enabled \ -Ddriver_secrets=enabled \ -Ddriver_vbox=disabled \ @@ -193,6 +191,19 @@ else LIBVIRT_CONF_OPTS += -Dssh2=disabled endif +ifeq ($(BR2_PACKAGE_LIBVIRT_LXC),y) +LIBVIRT_CONF_OPTS += -Dlogin_shell=enabled -Ddriver_lxc=enabled +LIBVIRT_DEPENDENCIES += lxc +else +LIBVIRT_CONF_OPTS += -Dlogin_shell=disabled -Ddriver_lxc=disabled +endif + +ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y) +LIBVIRT_CONF_OPTS += -Ddriver_qemu=enabled -Dqemu_user=qemu -Dqemu_group=kvm +else +LIBVIRT_CONF_OPTS += -Ddriver_qemu=disabled -Dqemu_user=no -Dqemu_group=no +endif + else # BR2_PACKAGE_LIBVIRT_DAEMON LIBVIRT_CONF_OPTS += -Dlibvirtd=disabled -Ddriver_network=disabled @@ -218,13 +229,29 @@ define LIBVIRT_PERMISSIONS /var/lib/libvirt/filesystems d 711 root root - - - - - /var/lib/libvirt/images d 711 root root - - - - - /var/lib/libvirt/network d 700 root root - - - - - + /var/lib/libvirt/qemu d 751 qemu kvm - - - - - + /var/lib/libvirt/qemu/autostart d 700 root root - - - - - + /var/lib/libvirt/qemu/networks d 700 root root - - - - - + /var/lib/libvirt/qemu/networks/autostart d 700 root root - - - - - + /var/lib/libvirt/qemu/channel d 755 qemu kvm - - - - - + /var/lib/libvirt/qemu/channel/target d 755 qemu kvm - - - - - + /var/lib/libvirt/qemu/dump d 755 qemu kvm - - - - - + /var/lib/libvirt/qemu/nvram d 755 qemu kvm - - - - - + /var/lib/libvirt/qemu/save d 755 qemu kvm - - - - - + /var/lib/libvirt/qemu/snapshot d 755 qemu kvm - - - - - /var/lib/libvirt/secrets d 700 root root - - - - - /var/lib/libvirt/storage d 755 root root - - - - - /var/lib/libvirt/storage/autostart d 755 root root - - - - - /var/cache/libvirt d 711 root root - - - - - + /var/cache/libvirt/lxc d 750 root root - - - - - + /var/cache/libvirt/qemu d 750 qemu kvm - - - - - + /var/cache/libvirt/qemu/capabilities d 755 root root - - - - - /var/log/libvirt d 700 root root - - - - - + /var/log/libvirt/lxc d 750 root root - - - - - + /var/log/libvirt/qemu d 750 root root - - - - - /var/log/swtpm d 755 root root - - - - - /var/log/swtpm/libvirt d 755 root root - - - - - + /var/log/swtpm/libvirt/qemu d 711 root root - - - - - endef # libvirt may need to create persistent files (e.g. VM definitions) in these @@ -235,14 +262,22 @@ endef define LIBVIRT_CREATE_SYMLINKS $(INSTALL) -m 700 -d $(TARGET_DIR)/etc/libvirt $(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt + $(INSTALL) -m 751 -d $(TARGET_DIR)/var/lib/libvirt/qemu $(INSTALL) -m 700 -d $(TARGET_DIR)/var/lib/libvirt/secrets $(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt/storage + ln -s -f ../../var/lib/libvirt/qemu $(TARGET_DIR)/etc/libvirt/ ln -s -f ../../var/lib/libvirt/secrets $(TARGET_DIR)/etc/libvirt/ ln -s -f ../../var/lib/libvirt/storage $(TARGET_DIR)/etc/libvirt/ endef LIBVIRT_PRE_INSTALL_TARGET_HOOKS += LIBVIRT_CREATE_SYMLINKS +ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y) +define LIBVIRT_USERS + qemu -1 kvm -1 * - - - Libvirt qemu/kvm daemon +endef +endif + ifeq ($(BR2_PACKAGE_LIBVIRT_DAEMON),y) define LIBVIRT_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 package/libvirt/S91virtlogd $(TARGET_DIR)/etc/init.d/S91virtlogd -- 2.30.2