From nobody Sun Dec 22 03:20:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734042690335640.6896575437529; Thu, 12 Dec 2024 14:31:30 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0B39DD77; Thu, 12 Dec 2024 17:31:29 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AFF6BC85; Thu, 12 Dec 2024 17:31:11 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 522B0C7D; Thu, 12 Dec 2024 17:31:08 -0500 (EST) Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 69E35C6C for ; Thu, 12 Dec 2024 17:31:07 -0500 (EST) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-29f88004a92so645903fac.1 for ; Thu, 12 Dec 2024 14:31:07 -0800 (PST) Received: from home.. ([2603:8081:c640:1::1005]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29fdaa80a88sm2441590fac.54.2024.12.12.14.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 14:31:05 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734042666; x=1734647466; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XwVMm+3qUDsM1g72yiDxn5MtruvEtdYNcARdjSwkK2U=; b=b1F9q6mjD4TdJ0SvvrFPLISPuTiGcOkaeRf5c4U6xIAuEsI8M/dN42WGivfuZv7kgG +qj8NHgG3OnO5KBrM609aGJGOXYSSyBA7oOmfeNvloKEIsu4cwIM1m56D3QPnFnO/GSa 9NCRbdxV0MNdvf/s1QtwloFuqvIfJqWTyBcG099+rpkmWrVSUtu56Ti1WArpIj4REDoL 5hvCcqBQUzRZ2rDRM833V0pIL29j87MqDDkoQ+1NqLTKLi0o8QT88f3rUdd/lA2bi63i s6ZbIXAkpYNQfLB2S6yYC7C86t7OszIyJ2IILLx1ADuRG9QRV4gZr/FIh8ahTbfcpDAz uYQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734042666; x=1734647466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XwVMm+3qUDsM1g72yiDxn5MtruvEtdYNcARdjSwkK2U=; b=YFphXcxgYz/1C6pxeHHDbFjbEYWcJV/QArgkFIyQgUf1KATHW56TsFlMViMkE45OUS 4U8XoqTFDW4dtnLp0lAAAN7RP4jcHVdHLzUJTZ6qwbJ8ad5VKQ6C6b0oP30wq2k7VEmt X9Q06QnPbTJ/H6UE0EbdmiM2L6OUmZwWAtEvoLCHV5YlrsiSa73aV7zCHwzYQJ8XfrdK YJct60aCLttuz4BjLahBcmqVuNZVGPgHRUEw2txgzKhA/K8DaCY3ibXoX3POqTn6HmQd pS+JM2L/RXUkKD7BG77sTrJtWSaDW2OcACpfFLHgbaBSMCWRQ8qfqg/7a7pbmFtWbsP8 s5Ew== X-Gm-Message-State: AOJu0YwHPeDWMkq6lI/gDquTFSaV1lmvODfC1Gh3X4bY3Oxn0Kv34oYt aMkgDBpU9X2A+VmY1FVVGjwwHPaxQp2u4pEbX4sFY0jSEkFqtgzcFdb8Cqzg X-Gm-Gg: ASbGnctlRxGKOgsm+BlKOSjOvjrlGY5v40lbYVK+aoD++Jor1TRRYrg1CfuPNUYMxOh 2p/tr17p1bUM65ePJGGHn2aP7XxyfdwKT8NHAvCp30gmvGb9DTjUCY1JGm3+g+7KN/P4c4SS2VL bGW5gHnUlt1cevOHcsNZ+kaf0NEdNCPmHHp8PTKewC5b2CRUZ0kfXYdtowD+WBrKLA2AkoQzZCy /RBg1k/u8gjmKoQr6/uA8BgO4i4ByIjS+2EW3E5 X-Google-Smtp-Source: AGHT+IE/8cp+K7wUC4K/YD7LsEA6wDS4WzclF9brCCM6gkiEPyjrN7SfHESSRUEjddaJuqSgIOFm3g== X-Received: by 2002:a05:6870:4708:b0:29e:7a01:fa1f with SMTP id 586e51a60fabf-2a3ac8be204mr238986fac.41.1734042666018; Thu, 12 Dec 2024 14:31:06 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH] ch: implement domainInterfaceAddresses Date: Thu, 12 Dec 2024 16:31:04 -0600 Message-ID: <20241212223104.31085-1-praveenkpaladugu@gmail.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: X35ZP2FRT65MWTLWEYJQ72EJRCYHBHIB X-Message-ID-Hash: X35ZP2FRT65MWTLWEYJQ72EJRCYHBHIB X-MailFrom: praveenkpaladugu@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734042693113116600 Content-Type: text/plain; charset="utf-8" From: Anirudh Rayabharam Implement domainInterfaceAddresses for the Cloud Hypervisor driver. Support VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE and VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP sources. Implementation is similar to other drivers. Signed-off-by: Anirudh Rayabharam Signed-off-by: Praveen K Paladugu --- src/ch/ch_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 6a8da5f356..d284524337 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -2298,6 +2298,47 @@ chConnectDomainEventDeregisterAny(virConnectPtr conn, return 0; } =20 +static int +chDomainInterfaceAddresses(virDomain *dom, + virDomainInterfacePtr **ifaces, + unsigned int source, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D virCHDomainObjFromDomain(dom))) + goto cleanup; + + if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def, source) <= 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, + _("Unsupported IP address data source %1$d"), + source); + break; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + =20 /* Function Tables */ static virHypervisorDriver chHypervisorDriver =3D { @@ -2316,6 +2357,7 @@ static virHypervisorDriver chHypervisorDriver =3D { .domainCreateXML =3D chDomainCreateXML, /* 7.5.0 */ .domainCreate =3D chDomainCreate, /* 7.5.0 */ .domainCreateWithFlags =3D chDomainCreateWithFlags, /* 7.5.0 */ + .domainInterfaceAddresses =3D chDomainInterfaceAddresses, /* 10.10.1 */ .domainShutdown =3D chDomainShutdown, /* 7.5.0 */ .domainShutdownFlags =3D chDomainShutdownFlags, /* 7.5.0 */ .domainReboot =3D chDomainReboot, /* 7.5.0 */ --=20 2.47.0