From nobody Sun Feb 8 19:02:57 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=1600356278; cv=none; d=zohomail.com; s=zohoarc; b=PXIOubMGgstermgDhz8wS4weHqXuvMA/6wPYdX7FmmAn2hfsjjrpQnkqpajn84cR3j8mlS1Ma68wrOrAzRea6ERvIyY4IAuaa7icjhFYuBO6pdng9zdy2uS2rb8/eAU85fvLFaUK0V3DooaDfIfF3cDy75h6ucn9CYscboDzZhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600356278; 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=NB9dv3wKz5Kus0z+LQGf4GWtXzutV9PHP+pJfHqcRPY=; b=CoH1GKRVhdxmL1vwm42cMxZhE3GFIjBmyfBMwi67uv2u7wBCt2qGDVrEtQZXLVj3v09d+9NlVShiFIh57EP3Gs6E4LC7cvsAIN9NLa1TBXUENdLHnMEqUlCIk+QOUoGJJjY6CBDGH5761OwsiBJ6u8xo2fWvdh2hi60RTeVuKNg= 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 1600356278349362.49868319257916; Thu, 17 Sep 2020 08:24:38 -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-256-i4cWKrPsPt2knN2pmtHnsg-1; Thu, 17 Sep 2020 11:24:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 128708BF149; Thu, 17 Sep 2020 15:24:28 +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 E245560CC0; Thu, 17 Sep 2020 15:24:27 +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 ADEC9183D041; Thu, 17 Sep 2020 15:24:27 +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 08HFORl5017895 for ; Thu, 17 Sep 2020 11:24:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15F7E1F2; Thu, 17 Sep 2020 15:24:27 +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 7029360CC0; Thu, 17 Sep 2020 15:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600356277; 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=NB9dv3wKz5Kus0z+LQGf4GWtXzutV9PHP+pJfHqcRPY=; b=f5VfhJga7r2SCu1B4B3P3zVNXCjIwCkU3yitqcpRbPOK/hr2y+8eL7odwgwR2wbziqzKZG qkItoWt8u/hEkRCbOf54/rIZ1ZR6geAAtNqLunXIvyf+5MbTo839Wzr+5tPJDdAJSOP9SX vYPJkAit31f4b2ZDMbNII15OWe8EADY= X-MC-Unique: i4cWKrPsPt2knN2pmtHnsg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 9/9] Jailhouse driver: Add events to events queue in DomainCreate/Shutdown/Destroy Date: Thu, 17 Sep 2020 16:23:59 +0100 Message-Id: <20200917152359.1621763-10-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.12 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_dri= ver.c index 45b1f35896..70f0f365cb 100644 --- a/src/jailhouse/jailhouse_driver.c +++ b/src/jailhouse/jailhouse_driver.c @@ -122,6 +122,7 @@ jailhouseCreateAndLoadCells(virJailhouseDriverPtr drive= r) // Create all cells in the hypervisor. if (createJailhouseCells(driver->config->cell_config_dir) < 0) return -1; + // Get all cells created above. driver->cell_info_list =3D getJailhouseCellsInfo(); =20 @@ -137,6 +138,7 @@ jailhouseFreeDriver(virJailhouseDriverPtr driver) virMutexDestroy(&driver->lock); virObjectUnref(driver->xmlopt); virObjectUnref(driver->domains); + virObjectUnref(driver->domainEventState); virObjectUnref(driver->config); VIR_FREE(driver); } @@ -222,6 +224,9 @@ jailhouseStateInitialize(bool privileged G_GNUC_UNUSED, if (!(jailhouse_driver->domains =3D virDomainObjListNew())) goto error; =20 + if (!(jailhouse_driver->domainEventState =3D virObjectEventStateNew())) + goto error; + if (!(cfg =3D virJailhouseDriverConfigNew())) goto error; =20 @@ -476,6 +481,7 @@ jailhouseDomainCreateXML(virConnectPtr conn, virDomainDefPtr def =3D NULL; virDomainObjPtr cell =3D NULL; virJailhouseCellId cell_id; + virObjectEventPtr event =3D NULL; char **images =3D NULL; int num_images =3D 0, i =3D 0; unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE; @@ -573,12 +579,16 @@ jailhouseDomainCreateXML(virConnectPtr conn, =20 dom =3D virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def= ->id); =20 + event =3D virDomainEventLifecycleNewFromObj(cell, + VIR_DOMAIN_EVENT_STARTED, + VIR_DOMAIN_EVENT_STARTED_BOO= TED); cleanup: if (!dom && removeInactive && !cell->persistent) virDomainObjListRemove(driver->domains, cell); =20 virDomainDefFree(def); virDomainObjEndAPI(&cell); + virObjectEventStateQueue(driver->domainEventState, event); return dom; } =20 @@ -589,6 +599,7 @@ jailhouseDomainShutdownFlags(virDomainPtr domain, unsig= ned int flags) virJailhouseCellInfoPtr cell_info; virDomainObjPtr cell; virJailhouseCellId cell_id; + virObjectEventPtr event =3D NULL; int ret =3D -1; =20 virCheckFlags(0, -1); @@ -627,8 +638,12 @@ jailhouseDomainShutdownFlags(virDomainPtr domain, unsi= gned int flags) =20 ret =3D 0; =20 + event =3D virDomainEventLifecycleNewFromObj(cell, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHU= TDOWN); cleanup: virDomainObjEndAPI(&cell); + virObjectEventStateQueue(driver->domainEventState, event); return ret; } =20 @@ -644,6 +659,7 @@ jailhouseDomainDestroyFlags(virDomainPtr domain, unsign= ed int flags) virJailhouseDriverPtr driver =3D domain->conn->privateData; virJailhouseCellInfoPtr cell_info; virDomainObjPtr cell; + virObjectEventPtr event =3D NULL; int ret =3D -1; =20 virCheckFlags(0, -1); @@ -674,8 +690,12 @@ jailhouseDomainDestroyFlags(virDomainPtr domain, unsig= ned int flags) =20 ret =3D 0; =20 + event =3D virDomainEventLifecycleNewFromObj(cell, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_DES= TROYED); cleanup: virDomainObjEndAPI(&cell); + virObjectEventStateQueue(driver->domainEventState, event); return ret; } =20 --=20 2.26.2