From nobody Mon Feb 9 13:57:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1579577878; cv=none; d=zohomail.com; s=zohoarc; b=DFekzuv2Ih0ICfkp0S1evX4R2E+lhOKjqwTU83/2Dqm8TiXIp3/0RQIKs8HWdcskhF96gHp+pee2vgVmjxhWR6ku1Zjowv1PD83IGQAkBc0HfUko477dFmka3sQNqBUZgoXOE2pV8oA95kCs5t9XwJMVwQW+93bBHDVtYKhsQTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579577878; 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=/ZAYfS5LmltKfV84MqxPsDMV/NXqwDNjPsqqR2UQTyY=; b=EH4RIh9dh10EPG+LaVORk2Q12JP+r5/XfAS9CzYl46SFm41DVteH1MlklwJfgwqVaPIQdlm04BUaLkwiIQuo0/STJmgmJB4XA/LdV3riXc9d3IXknHURaeyP8yyYOQv5qgUsY7LKiQ/MKlz8Wc2r2+6pakZsHkE9KcZzdi+n1Mg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1579577878892171.93963748281442; Mon, 20 Jan 2020 19:37:58 -0800 (PST) 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-317-2rAtcLfYNHutE4IyEMrSVw-1; Mon, 20 Jan 2020 22:37:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 625A210054E3; Tue, 21 Jan 2020 03:37:50 +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 21A5D5D9E1; Tue, 21 Jan 2020 03:37:50 +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 6FD6681984; Tue, 21 Jan 2020 03:37:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00L3blIH029108 for ; Mon, 20 Jan 2020 22:37:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2C54910BE391; Tue, 21 Jan 2020 03:37:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2789410BE390 for ; Tue, 21 Jan 2020 03:37:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0959885A320 for ; Tue, 21 Jan 2020 03:37:47 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-xzaQqLjZMjOtEW_Qquf6YQ-1; Mon, 20 Jan 2020 22:37:43 -0500 Received: by mail-qk1-f194.google.com with SMTP id a203so1413583qkc.3 for ; Mon, 20 Jan 2020 19:37:43 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7cb:f18:1999:d682:4c95:e72e]) by smtp.gmail.com with ESMTPSA id k88sm18532568qte.32.2020.01.20.19.37.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 19:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579577877; 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=/ZAYfS5LmltKfV84MqxPsDMV/NXqwDNjPsqqR2UQTyY=; b=iROV7B4OkquC9etceo7pkDvx/WkxH2zvKelGuEtZuaqPFu1PhvNMxTYucsIX9KjfeVgEpg AxDcRFIzv6c1Y5lec6KXLw9XOMSICioZwQ/9aq8JYNaX8HC3MndYwE5h7SyaiwuRsmgiOp 8yueAwnvTpFQZv0eoUyI8P1Vsz5gUg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gm/pBPO1qsgBCbpqFgfCz05RLCVeBMNSb3/nh4erZmg=; b=b/uw50uBmYa4Bi2YUixaw+5+z/H2PQcyzg+OmPROKHEH5H3z0kSh4C1zDJ+BrIUGEi ZG0Toy/snvmYcBW9Xjof8d6ULF9BHwzsdzWXgBgP42uvhdBFeW1mKNxQKjM5D0KNcTzz alVpqklGwxqSGU86bFYGxzlINhv87iU41RgLqf6hInqXsfBq493dpYReURiU12nXM4yY s9ixe2xnPqOCrsy2lqBkAzAILwlthKmOyr5EMg81tD4PAih3uK1EdtH+gqln3/y7j8jO JEAS6wuI3Qyub+iqfpirUyQuKNSFjugSl1BnTiVyaWuZeS8Pck8K8S1kE3P2MmGrj9i/ NdmQ== X-Gm-Message-State: APjAAAV9PMHJxPVKnaOOpzMn8tj/RaJ/SVz3lqzzpWFZQ0PL/dz/KGK9 1ItPxwHaNUG7m+RtZIZsuboJ7bMw X-Google-Smtp-Source: APXvYqwaIKmJn2IaYAxgWzd7HhDe+DwlDa0TjhTDKT1MDjNbasTLXWHCnv922mr8pFSpYwwWTlQuDQ== X-Received: by 2002:ae9:ea08:: with SMTP id f8mr2529980qkg.489.1579577862812; Mon, 20 Jan 2020 19:37:42 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH 2/2] lxc: Add support to lxcDomainInterfaceAddresses() function Date: Tue, 21 Jan 2020 00:37:11 -0300 Message-Id: <20200121033710.15548-3-jcfaracco@gmail.com> In-Reply-To: <20200121033710.15548-1-jcfaracco@gmail.com> References: <20200121033710.15548-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: xzaQqLjZMjOtEW_Qquf6YQ-1 X-MC-Unique: 2rAtcLfYNHutE4IyEMrSVw-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 00L3blIH029108 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.14 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" LXC driver is not able to retrieve IP addresses from domains. This function was not implemented yet. It can be done using DHCP lease and ARP table. Different from QEMU, LXC does not have an agent to fetch this info, but other sources can be used. Signed-off-by: Julio Faracco --- src/lxc/lxc_driver.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index bf1f8f8190..62bf2f8e85 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1740,6 +1740,49 @@ static int lxcConnectGetVersion(virConnectPtr conn, = unsigned long *version) } =20 =20 +static int +lxcDomainInterfaceAddresses(virDomainPtr dom, + virDomainInterfacePtr **ifaces, + unsigned int source, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT, -1); + + if (!(vm =3D lxcDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + switch (source) { + case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE: + ret =3D virDomainNetDHCPInterfaces(vm->def, ifaces); + break; + + case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP: + ret =3D virDomainNetARPInterfaces(vm->def, ifaces); + break; + + default: + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, + _("Unknown IP address data source %d"), + source); + break; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + + static char *lxcConnectGetHostname(virConnectPtr conn) { if (virConnectGetHostnameEnsureACL(conn) < 0) @@ -5515,6 +5558,7 @@ static virHypervisorDriver lxcHypervisorDriver =3D { .domainGetMetadata =3D lxcDomainGetMetadata, /* 1.1.3 */ .domainGetCPUStats =3D lxcDomainGetCPUStats, /* 1.2.2 */ .domainGetHostname =3D lxcDomainGetHostname, /* 6.0.0 */ + .domainInterfaceAddresses =3D lxcDomainInterfaceAddresses, /* 6.1.0 */ .nodeGetMemoryParameters =3D lxcNodeGetMemoryParameters, /* 0.10.2 */ .nodeSetMemoryParameters =3D lxcNodeSetMemoryParameters, /* 0.10.2 */ .domainSendProcessSignal =3D lxcDomainSendProcessSignal, /* 1.0.1 */ --=20 2.20.1