From nobody Sun Feb 8 13:10:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1600947956; cv=none; d=zohomail.com; s=zohoarc; b=XvYQwkShi2GpLdaRtiJNxtV2IgNuLJa33ZkJ6VKAtmHoy/exIyc+ZC49wV5zcOIdiqAXNOghK8iHQqjVfvTyEocwac5xUtww6Q6S1f4OsloJuNxXnrPSrJwIEIeQl2kvR9D795vTC6HFIoJTkCZLHy3sa5X4MzsYsvoHhvSGRN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600947956; 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=PucyvwKGL3vOS0EoZGyJNI4I7TKtVIwM+3AewHDuwyo=; b=XFRErf6FQ26uqhCBQ9DOdkyChpYTTvHOjX55MENHzE4ew3hh70L2OLw/GqNcl9NNZtGLKnVTd7WXyLImtBhADdy1wLoO860rShW7uwAaUTmwjq7c9lVhzgC2It/Agor1PAAAEoRQJX1baAa7fY2k5vg2qm+j0IEJu3vLzTQGZ40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1600947956338443.7702787413473; Thu, 24 Sep 2020 04:45:56 -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-297-gSG7LlhaMk-vPDHloFiLjg-1; Thu, 24 Sep 2020 07:45:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA98A64153; Thu, 24 Sep 2020 11:45:46 +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 CAA267366A; Thu, 24 Sep 2020 11:45:46 +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 960161826D2A; Thu, 24 Sep 2020 11:45:46 +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 08OBiDct009100 for ; Thu, 24 Sep 2020 07:44:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 930E360E1C; Thu, 24 Sep 2020 11:44:13 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9B6060C04; Thu, 24 Sep 2020 11:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600947955; 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=PucyvwKGL3vOS0EoZGyJNI4I7TKtVIwM+3AewHDuwyo=; b=XvPLfQDbgQB9c6TzlgwmMVCJB2eZnrOW2YMZe2jFIyY+BHG3FFX3k7HZPTD4d+NtoH4y/1 L0Akl3Qe/1Wh9qfLLKDs/wN0xknYC56G4rmpVJV0JMHieHVQeLuqIUflXVR1niIVG2zNjP OymlToUjCcfRm0jli2O5lFXjKX3QWjM= X-MC-Unique: gSG7LlhaMk-vPDHloFiLjg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v4 07/11] qemu: hotplug: Remove overlay of disk on disk unplug Date: Thu, 24 Sep 2020 13:43:54 +0200 Message-Id: <3a8405aa8ff510ef36e0bf50e6ea43dc065eaa63.1600947699.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Masayoshi Mizuma 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.13 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" Remove the overlay if the disk was . Note that even if we'd forbid unplug of such a disk through the API, the disk can still be ejected from the guest. Signed-off-by: Peter Krempa Tested-by: Masayoshi Mizuma --- src/qemu/qemu_hotplug.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index ed4d1580fa..11b549b12b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4313,6 +4313,15 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; + if (disk->transient) { + VIR_DEBUG("Removing transient overlay '%s' of disk '%s'", + disk->src->path, disk->dst); + if (qemuDomainStorageFileInit(driver, vm, disk->src, NULL) >=3D 0)= { + virStorageFileUnlink(disk->src); + virStorageFileDeinit(disk->src); + } + } + ret =3D 0; cleanup: --=20 2.26.2