From nobody Mon Feb 9 00:56:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1585671921; cv=none; d=zohomail.com; s=zohoarc; b=bypbHc5+Lpzsf+l0PaYTI95wjoxfxX9Vn3vVS31OWXJaq276mwNA4eySn9atzcdBBiBMD9RaCyYC1CQZLwnn570R8YghfbXZ0ONUlhB6Zsw/Menp2D+oQwneM4bnkjZyVJG0rb8JduRkXg1DZPN9NxP5dYvPHeLCHVTP5Y7Q7lQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585671921; 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=xKWfwc76YtKTmEt3hyigP1WwkAAtlMJlDZnPMRbq/jo=; b=h8aHa+vsQHS5K1zXzxUAWpICvQURAIhoJaT6SiVdtuYHPigyBkg4dVWVc1oa17nDzCvszX3izitlukHEpEcw4i06hCParY2bbitUWfWkZW0u6bl5eOkMA1G0XpXhdGKGum8OLq4lH2mkVDiTtMN4iwqOjACwBHIj1hU/0oq3Fao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1585671921894885.8616167875331; Tue, 31 Mar 2020 09:25:21 -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-189-FxV53HzQPe6yBtsTHqGfSg-1; Tue, 31 Mar 2020 12:25:15 -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 854BB18FF661; Tue, 31 Mar 2020 16:25:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 485BE5E009; Tue, 31 Mar 2020 16:25:08 +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 DED1986C0E; Tue, 31 Mar 2020 16:25:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02VGOjLj023128 for ; Tue, 31 Mar 2020 12:24:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 829B35DA60; Tue, 31 Mar 2020 16:24:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 003C15D9E2 for ; Tue, 31 Mar 2020 16:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585671920; 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=xKWfwc76YtKTmEt3hyigP1WwkAAtlMJlDZnPMRbq/jo=; b=W/0FBmQxx8yVlPU/XijL0EEN4VQO9dL/C4G9hRYElrsxN1QDARC4PFcmSsA9NwmpiM886I GFguPTFryzx0cZ2M/lNZKKLBlBJ8kTl+fQ4Fu/DptSgoezWWDHpgLkyPdMswYHGMJns/2/ Su13MHyIj98JagbOB2ObK6Qj5hSWEL4= X-MC-Unique: FxV53HzQPe6yBtsTHqGfSg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 10/10] qemu: Make auto dump path generation embed driver aware Date: Tue, 31 Mar 2020 18:24:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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 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" So far, libvirt generates the following path for automatic dumps: $autoDumpPath/$id-$shortName-$timestamp where $autoDumpPath is where libvirt stores dumps of guests (e.g. /var/lib/libvirt/qemu/dump), $id is domain ID and $shortName is shortened version of domain name. So for instance, the generated path may look something like this: /var/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50 While in case of embed driver the following path would be generated by default: $root/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50 which is not clashing with other embed drivers, we allow users to override the default and have all embed drivers use the same prefix. This can create clashing paths. Fortunately, we can reuse the approach for machined name generation (v6.1.0-178-gc9bd08ee35) and include part of hash of the root in the generated path. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 33f177adbd..1746c85be4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4104,6 +4104,7 @@ static char * getAutoDumpPath(virQEMUDriverPtr driver, virDomainObjPtr vm) { + const char *root =3D driver->embeddedRoot; g_autofree char *domname =3D virDomainDefGetShortName(vm->def); g_autoptr(GDateTime) now =3D g_date_time_new_now_local(); g_autofree char *nowstr =3D NULL; @@ -4116,6 +4117,11 @@ getAutoDumpPath(virQEMUDriverPtr driver, =20 nowstr =3D g_date_time_format(now, "%Y-%m-%d-%H:%M:%S"); =20 + if (root && !STRPREFIX(cfg->autoDumpPath, root)) { + g_autofree char * hash =3D virDomainDriverGenerateRootHash(QEMU_DR= IVER_NAME, root); + return g_strdup_printf("%s/%s-%s-%s", cfg->autoDumpPath, hash, dom= name, nowstr); + } + return g_strdup_printf("%s/%s-%s", cfg->autoDumpPath, domname, nowstr); } =20 --=20 2.24.1