From nobody Sun Feb 8 16:24:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1600356275; cv=none; d=zohomail.com; s=zohoarc; b=LLcaBEP0qEHd+5GV5+ubXSxqH3+poBZyu2gfF9q2mwZuC5KOAhqbQc47js+EsvsDvoZDPjR3NcsfUwEvk0AODboaWizvsOAlbB9tiQPRl+vFRt2VB6y8f6T3/X37FMS7r2jeoLTPWerjdNW4xVyhsyamB5hksD4iwuzp+1nzzS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600356275; h=Content-Type:Content-Transfer-Encoding:Cc: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=bD2yZ83WbeHmAfqshCaEFpL4rySNoqgjCVeQWdnT3P4=; b=VHixmeqmpc0HtrA/emOUI1uF8QZWxKpoM7tdlP8QX6U060HcupicCMNnPuLs3pcaekWUhDOHOyqJACVO0187FvLltO8jXFo54pdrcjc62DV1C7JK37B1trKeEcuqIiNJouy4V0tjT82ZHpxz8XcBrpPNy6+B1rZRc0cnE7tM8fQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1600356275961570.6163862638772; Thu, 17 Sep 2020 08:24:35 -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-158-R9rF5sD_OWmO7I298J3hfA-1; Thu, 17 Sep 2020 11:24:28 -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 765E180EDB0; Thu, 17 Sep 2020 15:24:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 516CC55766; Thu, 17 Sep 2020 15:24:23 +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 1A03A183D04E; Thu, 17 Sep 2020 15:24:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08HFOHw6017856 for ; Thu, 17 Sep 2020 11:24:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 552D1610F2; Thu, 17 Sep 2020 15:24:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-29.ams2.redhat.com [10.36.114.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABA52610F3; Thu, 17 Sep 2020 15:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600356274; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=bD2yZ83WbeHmAfqshCaEFpL4rySNoqgjCVeQWdnT3P4=; b=BUL3eI88bqYaqEErgQfsqXYlcWlH8JJBuOqUTNMEfGgTOCwNUSTJgDoBrilsrk7Kkj9p7f 1UV/NGxTZBVvppY+crM1Kwd6cd0lbLdrw+xcz7WgGbsg3KPin7wA+dgFFFgRuz184/WqJg HU24nYfyV/v/LhEETjbR9sTapgrc5DY= X-MC-Unique: R9rF5sD_OWmO7I298J3hfA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/9] Jailhouse driver: Implementation of DomainLookup* callbacks Date: Thu, 17 Sep 2020 16:23:56 +0100 Message-Id: <20200917152359.1621763-7-berrange@redhat.com> In-Reply-To: <20200917152359.1621763-1-berrange@redhat.com> References: <20200917152359.1621763-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Prakhar Bansal 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" From: Prakhar Bansal --- src/jailhouse/jailhouse_driver.c | 70 ++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_dri= ver.c index 2bb249f996..8c84a23388 100644 --- a/src/jailhouse/jailhouse_driver.c +++ b/src/jailhouse/jailhouse_driver.c @@ -292,25 +292,77 @@ jailhouseConnectListAllDomains(virConnectPtr conn, static virDomainPtr jailhouseDomainLookupByID(virConnectPtr conn, int id) { - UNUSED(conn); - UNUSED(id); - return NULL; +virJailhouseDriverPtr driver =3D conn->privateData; + virDomainObjPtr cell; + virDomainPtr dom =3D NULL; + + cell =3D virDomainObjListFindByID(driver->domains, id); + + if (!cell) { + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching ID '%d'"), id); + goto cleanup; + } + + if (virDomainLookupByIDEnsureACL(conn, cell->def) < 0) + goto cleanup; + + dom =3D virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def= ->id); + cleanup: + virDomainObjEndAPI(&cell); + return dom; } =20 static virDomainPtr jailhouseDomainLookupByName(virConnectPtr conn, const char *name) { - UNUSED(conn); - UNUSED(name); - return NULL; + virJailhouseDriverPtr driver =3D conn->privateData; + virDomainObjPtr cell; + virDomainPtr dom =3D NULL; + + cell =3D virDomainObjListFindByName(driver->domains, name); + + if (!cell) { + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching name '%s'"), name); + goto cleanup; + } + + if (virDomainLookupByNameEnsureACL(conn, cell->def) < 0) + goto cleanup; + + dom =3D virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def= ->id); + + cleanup: + virDomainObjEndAPI(&cell); + return dom; } =20 static virDomainPtr jailhouseDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { - UNUSED(conn); - UNUSED(uuid); - return NULL; + virJailhouseDriverPtr driver =3D conn->privateData; + virDomainObjPtr cell; + virDomainPtr dom =3D NULL; + + cell =3D virDomainObjListFindByUUID(driver->domains, uuid); + + if (!cell) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virUUIDFormat(uuid, uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching UUID '%s'"), uuidstr); + goto cleanup; + } + + if (virDomainLookupByUUIDEnsureACL(conn, cell->def) < 0) + goto cleanup; + + dom =3D virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def= ->id); + + cleanup: + virDomainObjEndAPI(&cell); + return dom; } =20 static virDomainObjPtr --=20 2.26.2