From nobody Sun Feb 8 18:18:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594893882; cv=none; d=zohomail.com; s=zohoarc; b=IedGmQZAqtgYg4+db/FoIHJzrWUXvxPtCbN/jpIKcmme4rw6k3GTFCiC6nOmqakK7jKBXxHDqKWE54qEd4xMoesOJLeaDRkizqv5J626w2m8f7HC8oFkleqTV/E5dVMCp1+maYCTL3JPN7Aa7By+A1+zJeWYHs/4H3V7vCwrCYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594893882; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/hkNah80EyOA9vF96JixOvIO+23QJ73fQGwAHi301+Q=; b=bwgRo9p4Q/a1irCxBFPj0umzrwF643jxPaWAYVgyWMFwf0Vb4LAjepe2L6EWRmYhfNVtSBkFGaJDaNPXiziKq1etqvlrkGO5HcXMsH3Kb4bCgR9dpaBBvUmI2m8Qx2B7EWmEXtdZt3ZKVStScMLr/YW4LfxsWCYPQb2SK9sGKsk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594893882128460.5030418032111; Thu, 16 Jul 2020 03:04:42 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-100-PextAPLpPwSFPU5TO84-HQ-1; Thu, 16 Jul 2020 06:03:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0894252A24; Thu, 16 Jul 2020 10:02:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE29972AE7; Thu, 16 Jul 2020 10:02:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AC21696237; Thu, 16 Jul 2020 10:02:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06GA2jpf016654 for ; Thu, 16 Jul 2020 06:02:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 344B12B6E2; Thu, 16 Jul 2020 10:02:45 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id A30DA2B6DB for ; Thu, 16 Jul 2020 10:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594893881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/hkNah80EyOA9vF96JixOvIO+23QJ73fQGwAHi301+Q=; b=BwVhTtzp0Rm43Gyjn+DirQiuz9VeCcewyJXord/Mt9DHI4jDgpepOWavdFPngFfYwRwod0 LBtKDOMYjEWLNYJLqrVggCzR1PVBbzNPZ1eNJ5j7QSkwfWOjviYrRtq6vXTFNwJWSWfzCg DvY80SKF8hWlJ2u/mfX+ik7aCdZB4ss= X-MC-Unique: PextAPLpPwSFPU5TO84-HQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 086/351] meson: add LXC driver build option Date: Thu, 16 Jul 2020 11:55:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- configure.ac | 8 ----- m4/virt-driver-lxc.m4 | 74 ------------------------------------------- meson.build | 34 ++++++++++++++++++++ meson_options.txt | 1 + 4 files changed, 35 insertions(+), 82 deletions(-) delete mode 100644 m4/virt-driver-lxc.m4 diff --git a/configure.ac b/configure.ac index 4725050080f..3139b41a36a 100644 --- a/configure.ac +++ b/configure.ac @@ -74,10 +74,6 @@ case $host in esac =20 if test $with_linux =3D no; then - if test "x$with_lxc" !=3D xyes - then - with_lxc=3Dno - fi with_dtrace=3Dno with_storage_scsi=3Dno fi @@ -90,7 +86,6 @@ AM_CONDITIONAL([WITH_MACOS], [test "$with_macos" =3D "yes= "]) # Stateful drivers are useful only when building the daemon. if test "$with_libvirtd" =3D "no" ; then with_qemu=3Dno - with_lxc=3Dno with_vbox=3Dno fi =20 @@ -112,7 +107,6 @@ LIBVIRT_DRIVER_ARG_QEMU LIBVIRT_DRIVER_ARG_OPENVZ LIBVIRT_DRIVER_ARG_VMWARE LIBVIRT_DRIVER_ARG_VBOX -LIBVIRT_DRIVER_ARG_LXC LIBVIRT_DRIVER_ARG_VZ LIBVIRT_DRIVER_ARG_TEST LIBVIRT_DRIVER_ARG_NETWORK @@ -122,7 +116,6 @@ LIBVIRT_DRIVER_CHECK_QEMU LIBVIRT_DRIVER_CHECK_OPENVZ LIBVIRT_DRIVER_CHECK_VMWARE LIBVIRT_DRIVER_CHECK_VBOX -LIBVIRT_DRIVER_CHECK_LXC LIBVIRT_DRIVER_CHECK_VZ LIBVIRT_DRIVER_CHECK_TEST LIBVIRT_DRIVER_CHECK_NETWORK @@ -324,7 +317,6 @@ LIBVIRT_DRIVER_RESULT_QEMU LIBVIRT_DRIVER_RESULT_OPENVZ LIBVIRT_DRIVER_RESULT_VMWARE LIBVIRT_DRIVER_RESULT_VBOX -LIBVIRT_DRIVER_RESULT_LXC LIBVIRT_DRIVER_RESULT_VZ LIBVIRT_DRIVER_RESULT_TEST LIBVIRT_DRIVER_RESULT_NETWORK diff --git a/m4/virt-driver-lxc.m4 b/m4/virt-driver-lxc.m4 deleted file mode 100644 index d2951b596a6..00000000000 --- a/m4/virt-driver-lxc.m4 +++ /dev/null @@ -1,74 +0,0 @@ -dnl The LXC driver -dnl -dnl Copyright (C) 2016 Red Hat, Inc. -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License, or (at your option) any later version. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see -dnl . -dnl - -AC_DEFUN([LIBVIRT_DRIVER_ARG_LXC], [ - LIBVIRT_ARG_WITH_FEATURE([LXC], [Linux Container], [check]) -]) - -AC_DEFUN([LIBVIRT_DRIVER_CHECK_LXC], [ - if test "$with_libvirtd" =3D "no" ; then - with_lxc=3Dno - fi - - if test "$with_lxc" =3D "yes" || test "$with_lxc" =3D "check"; then - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - #include - #include - #include - ]], [[ - unshare(!(LO_FLAGS_AUTOCLEAR + EPOLL_CLOEXEC)); - ]]) - ], [ - with_lxc=3Dyes - AC_DEFINE([HAVE_DECL_LO_FLAGS_AUTOCLEAR], [1], - [Define to 1 if you have the declaration of `LO_FLAGS_AUTOCLEAR', - and to 0 if you don't.]) - ], [ - if test "$with_lxc" =3D "check"; then - with_lxc=3Dno - AC_MSG_NOTICE([Required kernel features were not found, disabling = LXC]) - else - AC_MSG_ERROR([Required kernel features for LXC were not found]) - fi - ]) - - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - #include - #include - #include - ]], [[ - unshare(!(LOOP_CTL_GET_FREE)); - ]]) - ], [ - AC_DEFINE([HAVE_DECL_LOOP_CTL_GET_FREE], [1], - [Define to 1 if you have the declaration of `LOOP_CTL_GET_FREE', - and to 0 if you don't.]) - ]) - fi - if test "$with_lxc" =3D "yes" ; then - AC_DEFINE_UNQUOTED([WITH_LXC], 1, [whether LXC driver is enabled]) - fi - AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" =3D "yes"]) -]) - -AC_DEFUN([LIBVIRT_DRIVER_RESULT_LXC], [ - LIBVIRT_RESULT([LXC], [$with_lxc]) -]) diff --git a/meson.build b/meson.build index 813da0ff79e..2ed93e857d0 100644 --- a/meson.build +++ b/meson.build @@ -1650,6 +1650,39 @@ elif get_option('driver_libxl').enabled() error('libvirtd is required for libxenlight') endif =20 +if not get_option('driver_lxc').disabled() and host_machine.system() =3D= =3D 'linux' and conf.has('WITH_LIBVIRTD') + lxc_support_code =3D ''' +#include +#include +#include + +void main(void) { + unshare(!(LO_FLAGS_AUTOCLEAR + EPOLL_CLOEXEC)); +} + ''' + if cc.compiles(lxc_support_code, name: 'lxc support', args: '-D_GNU_SOUR= CE') + conf.set('WITH_LXC', 1) + conf.set('HAVE_DECL_LO_FLAGS_AUTOCLEAR', 1) + elif get_option('driver_lxc').enabled() + error('Required kernel features for LXC were not found') + endif + + lxc_get_free_code =3D ''' +#include +#include +#include + +void main(void) { + unshare(!(LOOP_CTL_GET_FREE)); +} + ''' + if cc.compiles(lxc_get_free_code) + conf.set('HAVE_DECL_LOOP_CTL_GET_FREE', 1) + endif +elif get_option('driver_lxc').enabled() + error('linux and remote_driver are required for LXC') +endif + =20 # define top include directory =20 @@ -1671,6 +1704,7 @@ configure_file(output: 'meson-config.h', configuratio= n: conf) =20 driver_summary =3D { 'libxl': conf.has('WITH_LIBXL'), + 'LXC': conf.has('WITH_LXC'), 'ESX': conf.has('WITH_ESX'), 'Hyper-V': conf.has('WITH_HYPERV'), 'Bhyve': conf.has('WITH_BHYVE'), diff --git a/meson_options.txt b/meson_options.txt index 5329fd4cd05..ccc0a209378 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -52,5 +52,6 @@ option('driver_esx', type: 'feature', value: 'enabled', d= escription: 'esx driver option('driver_hyperv', type: 'feature', value: 'auto', description: 'Hype= r-V driver') option('driver_libvirtd', type: 'feature', value: 'auto', description: 'li= bvirtd driver') option('driver_libxl', type: 'feature', value: 'auto', description: 'libxe= nlight driver') +option('driver_lxc', type: 'feature', value: 'auto', description: 'Linux C= ontainer driver') option('driver_remote', type: 'feature', value: 'enabled', description: 'r= emote driver') option('remote_default_mode', type: 'combo', choices: ['legacy', 'direct']= , value: 'legacy', description: 'remote driver default mode') --=20 2.26.2