From nobody Mon Sep 16 19:39:54 2024 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=1684154078; cv=none; d=zohomail.com; s=zohoarc; b=SspPqZXeWhwLYVA/FaIFXPXuGZicbNrtQlZd3UOPypJva4AvtCw/611/acNQI9TlqjXK5u68SPC/Yv/VmhQbNyk4Yx+NwdP+jtPVHwrKLOf+x4gpYtO/rfUa4lYBLNLSIz2RcHHDr/HQPUZddDKTO8XInDIaTbmPNJxenhnr6kE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154078; 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=msL7bsrgPN9yRaVTpHlFdtc03KMezGt5pGD6L+hVmII=; b=KjKNRiPIv/3ZgbUQziRHGyF8HcCi+pdjv9npYe0RR7KC5X3xpRlEpS0pwMsCmwUSh80ZTA7nZlBqBp11rHMmQtBrrqSY2E76Ha2V03QJgeTOyy3MXAxnQhjrumOrSUZ+Vbi9qO/LhYnC7jb7K4Wb8tIxS/Ie0JvgVwl+ljaZy9A= 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 168415407832298.6355353737996; Mon, 15 May 2023 05:34:38 -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-127-OvcuxXlLN1GIyH1ocvBHnA-1; Mon, 15 May 2023 08:34:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBDF71C0953C; Mon, 15 May 2023 12:34:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A79EAC164E9; Mon, 15 May 2023 12:34:17 +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 7C9761946595; Mon, 15 May 2023 12:34:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B7B6B194658C for ; Mon, 15 May 2023 12:34:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AB3E714171B6; Mon, 15 May 2023 12:34:15 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3062E14171BA for ; Mon, 15 May 2023 12:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154076; 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=msL7bsrgPN9yRaVTpHlFdtc03KMezGt5pGD6L+hVmII=; b=X1uwto/eUO7jIXpeg5s1a1xCY6iP9qeh9GxE5CqGabZ9FVp5AsdpkNROHV43Tkv/HyWaut VIA+N2qmjbGDDR4bhrldvpug39RKN93esFJzuqMjfZxdt7+LdGLJsZRTYVcI0ToxK2zc8G rKCKKpFj7ujee+quaW+NXNDOaBl72cQ= X-MC-Unique: OvcuxXlLN1GIyH1ocvBHnA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/3] conf: backup: Fix logic for generating default backup filenames Date: Mon, 15 May 2023 14:34:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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.8 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: 1684154080522100001 Content-Type: text/plain; charset="utf-8" If the 'disk->store' property is already allocated which happens e.g. when the disk is described by the backup XML but the optional filename is not filled in 'virDomainBackupDefAssignStore' would not fill in the default location. Fix the logic to do it also if a 'virStorageSource' categorizes as empty. Signed-off-by: Peter Krempa --- src/conf/backup_conf.c | 7 +++++-- tests/domainbackupxml2xmlin/backup-push.xml | 1 + tests/domainbackupxml2xmlout/backup-push.xml | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 013c08cd6e..e151c29738 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -424,7 +424,8 @@ virDomainBackupDefAssignStore(virDomainBackupDiskDef *d= isk, } } - if (!disk->store) { + if (!disk->store || + virStorageSourceIsEmpty(disk->store)) { if (virStorageSourceGetActualType(src) !=3D VIR_STORAGE_TYPE_FILE)= { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("refusing to generate file name for disk '%1$= s'"), @@ -432,7 +433,9 @@ virDomainBackupDefAssignStore(virDomainBackupDiskDef *d= isk, return -1; } - disk->store =3D virStorageSourceNew(); + if (!disk->store) + disk->store =3D virStorageSourceNew(); + disk->store->type =3D VIR_STORAGE_TYPE_FILE; disk->store->path =3D g_strdup_printf("%s.%s", src->path, suffix); } diff --git a/tests/domainbackupxml2xmlin/backup-push.xml b/tests/domainback= upxml2xmlin/backup-push.xml index 0bfec9b270..a95833d407 100644 --- a/tests/domainbackupxml2xmlin/backup-push.xml +++ b/tests/domainbackupxml2xmlin/backup-push.xml @@ -5,6 +5,7 @@ + diff --git a/tests/domainbackupxml2xmlout/backup-push.xml b/tests/domainbac= kupxml2xmlout/backup-push.xml index 317dcf6e47..fff7db716b 100644 --- a/tests/domainbackupxml2xmlout/backup-push.xml +++ b/tests/domainbackupxml2xmlout/backup-push.xml @@ -5,6 +5,9 @@ + + + --=20 2.40.1