From nobody Mon Feb 9 12:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1681919056; cv=none; d=zohomail.com; s=zohoarc; b=YTR1tysWuHeRLK87vtfihdpUTZFReithjn5sIEmahcgZefb6y3NBODTuRGLfDllHJaHeQb71zKUyt5nm1B1NQlRJBNN4TuSezVpPMxkAZaRh75eyu/HnjFCZCMdKgJc5b5QdRwG8tbfKujvPOrcUfuUtFmaSSGkZX11nXuwU+ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681919056; 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=oRJtRxooOBYnOoeaEouqYYfSCfkNVY6KYmTlceBDv7k=; b=StHkQVXAl39W0L/yBeM1xn7BBdJSaVEbIZWS7D/aAuDUdSdbtRELohklUBXZViBd/6R2+MSH6ADvhPvbSH0kRqqMQMzkc6BiTZ5sb2yUC94QSuBsWnG/wY05zju2Pha0scwyH2ojnifU7pwINxm3eJIdJXCpo4nmWnCXsjvA7bM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1681919056667598.2949523868654; Wed, 19 Apr 2023 08:44:16 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-527-2SURwSpAN32zzknTlI6Qew-1; Wed, 19 Apr 2023 11:44:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 752061C0E248; Wed, 19 Apr 2023 15:44:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F2282958; Wed, 19 Apr 2023 15:44:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 31CFB19465B1; Wed, 19 Apr 2023 15:44:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9181619465B2 for ; Wed, 19 Apr 2023 15:44:08 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 776CF40C2021; Wed, 19 Apr 2023 15:44:08 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA04040C2064 for ; Wed, 19 Apr 2023 15:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681919055; 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=oRJtRxooOBYnOoeaEouqYYfSCfkNVY6KYmTlceBDv7k=; b=R9nhnL/SxFww2H89CuHpXpCW3wxhqmX7PtC+xm0Y05ED9yBbyPc1FI44pqytM6zEslhlCk ID00wePRwkbTVVX16b7oa6Cwkmk54Vj/sYL25oh2P3kQru6lPtAtNM1+Hi1V+vGfdSu3ui HwWx8CsDijVCjsE6n77ouqo7aBEUndU= X-MC-Unique: 2SURwSpAN32zzknTlI6Qew-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/3] qemuProcessRefreshDisks: Extract update of a single disk Date: Wed, 19 Apr 2023 17:44:04 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681919057815100001 Content-Type: text/plain; charset="utf-8" Extract the logic to update one single disk (without emitting any events) so that it can be reused when updating the state after a disk hotplug. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 39 ++++++++++++++++++++++++--------------- src/qemu/qemu_process.h | 3 +++ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0dc49b87d8..7e7178ecec 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8673,6 +8673,29 @@ qemuProcessAutoDestroy(virDomainObj *dom, } +void +qemuProcessRefreshDiskProps(virDomainDiskDef *disk, + struct qemuDomainDiskInfo *info) +{ + qemuDomainDiskPrivate *diskpriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); + + if (info->removable) { + if (info->empty) + virDomainDiskEmptySource(disk); + + if (info->tray) { + if (info->tray_open) + disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_OPEN; + else + disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_CLOSED; + } + } + + diskpriv->removable =3D info->removable; + diskpriv->tray =3D info->tray; +} + + int qemuProcessRefreshDisks(virDomainObj *vm, virDomainAsyncJob asyncJob) @@ -8703,21 +8726,7 @@ qemuProcessRefreshDisks(virDomainObj *vm, if (!(info =3D virHashLookup(table, entryname))) continue; - if (info->removable) { - if (info->empty) - virDomainDiskEmptySource(disk); - - if (info->tray) { - if (info->tray_open) - disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_OPEN; - else - disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_CLOSED; - } - } - - /* fill in additional data */ - diskpriv->removable =3D info->removable; - diskpriv->tray =3D info->tray; + qemuProcessRefreshDiskProps(disk, info); if (diskpriv->tray && old_tray_status !=3D disk->tray_status) { diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index b171f0464c..f5c06c2915 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -235,3 +235,6 @@ bool qemuProcessRebootAllowed(const virDomainDef *def); void qemuProcessCleanupMigrationJob(virQEMUDriver *driver, virDomainObj *vm); + +void qemuProcessRefreshDiskProps(virDomainDiskDef *disk, + struct qemuDomainDiskInfo *info); --=20 2.39.2