From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1575393491; cv=none; d=zohomail.com; s=zohoarc; b=lWXBrQGJ2whdn9oQ7rhZTsXO4ca49SDulyp1mF06cCvpj9QeSAAkvlCmtJMMfCKsJMk6CzJ57Fy7gUwYmkjxMsBEgZAvWXTLXw4KiCf797esnEY00z4AHDcD9lIyKVL5BtzhEu6/Y1QPEufMzCYrv1JXDZxuWnA4y1plfCJNM7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393491; 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=Pys6WGIMa4u24gXrgDKcBnlpRX2frpZFhR+ESzCLPqg=; b=CDEkZGPZDzaqIhf0od9gRZzIcPJYNqAsjZrs/ufuKibfrlIrg1rm9rNeeJkm/c62S7m1aaMAzbC2pj2kx0vlCnxAXeopr5ows1suNUQscfuFs7gEAfxr91xfnBGiTjzWAbUAz+Vtua7hRK8PnDZ+ArbQ5VVXits9r74ZYpqeDQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 15753934914461019.2859781435936; Tue, 3 Dec 2019 09:18:11 -0800 (PST) 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-64-gMaJbF_5NYiTQg0t9lfykA-1; Tue, 03 Dec 2019 12:18:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5A50800D5C; Tue, 3 Dec 2019 17:17:59 +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 ACCE119C68; Tue, 3 Dec 2019 17:17:59 +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 5ED2A18089D5; Tue, 3 Dec 2019 17:17:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHpAk002825 for ; Tue, 3 Dec 2019 12:17:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id C29B8600CD; Tue, 3 Dec 2019 17:17:51 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49F6F600CC for ; Tue, 3 Dec 2019 17:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393490; 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=Pys6WGIMa4u24gXrgDKcBnlpRX2frpZFhR+ESzCLPqg=; b=VJpeWUvmBua14zqxMlLpXX06QRzFTIWvxvSchE7dqMR8EcVx6E6rt1NEmgB/2QoNNfD28M Jxg0+bc2clT5LbqyhxvyJLhO9XFJkey+do6msbgTiz1jtLmVJ2qBJqBhNLNU9nuBz0E2Ka OxYNiLsQwEE1vN0D/CqA6/tFHHcDsEk= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:23 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/25] qemu: domain: Export qemuDomainGetImageIds 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.84 on 10.5.11.23 X-MC-Unique: gMaJbF_5NYiTQg0t9lfykA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domain.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 470d342afc..8d2923300d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10240,7 +10240,7 @@ qemuDomainCleanupRun(virQEMUDriverPtr driver, priv->ncleanupCallbacks_max =3D 0; } -static void +void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, virDomainObjPtr vm, virStorageSourcePtr src, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f626d3a54c..608546a27c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -840,6 +840,13 @@ bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr= disk, const char *qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm, const char *disk); +void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, + virDomainObjPtr vm, + virStorageSourcePtr src, + virStorageSourcePtr parentSrc, + uid_t *uid, + gid_t *gid); + int qemuDomainStorageFileInit(virQEMUDriverPtr driver, virDomainObjPtr vm, virStorageSourcePtr src, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575393485; cv=none; d=zohomail.com; s=zohoarc; b=ZkeJBKeG+1DmaOA1rySFeCSzwH5QGRriMY/MU77eGrF3wS0P1MDS6/1sp+YG560XNnS6l2Y35kbeaZa1K+yIr2pIke0upSp5KUSNTdnhh71Q+umbkaDIHHF7IKxnnT7jLMUN5q2TqUcdj7glrbB1nmwTSQpa7ziZL55uTuF+QHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393485; 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=DmEYleJy285l0Ih7ZbR5Dht5Bn9+cc2M0S2uB25ZNwI=; b=LOKOB26B5W2rs/MQ31KWYWDpB9QaPe9ph6IVOAE3a6OoY1rXkbnLdoI7vx9njJI5i7dTqQ5ofkV7N5GlXzHKVARB962aG2A23WEUv0TQ+ZBtsY+RFn4JbNp17Mi9K333SXzMyQvCljxaIRIuZEP2Zo/6eCYaMfnragTme9g0c/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575393485565546.7520201875537; Tue, 3 Dec 2019 09:18:05 -0800 (PST) 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-254-gp9uY10xNiSRu4kLVCHgqQ-1; Tue, 03 Dec 2019 12:18:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 517CE800D54; Tue, 3 Dec 2019 17:17:54 +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 2B7465C240; Tue, 3 Dec 2019 17:17:54 +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 7D01018089CF; Tue, 3 Dec 2019 17:17:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHq08002836 for ; Tue, 3 Dec 2019 12:17:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 916BB600CD; Tue, 3 Dec 2019 17:17:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A592600CC for ; Tue, 3 Dec 2019 17:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393483; 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=DmEYleJy285l0Ih7ZbR5Dht5Bn9+cc2M0S2uB25ZNwI=; b=OsIzPOoF0MnnUL1H29ETr/tDGDDhFhhoa9Y50VriTO47melwmSkolgwnN4L7LlkCuzhwbY Db+GXVur00zY4j/oh2vm+PU2kZsXBz2dFVhI3sDuYZ235aS0u0NVdPz648ZbEqyKvjaXbt 9kDO69murC1zuxIem4IQA6z+a31pkEk= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:24 +0100 Message-Id: <7a15008115a8614530b0485a313af605045492f1.1575392644.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 02/25] API: Introduce field for reporting temporary disk space usage of a domain job 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.16 X-MC-Unique: gp9uY10xNiSRu4kLVCHgqQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) A pull mode backup job uses temporary disk images to hold the changed parts of the disk while the client is copying the changes. Since usage of the temporary space can be monitored but doesn't really fit any of the existing stats fields introduce new fields for reporting this data. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 40c71091ec..b9908fe7b0 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3586,6 +3586,20 @@ typedef enum { */ # define VIR_DOMAIN_JOB_SUCCESS "success" +/** + * VIR_DOMAIN_JOB_DISK_TEMP_USED: + * virDomainGetJobStats field: current usage of temporary disk space for t= he + * job in bytes as VIR_TYPED_PARAM_ULLONG. + */ +# define VIR_DOMAIN_JOB_DISK_TEMP_USED "disk_temp_used" + +/** + * VIR_DOMAIN_JOB_DISK_TEMP_TOTAL: + * virDomainGetJobStats field: possible total temporary disk space for the + * job in bytes as VIR_TYPED_PARAM_ULLONG. + */ +# define VIR_DOMAIN_JOB_DISK_TEMP_TOTAL "disk_temp_total" + /** * virConnectDomainEventGenericCallback: * @conn: the connection pointer --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1575393493; cv=none; d=zohomail.com; s=zohoarc; b=CNffkWmtIj0JDRP8PYrdhGwZrh32lEJWj2d4aBjfB9JnIJrEyfFHcReSv1xULNvOJF8jTLLUg3w+5F+jkfPsMVM5AKOHUy+XdbC56tWJBcVTgDtqC2VD2pmhT7y2Gr35eXbgS0Oi4Ay30TremsI8V5uAkPc3A4cUi6U4bRcNikA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393493; 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=e9HHK6pgaliNHwqBEBkRCcoU65yNV4NMJno1Vrmr/7k=; b=kGYopViwLcPzpcUb6X7iBv96CS/ntsirBjIYtmnAGyT+Ft5n466463lniIaGiNTaUBkh9NR/RR9T6pFtkHMMGiHb5JjAk2+kDsiDalhNjUVsR1pX9lbeVyWkk6Mkmk+QZsBQ6ZhT+8S8JSNQI0TbqYXFOTXBgg1hbm8TbuEeAl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575393493890883.0031516876112; Tue, 3 Dec 2019 09:18:13 -0800 (PST) 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-27-2YCyA7KEO--XVyzAjzLdPw-1; Tue, 03 Dec 2019 12:18:10 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D69C5800D5E; Tue, 3 Dec 2019 17:17:59 +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 AFBA55C554; Tue, 3 Dec 2019 17:17:59 +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 62CC25BC05; Tue, 3 Dec 2019 17:17:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHrb0002841 for ; Tue, 3 Dec 2019 12:17:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 625D3600CD; Tue, 3 Dec 2019 17:17:53 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEADF600CC for ; Tue, 3 Dec 2019 17:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393492; 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=e9HHK6pgaliNHwqBEBkRCcoU65yNV4NMJno1Vrmr/7k=; b=dbp6A0Wi96mQn6uBvXhtK3fZ0rjf3p16UM5Tu+dJSbDjRuLZTKT7elKr869abdd5/0wBn3 C+UkUhUnSg2EaNGDbySu32JvEKq8Os1vmi+p20U5B+vDOJyBt6y77N9vh1SNazIlvOzzZP X6BdX36CfLyf7MCYVkPX+6TWthH2pMk= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:25 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 03/25] virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo 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.16 X-MC-Unique: 2YCyA7KEO--XVyzAjzLdPw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Peter Krempa Reviewed-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 21ea1a69ea..bb942267f0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6388,6 +6388,24 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-17s %-13d\n", _("Auto converge throttle:"), ivalu= e); } + if ((rc =3D virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_JOB_DISK_TEMP_USED, + &value)) < 0) { + goto save_error; + } else if (rc) { + val =3D vshPrettyCapacity(value, &unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space use:"),= val, unit); + } + + if ((rc =3D virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_JOB_DISK_TEMP_TOTAL, + &value)) < 0) { + goto save_error; + } else if (rc) { + val =3D vshPrettyCapacity(value, &unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"= ), val, unit); + } + ret =3D true; cleanup: --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1575393486; cv=none; d=zohomail.com; s=zohoarc; b=WRBtpVWzmZ3RkAcK7nwrXWeqH6gXlck42c7jbmz3zD7Nqqh0vLAjAtxmVXReGAY0ghAP5PcumRluwKMjBq8MtqlziPt0uXt5CmEwWt7O4Ztpm3HeybNZkxXqxjCFmM8ycVs0w1x7TBwxv+tJjrM9IsEBZKjeG56gwCbwG/IyH80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393486; 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=Oj9o/djl2whqEqz+S4puJQZ7UmY664TX2R/G4X4XhGE=; b=aTh4SqBZAhDn/hvi4tFt2QANJVbGn9EVq8q2cph5RRm03PnHt3ru/RsbXJzJi5x9llpJJAP8fYhUsDDocIVQ7qQN47+/b/yelCHwPwaVNsXdR+Z1u5c2jr5D/CHQM8JWCl/EBOQeyS7zbGafgs6uzO0sJ9mXLxMYsOreOm0Ld6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575393486894934.2975637298479; Tue, 3 Dec 2019 09:18:06 -0800 (PST) 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-414-KPUF45fSNlKzkVCXot1Zaw-1; Tue, 03 Dec 2019 12:18:03 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5931618C35B4; Tue, 3 Dec 2019 17:17:56 +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 30BCD100EBA6; Tue, 3 Dec 2019 17:17:56 +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 E2EBC5BC02; Tue, 3 Dec 2019 17:17:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHspx002857 for ; Tue, 3 Dec 2019 12:17:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5945D600CD; Tue, 3 Dec 2019 17:17:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B06BA600CC for ; Tue, 3 Dec 2019 17:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393485; 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=Oj9o/djl2whqEqz+S4puJQZ7UmY664TX2R/G4X4XhGE=; b=UpWE2SyE5uTM44S5SKXQFdfTANBiHOkTmtQph2MlWB5QqEkPazvSUSOjTcnbMHrgDm02d2 ZwADgNUqApHQ/PxxWdtHQ0Z6SvaALcNcRFWzfs8Rddv9p4mdIEWMsVxkVwsDHvHPbyzj5e DGlcmB5fqw9g1aoA+Ata4MsKoIBXsq4= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:26 +0100 Message-Id: <6b9ea8ed7ca5a05afe3016f3ab027c5ecad6e605.1575392644.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 04/25] backup: Document new XML for backups 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.84 on 10.5.11.22 X-MC-Unique: KPUF45fSNlKzkVCXot1Zaw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake Prepare for new backup APIs by describing the XML that will represent a backup. The XML resembles snapshots and checkpoints in being able to select actions for a set of disks, but has other differences. It can support both push model (the hypervisor does the backup directly into the destination file) and pull model (the hypervisor exposes an access port for a third party to grab what is necessary). Add testsuite coverage for some minimal uses of the XML. The element within tries to model the same elements as a under , but sharing the RNG grammar proved to be hairy. That is in part because while use to describe a host resource in use by the guest, a backup job is using a host resource that is not visible to the guest: a push backup action is instead describing a (which ultimately could be a remote network resource, but for simplicity the RNG just validates a local file for now), and a pull backup action is instead describing a temporary local file (which probably should not be a remote resource). A future refactoring may thus introduce some way to parameterize RNG to accept ... so that the name of the subelement can be for domain, or or as needed for backups. Future patches may improve this area of code. Signed-off-by: Eric Blake Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- docs/docs.html.in | 3 +- docs/format.html.in | 1 + docs/formatbackup.html.in | 175 ++++++++++++++ docs/formatcheckpoint.html.in | 12 +- docs/index.html.in | 3 +- docs/schemas/domainbackup.rng | 223 ++++++++++++++++++ libvirt.spec.in | 1 + mingw-libvirt.spec.in | 2 + tests/Makefile.am | 1 + .../backup-pull-seclabel.xml | 18 ++ tests/domainbackupxml2xmlin/backup-pull.xml | 10 + .../backup-push-seclabel.xml | 17 ++ tests/domainbackupxml2xmlin/backup-push.xml | 10 + tests/domainbackupxml2xmlin/empty.xml | 1 + tests/virschematest.c | 1 + 15 files changed, 470 insertions(+), 8 deletions(-) create mode 100644 docs/formatbackup.html.in create mode 100644 docs/schemas/domainbackup.rng create mode 100644 tests/domainbackupxml2xmlin/backup-pull-seclabel.xml create mode 100644 tests/domainbackupxml2xmlin/backup-pull.xml create mode 100644 tests/domainbackupxml2xmlin/backup-push-seclabel.xml create mode 100644 tests/domainbackupxml2xmlin/backup-push.xml create mode 100644 tests/domainbackupxml2xmlin/empty.xml diff --git a/docs/docs.html.in b/docs/docs.html.in index 268c16f3b3..f8a949bb53 100644 --- a/docs/docs.html.in +++ b/docs/docs.html.in @@ -82,7 +82,8 @@ node devices, secrets, snapshots, - checkpoints + checkpoints, + backup jobs
URI format
The URI formats used for connecting to libvirt
diff --git a/docs/format.html.in b/docs/format.html.in index 3be2237663..d013528fe0 100644 --- a/docs/format.html.in +++ b/docs/format.html.in @@ -27,6 +27,7 @@
  • Secrets
  • Snapshots
  • Checkpoints
  • +
  • Backup jobs
  • Command line validation

    diff --git a/docs/formatbackup.html.in b/docs/formatbackup.html.in new file mode 100644 index 0000000000..d2e4609c1c --- /dev/null +++ b/docs/formatbackup.html.in @@ -0,0 +1,175 @@ + + + + +

    Backup XML format

    + +
      + +

      Backup XML

      + +

      + Creating a backup, whether full or incremental, is done + via virDomainBackupBegin(), which takes an XML + description of the actions to perform, as well as an optional + second XML document describing a + checkpoint to create at the same point in time. See + also a comparison between + the various state capture APIs. +

      +

      + There are two general modes for backups: a push mode (where the + hypervisor writes out the data to the destination file, which + may be local or remote), and a pull mode (where the hypervisor + creates an NBD server that a third-party client can then read as + needed, and which requires the use of temporary storage, + typically local, until the backup is complete). +

      +

      + The instructions for beginning a backup job are provided as + attributes and elements of the + top-level domainbackup element. This element + includes an optional attribute mode which can be + either "push" or "pull" (default + push). virDomainBackupGetXMLDesc() can be used to + see the actual values selected for elements omitted during + creation (for example, learning which port the NBD server is + using in the pull model or what file names libvirt generated + when none were supplied). The following child elements and attributes + are supported: +

      +
      +
      incremental
      +
      An optional element giving the name of an existing + checkpoint of the domain, which will be used to make this + backup an incremental one. In the push model, only changes + since the named checkpoint are written to the destination. In + the pull model, the NBD server uses the + NBD_OPT_SET_META_CONTEXT extension to advertise to the client + which portions of the export contain changes since the named + checkpoint. If omitted, a full backup is performed. +
      +
      server
      +
      Present only for a pull mode backup. Contains the same + attributes as + the protocol + element of a disk attached via NBD in the domain (such as + transport, socket, name, port, or tls), necessary to set up an + NBD server that exposes the content of each disk at the time + the backup is started. +
      +
      disks
      +
      An optional listing of instructions for disks participating + in the backup (if omitted, all disks participate and libvirt + attempts to generate filenames by appending the current + timestamp as a suffix). If the entire element was omitted on + input, then all disks participate in the backup, otherwise, + only the disks explicitly listed which do not also + use backup=3D'no' will participate. On output, this + is the state of each of the domain's disk in relation to the + backup operation. +
      +
      disk
      +
      This sub-element describes the backup properties of a + specific disk, with the following attributes and child + elements: +
      +
      name
      +
      A mandatory attribute which must match + the <target dev=3D'name'/> + of one of + the disk + devices specified for the domain at the time of + the checkpoint.
      +
      backup
      +
      Setting this attribute to yes(default) spec= ifies + that the disk should take part in the backup and using + no excludes the disk from the backup.
      +
      type
      +
      A mandatory attribute to describe the type of the + disk, except when backup=3D'no' is + used. Valid values include file, + block, or network. + Similar to a disk declaration for a domain, the choice of = type + controls what additional sub-elements are needed to descri= be + the destination (such as protocol for a + network destination).
      +
      target
      +
      Valid only for push mode backups, this is the + primary sub-element that describes the file name of + the backup destination, similar to + the source sub-element of a domain + disk. An optional sub-element driver can + also be used, with an attribute type to + specify a destination format different from + qcow2.
      +
      scratch
      +
      Valid only for pull mode backups, this is the + primary sub-element that describes the file name of + the local scratch file to be used in facilitating the + backup, and is similar to the source + sub-element of a domain disk. Currently only file + and block scratch storage is supported. The + file scratch file is created and deleted by + libvirt in the given location. A block scratch + device must exist prior to starting the backup and is form= atted. + The block device must have enough space for the correspond= ing + disk data including format overhead. + + If VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL fla= g is + used the file for a scratch of file type must + exist with the correct format and size to hold the copy an= d is + used without modification. The file is not deleted after t= he + backup but the contents of the file don't make sense outsi= de + of the backup. The same applies for the block device which + must be formatted appropriately.
      +
      +
      +
      +
      +
      + +

      Examples

      + +

      Use virDomainBackupBegin() to perform a full + backup using push mode. The example lets libvirt pick the + destination and format for 'vda', fully specifies that we want a + raw backup of 'vdb', and omits 'vdc' from the operation. +

      +
      +<domainbackup>
      +  <disks/>
      +    <disk name=3D'vda' backup=3D'yes'/>
      +    <disk name=3D'vdb' type=3D'file'>
      +      <target file=3D'/path/to/vdb.backup'/>
      +      <driver type=3D'raw'/>
      +    </disk>
      +    <disk name=3D'vdc' backup=3D'no'/>
      +  </disks/>
      +</domainbackup>
      +    
      + +

      If the previous full backup also passed a parameter describing + checkpoint XML that resulted + in a checkpoint named 1525889631, we can make + another call to virDomainBackupBegin() to perform + an incremental backup of just the data changed since that + checkpoint, this time using the following XML to start a pull + model export of the 'vda' and 'vdb' disks, where a third-party + NBD client connecting to '/path/to/server' completes the backup + (omitting 'vdc' from the explicit list has the same effect as + the backup=3D'no' from the previous example): +

      +
      +<domainbackup mode=3D"pull">
      +  <incremental>1525889631</incremental>
      +  <server transport=3D"unix" socket=3D"/path/to/server"/>
      +  <disks/>
      +    <disk name=3D'vda' backup=3D'yes' type=3D'file'>
      +      <scratch file=3D'/path/to/file1.scratch'/>
      +    </disk>
      +  </disks/>
      +</domainbackup>
      +    
      + + diff --git a/docs/formatcheckpoint.html.in b/docs/formatcheckpoint.html.in index 044bbfe4b0..ee56194523 100644 --- a/docs/formatcheckpoint.html.in +++ b/docs/formatcheckpoint.html.in @@ -28,12 +28,12 @@ first checkpoint and the second backup operation), it is possible to do an offline reconstruction of the state of the disk at the time of the second backup without having to copy as - much data as a second full backup would require. Future API - additions will make it possible to create checkpoints in - conjunction with a backup - via virDomainBackupBegin() or with an external - snapshot via virDomainSnapshotCreateXML2; but for - now, libvirt exposes enough support to create disk checkpoints + much data as a second full backup would require. Most disk + checkpoints are created in conjunction with a backup + via virDomainBackupBegin(), although a future API + addition of virDomainSnapshotCreateXML2() will also + make this possible when creating external snapshots; however, + libvirt also exposes enough support to create disk checkpoints independently from a backup operation via virDomainCheckpointCreateXML() since 5.6.0. Likewise, the creation of checkpoints when diff --git a/docs/index.html.in b/docs/index.html.in index 7d0ab650e3..26e8406917 100644 --- a/docs/index.html.in +++ b/docs/index.html.in @@ -59,7 +59,8 @@ node devices, secrets, snapshots, - checkpoints + checkpoints, + backup jobs
      Wiki
      Read further community contributed content
      diff --git a/docs/schemas/domainbackup.rng b/docs/schemas/domainbackup.rng new file mode 100644 index 0000000000..7286acb18c --- /dev/null +++ b/docs/schemas/domainbackup.rng @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + push + + + + + + + pull + + + + + + + + tcp + + + + + + + + + + + + + + + + + + unix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qcow2 + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + no + + + + + + file + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + no + + + + + + + file + + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + diff --git a/libvirt.spec.in b/libvirt.spec.in index 4c6161a26f..feda2e9faa 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1892,6 +1892,7 @@ exit 0 %{_datadir}/libvirt/schemas/capability.rng %{_datadir}/libvirt/schemas/cputypes.rng %{_datadir}/libvirt/schemas/domain.rng +%{_datadir}/libvirt/schemas/domainbackup.rng %{_datadir}/libvirt/schemas/domaincaps.rng %{_datadir}/libvirt/schemas/domaincheckpoint.rng %{_datadir}/libvirt/schemas/domaincommon.rng diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index c29f3eeed2..453570fc3c 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -233,6 +233,7 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-gue= sts.sh %{mingw32_datadir}/libvirt/schemas/capability.rng %{mingw32_datadir}/libvirt/schemas/cputypes.rng %{mingw32_datadir}/libvirt/schemas/domain.rng +%{mingw32_datadir}/libvirt/schemas/domainbackup.rng %{mingw32_datadir}/libvirt/schemas/domaincaps.rng %{mingw32_datadir}/libvirt/schemas/domaincheckpoint.rng %{mingw32_datadir}/libvirt/schemas/domaincommon.rng @@ -324,6 +325,7 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-gue= sts.sh %{mingw64_datadir}/libvirt/schemas/capability.rng %{mingw64_datadir}/libvirt/schemas/cputypes.rng %{mingw64_datadir}/libvirt/schemas/domain.rng +%{mingw64_datadir}/libvirt/schemas/domainbackup.rng %{mingw64_datadir}/libvirt/schemas/domaincaps.rng %{mingw64_datadir}/libvirt/schemas/domaincheckpoint.rng %{mingw64_datadir}/libvirt/schemas/domaincommon.rng diff --git a/tests/Makefile.am b/tests/Makefile.am index e009de830c..ea9e2b2ad0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -91,6 +91,7 @@ EXTRA_DIST =3D \ commanddata \ cputestdata \ domaincapsdata \ + domainbackupxml2xmlin \ domainconfdata \ domainschemadata \ fchostdata \ diff --git a/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml b/tests/d= omainbackupxml2xmlin/backup-pull-seclabel.xml new file mode 100644 index 0000000000..a00d8758bb --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml @@ -0,0 +1,18 @@ + + 1525889631 + + + + + + + + + + + + + + + + diff --git a/tests/domainbackupxml2xmlin/backup-pull.xml b/tests/domainback= upxml2xmlin/backup-pull.xml new file mode 100644 index 0000000000..c0bea4771d --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-pull.xml @@ -0,0 +1,10 @@ + + 1525889631 + + + + + + + + diff --git a/tests/domainbackupxml2xmlin/backup-push-seclabel.xml b/tests/d= omainbackupxml2xmlin/backup-push-seclabel.xml new file mode 100644 index 0000000000..dbaf7f8e7c --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-push-seclabel.xml @@ -0,0 +1,17 @@ + + 1525889631 + + + + + + + + + + + + + + + diff --git a/tests/domainbackupxml2xmlin/backup-push.xml b/tests/domainback= upxml2xmlin/backup-push.xml new file mode 100644 index 0000000000..0bfec9b270 --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-push.xml @@ -0,0 +1,10 @@ + + 1525889631 + + + + + + + + diff --git a/tests/domainbackupxml2xmlin/empty.xml b/tests/domainbackupxml2= xmlin/empty.xml new file mode 100644 index 0000000000..7ed511f97b --- /dev/null +++ b/tests/domainbackupxml2xmlin/empty.xml @@ -0,0 +1 @@ + diff --git a/tests/virschematest.c b/tests/virschematest.c index df50ef1717..5ae2d207d1 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -205,6 +205,7 @@ mymain(void) "genericxml2xmloutdata", "xlconfigdata", "libxlxml2domconf= igdata", "qemuhotplugtestdomains"); DO_TEST_DIR("domaincaps.rng", "domaincapsdata"); + DO_TEST_DIR("domainbackup.rng", "domainbackupxml2xmlin"); DO_TEST_DIR("domaincheckpoint.rng", "qemudomaincheckpointxml2xmlin", "qemudomaincheckpointxml2xmlout"); DO_TEST_DIR("domainsnapshot.rng", "qemudomainsnapshotxml2xmlin", --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575393499; cv=none; d=zohomail.com; s=zohoarc; b=Vm7ZTOLit7z48KOt89OhFvatE01PB585HIi3B5ZZMRQ4yYy53tZu08G+bdL2cqomNz/xF7VM5jlVhShiKOQHz25JqY0lPxMthQH3sxa2sX6FxIVpbOZBm2CM0L6it2aiRyg50B5mrB+/+NAKP6Gqt5u9IBBII/XC0hJTjb/bXYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393499; 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=gZAsnA5mfAQVAP5+DOQ05cB5K6MW9c6o86+AJolc2cM=; b=OSVPPHxLohN8AG54eKOoNdQzNTMGS49wa+3ZfQfJvVKmXoy2yQr6ugttjZVLOkq+f9zAwCq11EZi+XIZgac+13/RPL9qr9j1Z+jcVqbS9OhLaljTCfDiuwvJj2x/Z9JsILStdeCm+nvFfTwhAkMKaAD9clIRVmQC4fWLWs5jMT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575393499509584.5731025052022; Tue, 3 Dec 2019 09:18:19 -0800 (PST) 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-88-wVC_Ko6PO6OxLVlxtCotdg-1; Tue, 03 Dec 2019 12:18:11 -0500 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 2073E8024C2; Tue, 3 Dec 2019 17:18:04 +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 EAC8369182; Tue, 3 Dec 2019 17:18:03 +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 875935BC07; Tue, 3 Dec 2019 17:18:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHtSB002864 for ; Tue, 3 Dec 2019 12:17:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A3B3600CD; Tue, 3 Dec 2019 17:17:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7FC0600CC for ; Tue, 3 Dec 2019 17:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393498; 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=gZAsnA5mfAQVAP5+DOQ05cB5K6MW9c6o86+AJolc2cM=; b=cGWvB+EjdzAehNkFvf2GHOjqmZKLIDgpnuTx968+uTMAPBYb8Ja1agDBINncX+c9ggUJ/k cAvQq/SMwpPERaw5oXz1mtJeRkXLp2XIK3Axl3MARDOhuAkCk5dGth/ILMfgkQ+um+MZMV ruTktdnqRg1hr/94SWe3yUlaOZ/TtVo= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:27 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 05/25] backup: Introduce virDomainBackup APIs 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 X-MC-Unique: wVC_Ko6PO6OxLVlxtCotdg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake Introduce a few new public APIs related to incremental backups. This builds on the previous notion of a checkpoint (without an existing checkpoint, the new API is a full backup, differing from virDomainBlockCopy in the point of time chosen and in operation on multiple disks at once); and also allows creation of a new checkpoint at the same time as starting the backup (after all, an incremental backup is only useful if it covers the state since the previous backup). A backup job also affects filtering a listing of domains, as well as adding event reporting for signaling when a push model backup completes (where the hypervisor creates the backup); note that the pull model does not have an event (starting the backup lets a third party access the data, and only the third party knows when it is finished). The full list of new APIs: virDomainBackupBegin; virDomainBackupGetXMLDesc; Signed-off-by: Eric Blake Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 19 +++- src/driver-hypervisor.h | 12 +++ src/libvirt-domain-checkpoint.c | 7 +- src/libvirt-domain.c | 143 +++++++++++++++++++++++++++++++ src/libvirt_public.syms | 6 ++ 5 files changed, 183 insertions(+), 4 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index b9908fe7b0..84c5492a7b 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4129,8 +4129,10 @@ typedef void (*virConnectDomainEventMigrationIterati= onCallback)(virConnectPtr co * @nparams: size of the params array * @opaque: application specific data * - * This callback occurs when a job (such as migration) running on the doma= in - * is completed. The params array will contain statistics of the just comp= leted + * This callback occurs when a job (such as migration or backup) running on + * the domain is completed. + * + * The params array will contain statistics of the just completed * job as virDomainGetJobStats would return. The callback must not free @p= arams * (the array will be freed once the callback finishes). * @@ -4949,4 +4951,17 @@ int virDomainAgentSetResponseTimeout(virDomainPtr do= main, int timeout, unsigned int flags); +typedef enum { + VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL =3D (1 << 0), /* reuse separate= ly + provided images = */ +} virDomainBackupBeginFlags; + +int virDomainBackupBegin(virDomainPtr domain, + const char *backupXML, + const char *checkpointXML, + unsigned int flags); + +char *virDomainBackupGetXMLDesc(virDomainPtr domain, + unsigned int flags); + #endif /* LIBVIRT_DOMAIN_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 4afd8f6ec5..bce023017d 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1377,6 +1377,16 @@ typedef int int timeout, unsigned int flags); +typedef int +(*virDrvDomainBackupBegin)(virDomainPtr domain, + const char *backupXML, + const char *checkpointXML, + unsigned int flags); + +typedef char * +(*virDrvDomainBackupGetXMLDesc)(virDomainPtr domain, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; @@ -1638,4 +1648,6 @@ struct _virHypervisorDriver { virDrvDomainCheckpointDelete domainCheckpointDelete; virDrvDomainGetGuestInfo domainGetGuestInfo; virDrvDomainAgentSetResponseTimeout domainAgentSetResponseTimeout; + virDrvDomainBackupBegin domainBackupBegin; + virDrvDomainBackupGetXMLDesc domainBackupGetXMLDesc; }; diff --git a/src/libvirt-domain-checkpoint.c b/src/libvirt-domain-checkpoin= t.c index fa391f8a06..432c2d5a52 100644 --- a/src/libvirt-domain-checkpoint.c +++ b/src/libvirt-domain-checkpoint.c @@ -102,8 +102,11 @@ virDomainCheckpointGetConnect(virDomainCheckpointPtr c= heckpoint) * @flags: bitwise-OR of supported virDomainCheckpointCreateFlags * * Create a new checkpoint using @xmlDesc, with a top-level - * element, on a running @domain. Note that @xmlDesc - * must validate against the XML schema. + * element, on a running @domain. Note that + * @xmlDesc must validate against the XML schema. + * Typically, it is more common to create a new checkpoint as part of + * kicking off a backup job with virDomainBackupBegin(); however, it + * is also possible to start a checkpoint without a backup. * * See Checkpoint X= ML * for more details on @xmlDesc. In particular, some hypervisors may requi= re diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index b9345804ea..f873246ace 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12541,3 +12541,146 @@ virDomainAgentSetResponseTimeout(virDomainPtr dom= ain, virDispatchError(conn); return -1; } + + +/** + * virDomainBackupBegin: + * @domain: a domain object + * @backupXML: description of the requested backup + * @checkpointXML: description of a checkpoint to create or NULL + * @flags: bitwise or of virDomainBackupBeginFlags + * + * Start a point-in-time backup job for the specified disks of a + * running domain. + * + * A backup job is a domain job and thus mutually exclusive with any other + * domain job such as migration. + * + * For now, backup jobs are also mutually exclusive with any + * other block job on the same device, although this restriction may + * be lifted in a future release. Progress of the backup job can be + * tracked via virDomainGetJobStats(). Completion of the job is also annou= nced + * asynchronously via VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event. + * + * There are two fundamental backup approaches. The first, called a + * push model, instructs the hypervisor to copy the state of the guest + * disk to the designated storage destination (which may be on the + * local file system or a network device). In this mode, the + * hypervisor writes the content of the guest disk to the destination, + * then emits VIR_DOMAIN_EVENT_ID_JOB_COMPLETED when the backup is + * either complete or failed (the backup image is invalid if the job + * fails or virDomainAbortJob() is used prior to the event being + * emitted). This kind of the job finishes automatically. Users can + * determine success by using virDomainGetJobStats() with + * VIR_DOMAIN_JOB_STATS_COMPLETED flag. + * + * The second, called a pull model, instructs the hypervisor to expose + * the state of the guest disk over an NBD export. A third-party + * client can then connect to this export and read whichever portions + * of the disk it desires. In this mode libvirt has to be informed via + * virDomainAbortJob() when the third-party NBD client is done and the bac= kup + * resources can be released. + * + * The @backupXML parameter contains details about the backup in the top-l= evel + * element , including which backup mode to use, whether the + * backup is incremental from a previous checkpoint, which disks + * participate in the backup, the destination for a push model backup, + * and the temporary storage and NBD server details for a pull model + * backup. + * + * virDomainBackupGetXMLDesc() can be called to learn actual + * values selected. For more information, see + * formatcheckpoint.html#BackupAttributes. + * + * The @checkpointXML parameter is optional; if non-NULL, then libvirt + * behaves as if virDomainCheckpointCreateXML() were called to create + * a checkpoint atomically covering the same point in time as the + * backup. + * + * The VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL specifies that the output or + * temporary files described by the @backupXML document were created by the + * caller with correct format and size to hold the backup or temporary dat= a. + * + * The creation of a new checkpoint allows for future incremental backups. + * Note that some hypervisors may require a particular disk format, such as + * qcow2, in order to take advantage of checkpoints, while allowing arbitr= ary + * formats if checkpoints are not involved. + * + * Returns 0 on success or -1 on failure. + */ +int +virDomainBackupBegin(virDomainPtr domain, + const char *backupXML, + const char *checkpointXML, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "backupXML=3D%s, checkpointXML=3D%s, flags=3D= 0x%x", + NULLSTR(backupXML), NULLSTR(checkpointXML), flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + virCheckNonNullArgGoto(backupXML, error); + virCheckReadOnlyGoto(conn->flags, error); + + if (conn->driver->domainBackupBegin) { + int ret; + ret =3D conn->driver->domainBackupBegin(domain, backupXML, checkpo= intXML, + flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return -1; +} + + +/** + * virDomainBackupGetXMLDesc: + * @domain: a domain object + * @flags: extra flags; not used yet, so callers should always pass 0 + * + * Queries the configuration of the active backup job. + * + * In some cases, a user can start a backup job without supplying all + * details and rely on libvirt to fill in the rest (for example, + * selecting the port used for an NBD export). This API can then be + * used to learn what default values were chosen. + * + * Returns a NUL-terminated UTF-8 encoded XML instance or NULL in + * case of error. The caller must free() the returned value. + */ +char * +virDomainBackupGetXMLDesc(virDomainPtr domain, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "flags=3D0x%x", flags); + + virResetLastError(); + + virCheckDomainReturn(domain, NULL); + conn =3D domain->conn; + + if (conn->driver->domainBackupGetXMLDesc) { + char *ret; + ret =3D conn->driver->domainBackupGetXMLDesc(domain, flags); + if (!ret) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return NULL; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index c92f083758..539d2e3943 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -867,4 +867,10 @@ LIBVIRT_5.10.0 { virDomainAgentSetResponseTimeout; } LIBVIRT_5.8.0; +LIBVIRT_6.0.0 { + global: + virDomainBackupBegin; + virDomainBackupGetXMLDesc; +} LIBVIRT_5.10.0; + # .... define new API here using predicted next version number .... --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1575393506; cv=none; d=zohomail.com; s=zohoarc; b=P+FkT0SdXdadDaFXW3klJXXEyyGWSFMMDOxdjvoex1fI7EX/cBc6RwhRjar3gTChCzrRTbtAzVHGf4LrLU3y9OCQosaU97aud7PJ1depzlS2KpUr2MIMoHsWsGP3nJBMO4VM1mveJ1MQO3F6CMHRlIyhAiXpf4WeLUGXytgnl9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393506; 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=lKTGHQP61n+AI2Zh/C+fkDfeZcDCBjtEOzvAzqBEugc=; b=TOJgnJV+xJgEvyyKQk3q80NaFFfmsBB56U2KFbxN2UKmPGT+wd1EMqpB909YrX6Emdp+Yqkuf0V/oYY5s8hDBOmId+hKhmjhd0dkJyy685Cs7aqH4V1Gm/xxthpL3CDV3C/oLKLCG0AVrqHn7JOWyXY0Y2qWEZSyV1UJmXy/wqg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575393506316611.0008605999294; Tue, 3 Dec 2019 09:18:26 -0800 (PST) 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-27-mRPbOM77P7-fmmsbJc3NyA-1; Tue, 03 Dec 2019 12:18:23 -0500 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 1CD02107ACC5; Tue, 3 Dec 2019 17:18:08 +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 E08E45D6B7; Tue, 3 Dec 2019 17:18:07 +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 8961318089D5; Tue, 3 Dec 2019 17:18:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHtqQ002869 for ; Tue, 3 Dec 2019 12:17:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id EEDF5600CD; Tue, 3 Dec 2019 17:17:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77E32600CC for ; Tue, 3 Dec 2019 17:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393505; 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=lKTGHQP61n+AI2Zh/C+fkDfeZcDCBjtEOzvAzqBEugc=; b=iPLSvhvCuHATXCwRpx00owaso6GvjUFkEXJbDL6Iq28KT+/V9rQFoKRuiuyWDCRSl5Z9nh V75laHx7hdCBs70lO/fvsb5/Ln7T0YlzKSoydIRe6+RtuW8x1DZc8mTEL8iWMg09EizRoq jKOs2Wq6+AwRGDjn/63R47OkWRTjHTs= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:28 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 06/25] API: Add domain job operation for backups 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-MC-Unique: mRPbOM77P7-fmmsbJc3NyA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce VIR_DOMAIN_JOB_OPERATION_BACKUP into virDomainJobOperation. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 1 + tools/virsh-domain.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 84c5492a7b..6d1c7f1a3b 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3269,6 +3269,7 @@ typedef enum { VIR_DOMAIN_JOB_OPERATION_SNAPSHOT =3D 6, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT =3D 7, VIR_DOMAIN_JOB_OPERATION_DUMP =3D 8, + VIR_DOMAIN_JOB_OPERATION_BACKUP =3D 9, # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_JOB_OPERATION_LAST diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bb942267f0..5c313279d7 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6068,7 +6068,9 @@ VIR_ENUM_IMPL(virshDomainJobOperation, N_("Outgoing migration"), N_("Snapshot"), N_("Snapshot revert"), - N_("Dump")); + N_("Dump"), + N_("Backup"), +); static const char * virshDomainJobOperationToString(int op) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575393549; cv=none; d=zohomail.com; s=zohoarc; b=dXAnpcdyLZ0IeZG5l/cr8t/OD3Qqbi+G/zEp7vTZA5JBQMesnvtjWrZHRa+pRkjuC+n+cL5LNt41NPOjhRFI7s7L5ilLUBnaoe6E7sW9t6hg0gOR4zgOx5+Bv8tN8I6GtgFlXR6yWI1EBEZ23JtoZV6o//rCNMfnDSI1SvhdCBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393549; 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=mWee9pXUaQEuFUwQ5ScqT+tsurwur//kT//53qGryes=; b=jn5RW/A2lf+9xluyW66yDrKuwroS9XiaFgghNqcbxBmhTmZlLzB96ONvDruy7qHiXBnahOBCSgIdCfMpXGR87j1dRd1i2TDdHDvAGCtUwkXCTcn7Fz3gtsy1T4G/ErjpIDMZ6pEHl2nNpgHwDZ6m8Np5jNJvhUzAcxzM9lK8/jE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 157539354962843.646480477982436; Tue, 3 Dec 2019 09:19:09 -0800 (PST) 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-85-mto42iFTP-W2WGneNAjmfw-1; Tue, 03 Dec 2019 12:18:24 -0500 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 C7D4DDBFD; Tue, 3 Dec 2019 17:18:04 +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 9CB0A5D6C5; Tue, 3 Dec 2019 17:18:04 +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 4F2F15BC08; Tue, 3 Dec 2019 17:18:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHutc002885 for ; Tue, 3 Dec 2019 12:17:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id BE82F600CD; Tue, 3 Dec 2019 17:17:56 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4783F600CC for ; Tue, 3 Dec 2019 17:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393548; 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=mWee9pXUaQEuFUwQ5ScqT+tsurwur//kT//53qGryes=; b=G4iKdfuIzCffr48eKAZCisXbrya7486DtVNA3xIdGeoi0blZ5lPPyOjhPv6+EynsWcyBlq 1gIRH5eEOJqU4kPfWSt5PiLltO7uJlT1cVznchivv4nC1kNQFZVh7WO4T7wGvAouABrpms 3JYH63JEjWHtoHz1DcCe+LSQt/onTYI= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:29 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/25] backup: Implement backup APIs for remote driver 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-MC-Unique: mto42iFTP-W2WGneNAjmfw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake This one is fairly straightforward - the generator already does what we need. Signed-off-by: Eric Blake Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/remote/remote_driver.c | 2 ++ src/remote/remote_protocol.x | 33 ++++++++++++++++++++++++++++++++- src/remote_protocol-structs | 15 +++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a1384fc655..ddb95914a6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8702,6 +8702,8 @@ static virHypervisorDriver hypervisor_driver =3D { .domainCheckpointDelete =3D remoteDomainCheckpointDelete, /* 5.6.0 */ .domainGetGuestInfo =3D remoteDomainGetGuestInfo, /* 5.7.0 */ .domainAgentSetResponseTimeout =3D remoteDomainAgentSetResponseTimeout= , /* 5.10.0 */ + .domainBackupBegin =3D remoteDomainBackupBegin, /* 6.0.0 */ + .domainBackupGetXMLDesc =3D remoteDomainBackupGetXMLDesc, /* 6.0.0 */ }; static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 23e42d17b1..c79cb98ae8 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3754,6 +3754,23 @@ struct remote_domain_agent_set_response_timeout_ret { int result; }; + +struct remote_domain_backup_begin_args { + remote_nonnull_domain dom; + remote_string backup_xml; + remote_string checkpoint_xml; + unsigned int flags; +}; + +struct remote_domain_backup_get_xml_desc_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_backup_get_xml_desc_ret { + remote_nonnull_string xml; +}; + /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here.= */ @@ -6633,5 +6650,19 @@ enum remote_procedure { * @generate: both * @acl: domain:write */ - REMOTE_PROC_DOMAIN_AGENT_SET_RESPONSE_TIMEOUT =3D 420 + REMOTE_PROC_DOMAIN_AGENT_SET_RESPONSE_TIMEOUT =3D 420, + + /** + * @generate: both + * @acl: domain:checkpoint + * @acl: domain:block_write + */ + REMOTE_PROC_DOMAIN_BACKUP_BEGIN =3D 421, + + /** + * @generate: both + * @priority: high + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC =3D 422 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 9ad7a857e0..abc5c5fd2c 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -3122,6 +3122,19 @@ struct remote_domain_agent_set_response_timeout_args= { struct remote_domain_agent_set_response_timeout_ret { int result; }; +struct remote_domain_backup_begin_args { + remote_nonnull_domain dom; + remote_string backup_xml; + remote_string checkpoint_xml; + u_int flags; +}; +struct remote_domain_backup_get_xml_desc_args { + remote_nonnull_domain dom; + u_int flags; +}; +struct remote_domain_backup_get_xml_desc_ret { + remote_nonnull_string xml; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3543,4 +3556,6 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_GET_GUEST_INFO =3D 418, REMOTE_PROC_CONNECT_SET_IDENTITY =3D 419, REMOTE_PROC_DOMAIN_AGENT_SET_RESPONSE_TIMEOUT =3D 420, + REMOTE_PROC_DOMAIN_BACKUP_BEGIN =3D 421, + REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC =3D 422, }; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575393506; cv=none; d=zohomail.com; s=zohoarc; b=DUdWNOZ7Ehd/evaXMPdgLZg4JLjoPp6QgGrrNIpjXz4Dk9I4FQt9Zd5UJO7BWLJtwrNhKgH8av+qfkm+r1RR1QRmt4UbqMxWA3olp8Yf+9BBL/ZPe9ZKI2LaiYqVlR4K5Wop+rTYAVmrveplfYYDBlZfV2DnRrxX4Ls0fFCflfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393506; 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=lFZlotGqEMxHq00l9Vxoqwwok+hpHcmXiHryr1W7DRE=; b=Vx8E00Qv44hQ+B+iGcU5OkHbbOSZx4t/msroVlWXSG3x7v6YOs/6HjtdaJo/npySMXr8EfxOECXedIuW5/vD5R4EJ15KC2jEuABcknxPSuuHlLoxzBDXF7IGoZSEY8DFJU7OrEoH+Jqnewu8+UbtutqX7uaIXsKlh//Y008BMCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575393506026160.28866650556972; Tue, 3 Dec 2019 09:18:26 -0800 (PST) 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-376-2nIKGjCWNrGB-MKmterKxg-1; Tue, 03 Dec 2019 12:18:22 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32D9E801E79; Tue, 3 Dec 2019 17:18:12 +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 08A835DA75; Tue, 3 Dec 2019 17:18:12 +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 7E8F4180880D; Tue, 3 Dec 2019 17:18:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHv11002891 for ; Tue, 3 Dec 2019 12:17:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id B86B2600CE; Tue, 3 Dec 2019 17:17:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A248600CC for ; Tue, 3 Dec 2019 17:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393504; 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=lFZlotGqEMxHq00l9Vxoqwwok+hpHcmXiHryr1W7DRE=; b=Y5XJahbV0FIuisW4WvXKIkc+waVN8EzY2bela1cL4tn21BAHJvJUg4dIf6vd6JqbrYNRdM N9C4iqtJUH/q/OrCx03+UowZ0kxcM2SBQoC7A/1YJXAIWEjbo3IQDmdaXxYsN8KehGKqvY nzgS7LSsWJSNMcrMhW9H/0tpvEWBQ6k= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 08/25] backup: Parse and output backup XML 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.14 X-MC-Unique: 2nIKGjCWNrGB-MKmterKxg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake Accept XML describing a generic block job, and output it again as needed. This may still need a few tweaks to match the documented XML and RNG schema. Signed-off-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- po/POTFILES.in | 1 + src/conf/Makefile.inc.am | 2 + src/conf/backup_conf.c | 499 +++++++++++++++++++++++++++++++++++++++ src/conf/backup_conf.h | 101 ++++++++ src/conf/virconftypes.h | 3 + src/libvirt_private.syms | 8 + 6 files changed, 614 insertions(+) create mode 100644 src/conf/backup_conf.c create mode 100644 src/conf/backup_conf.h diff --git a/po/POTFILES.in b/po/POTFILES.in index debb51cd70..0ff3beeb7e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -19,6 +19,7 @@ @SRCDIR@/src/bhyve/bhyve_monitor.c @SRCDIR@/src/bhyve/bhyve_parse_command.c @SRCDIR@/src/bhyve/bhyve_process.c +@SRCDIR@/src/conf/backup_conf.c @SRCDIR@/src/conf/capabilities.c @SRCDIR@/src/conf/checkpoint_conf.c @SRCDIR@/src/conf/cpu_conf.c diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am index 5035b9b524..debc6f4eef 100644 --- a/src/conf/Makefile.inc.am +++ b/src/conf/Makefile.inc.am @@ -12,6 +12,8 @@ NETDEV_CONF_SOURCES =3D \ $(NULL) DOMAIN_CONF_SOURCES =3D \ + conf/backup_conf.c \ + conf/backup_conf.h \ conf/capabilities.c \ conf/capabilities.h \ conf/checkpoint_conf.c \ diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c new file mode 100644 index 0000000000..aaafdf12a2 --- /dev/null +++ b/src/conf/backup_conf.c @@ -0,0 +1,499 @@ +/* + * backup_conf.c: domain backup XML processing + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "configmake.h" +#include "internal.h" +#include "virbuffer.h" +#include "datatypes.h" +#include "domain_conf.h" +#include "virlog.h" +#include "viralloc.h" +#include "backup_conf.h" +#include "virstoragefile.h" +#include "virfile.h" +#include "virerror.h" +#include "virxml.h" +#include "virstring.h" +#include "virhash.h" +#include "virenum.h" + +#define VIR_FROM_THIS VIR_FROM_DOMAIN + +VIR_LOG_INIT("conf.backup_conf"); + +VIR_ENUM_DECL(virDomainBackup); +VIR_ENUM_IMPL(virDomainBackup, + VIR_DOMAIN_BACKUP_TYPE_LAST, + "default", + "push", + "pull"); + +/* following values appear in the status XML */ +VIR_ENUM_DECL(virDomainBackupDiskState); +VIR_ENUM_IMPL(virDomainBackupDiskState, + VIR_DOMAIN_BACKUP_DISK_STATE_LAST, + "", + "running", + "complete", + "failed", + "cancelling", + "cancelled"); + +void +virDomainBackupDefFree(virDomainBackupDefPtr def) +{ + size_t i; + + if (!def) + return; + + g_free(def->incremental); + virStorageNetHostDefFree(1, def->server); + + for (i =3D 0; i < def->ndisks; i++) { + virDomainBackupDiskDefPtr disk =3D def->disks + i; + + g_free(disk->name); + virObjectUnref(disk->store); + } + + g_free(def->disks); + g_free(def); +} + + +static int +virDomainBackupDiskDefParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virDomainBackupDiskDefPtr def, + bool push, + unsigned int flags, + virDomainXMLOptionPtr xmlopt) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt); + g_autofree char *type =3D NULL; + g_autofree char *driver =3D NULL; + g_autofree char *backup =3D NULL; + g_autofree char *state =3D NULL; + int tmp; + xmlNodePtr srcNode; + unsigned int storageSourceParseFlags =3D 0; + bool internal =3D flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL; + + if (internal) + storageSourceParseFlags =3D VIR_DOMAIN_DEF_PARSE_STATUS; + + ctxt->node =3D node; + + if (!(def->name =3D virXMLPropString(node, "name"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing name from disk backup element")); + return -1; + } + + def->backup =3D VIR_TRISTATE_BOOL_YES; + + if ((backup =3D virXMLPropString(node, "backup"))) { + if ((tmp =3D virTristateBoolTypeFromString(backup)) <=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("invalid disk 'backup' state '%s'"), backup); + return -1; + } + + def->backup =3D tmp; + } + + /* don't parse anything else if backup is disabled */ + if (def->backup =3D=3D VIR_TRISTATE_BOOL_NO) + return 0; + + if (internal) { + tmp =3D 0; + if (!(state =3D virXMLPropString(node, "state")) || + (tmp =3D virDomainBackupDiskStateTypeFromString(state)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("disk '%s' backup state wrong or missing'"), = def->name); + return -1; + } + + def->state =3D tmp; + } + + if (!(def->store =3D virStorageSourceNew())) + return -1; + + if ((type =3D virXMLPropString(node, "type"))) { + if ((def->store->type =3D virStorageTypeFromString(type)) <=3D 0 || + def->store->type =3D=3D VIR_STORAGE_TYPE_VOLUME || + def->store->type =3D=3D VIR_STORAGE_TYPE_DIR) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown disk backup type '%s'"), type); + return -1; + } + } else { + def->store->type =3D VIR_STORAGE_TYPE_FILE; + } + + if (push) + srcNode =3D virXPathNode("./target", ctxt); + else + srcNode =3D virXPathNode("./scratch", ctxt); + + if (srcNode && + virDomainStorageSourceParse(srcNode, ctxt, def->store, + storageSourceParseFlags, xmlopt) < 0) + return -1; + + if ((driver =3D virXPathString("string(./driver/@type)", ctxt))) { + def->store->format =3D virStorageFileFormatTypeFromString(driver); + if (def->store->format <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk backup driver '%s'"), driver); + return -1; + } else if (!push && def->store->format !=3D VIR_STORAGE_FILE_QCOW2= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("pull mode requires qcow2 driver, not '%s'"), + driver); + return -1; + } + } + + return 0; +} + + +static virDomainBackupDefPtr +virDomainBackupDefParse(xmlXPathContextPtr ctxt, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + g_autoptr(virDomainBackupDef) def =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; + xmlNodePtr node =3D NULL; + g_autofree char *mode =3D NULL; + bool push; + size_t i; + int n; + + def =3D g_new0(virDomainBackupDef, 1); + + def->type =3D VIR_DOMAIN_BACKUP_TYPE_PUSH; + + if ((mode =3D virXMLPropString(ctxt->node, "mode"))) { + if ((def->type =3D virDomainBackupTypeFromString(mode)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown backup mode '%s'"), mode); + return NULL; + } + } + + push =3D def->type =3D=3D VIR_DOMAIN_BACKUP_TYPE_PUSH; + + def->incremental =3D virXPathString("string(./incremental)", ctxt); + + if ((node =3D virXPathNode("./server", ctxt))) { + if (def->type !=3D VIR_DOMAIN_BACKUP_TYPE_PULL) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("use of requires pull mode backup")); + return NULL; + } + + def->server =3D g_new0(virStorageNetHostDef, 1); + + if (virDomainStorageNetworkParseHost(node, def->server) < 0) + return NULL; + + if (def->server->transport =3D=3D VIR_STORAGE_NET_HOST_TRANS_RDMA)= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("transport rdma is not supported for = ")); + return NULL; + } + + if (def->server->transport =3D=3D VIR_STORAGE_NET_HOST_TRANS_UNIX = && + def->server->socket[0] !=3D '/') { + virReportError(VIR_ERR_XML_ERROR, + _("backup socket path '%s' must be absolute"), + def->server->socket); + return NULL; + } + } + + if ((n =3D virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0) + return NULL; + + def->disks =3D g_new0(virDomainBackupDiskDef, n); + + def->ndisks =3D n; + for (i =3D 0; i < def->ndisks; i++) { + if (virDomainBackupDiskDefParseXML(nodes[i], ctxt, + &def->disks[i], push, + flags, xmlopt) < 0) + return NULL; + } + + return g_steal_pointer(&def); +} + + +virDomainBackupDefPtr +virDomainBackupDefParseString(const char *xmlStr, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + virDomainBackupDefPtr ret =3D NULL; + g_autoptr(xmlDoc) xml =3D NULL; + int keepBlanksDefault =3D xmlKeepBlanksDefault(0); + + if ((xml =3D virXMLParse(NULL, xmlStr, _("(domain_backup)")))) { + xmlKeepBlanksDefault(keepBlanksDefault); + ret =3D virDomainBackupDefParseNode(xml, xmlDocGetRootElement(xml), + xmlopt, flags); + } + xmlKeepBlanksDefault(keepBlanksDefault); + + return ret; +} + + +virDomainBackupDefPtr +virDomainBackupDefParseNode(xmlDocPtr xml, + xmlNodePtr root, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree char *schema =3D NULL; + + if (!virXMLNodeNameEqual(root, "domainbackup")) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("domainbackup")); + return NULL; + } + + if (!(flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL)) { + if (!(schema =3D virFileFindResource("domainbackup.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"))) + return NULL; + + if (virXMLValidateAgainstSchema(schema, xml) < 0) + return NULL; + } + + if (!(ctxt =3D virXMLXPathContextNew(xml))) + return NULL; + + ctxt->node =3D root; + return virDomainBackupDefParse(ctxt, xmlopt, flags); +} + + +static int +virDomainBackupDiskDefFormat(virBufferPtr buf, + virDomainBackupDiskDefPtr disk, + bool push, + bool internal) +{ + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + const char *sourcename =3D "scratch"; + unsigned int storageSourceFormatFlags =3D 0; + + if (push) + sourcename =3D "target"; + + if (internal) + storageSourceFormatFlags |=3D VIR_DOMAIN_DEF_FORMAT_STATUS; + + virBufferEscapeString(&attrBuf, " name=3D'%s'", disk->name); + virBufferAsprintf(&attrBuf, " backup=3D'%s'", virTristateBoolTypeToStr= ing(disk->backup)); + if (internal) + virBufferAsprintf(&attrBuf, " state=3D'%s'", virDomainBackupDiskSt= ateTypeToString(disk->state)); + + if (disk->backup =3D=3D VIR_TRISTATE_BOOL_YES) { + virBufferAsprintf(&attrBuf, " type=3D'%s'", virStorageTypeToString= (disk->store->type)); + + if (disk->store->format > 0) + virBufferEscapeString(&childBuf, "\n", + virStorageFileFormatTypeToString(disk->s= tore->format)); + + if (virDomainDiskSourceFormat(&childBuf, disk->store, sourcename, + 0, false, storageSourceFormatFlags, = NULL) < 0) + return -1; + } + + virXMLFormatElement(buf, "disk", &attrBuf, &childBuf); + return 0; +} + + +int +virDomainBackupDefFormat(virBufferPtr buf, + virDomainBackupDefPtr def, + bool internal) +{ + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) serverAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) disksChildBuf =3D VIR_BUFFER_INIT_CHILD(&childBuf); + size_t i; + + virBufferAsprintf(&attrBuf, " mode=3D'%s'", virDomainBackupTypeToStrin= g(def->type)); + + virBufferEscapeString(&childBuf, "%s\n", de= f->incremental); + + if (def->server) { + virBufferAsprintf(&serverAttrBuf, " transport=3D'%s'", + virStorageNetHostTransportTypeToString(def->serv= er->transport)); + virBufferEscapeString(&serverAttrBuf, " name=3D'%s'", def->server-= >name); + if (def->server->port) + virBufferAsprintf(&serverAttrBuf, " port=3D'%u'", def->server-= >port); + virBufferEscapeString(&serverAttrBuf, " socket=3D'%s'", def->serve= r->socket); + } + + virXMLFormatElement(&childBuf, "server", &serverAttrBuf, NULL); + + for (i =3D 0; i < def->ndisks; i++) { + if (virDomainBackupDiskDefFormat(&disksChildBuf, &def->disks[i], + def->type =3D=3D VIR_DOMAIN_BACKU= P_TYPE_PUSH, + internal) < 0) + return -1; + } + + virXMLFormatElement(&childBuf, "disks", NULL, &disksChildBuf); + virXMLFormatElement(buf, "domainbackup", &attrBuf, &childBuf); + + return 0; +} + + +static int +virDomainBackupDefAssignStore(virDomainBackupDiskDefPtr disk, + virStorageSourcePtr src, + const char *suffix) +{ + if (virStorageSourceIsEmpty(src)) { + if (disk->store) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk '%s' has no media"), disk->name); + return -1; + } + } else if (src->readonly) { + if (disk->store) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("backup of readonly disk '%s' makes no sense"= ), + disk->name); + return -1; + } + } else if (!disk->store) { + if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_FIL= E) { + if (!(disk->store =3D virStorageSourceNew())) + return -1; + + disk->store->type =3D VIR_STORAGE_TYPE_FILE; + disk->store->path =3D g_strdup_printf("%s.%s", src->path, suff= ix); + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("refusing to generate file name for disk '%s'= "), + disk->name); + return -1; + } + } + + return 0; +} + + +int +virDomainBackupAlignDisks(virDomainBackupDefPtr def, + virDomainDefPtr dom, + const char *suffix) +{ + g_autoptr(virHashTable) disks =3D NULL; + size_t i; + int ndisks; + bool backup_all =3D false; + + + if (!(disks =3D virHashNew(NULL))) + return -1; + + /* Unlikely to have a guest without disks but technically possible. */ + if (!dom->ndisks) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain must have at least one disk to perform ba= ckup")); + return -1; + } + + /* Double check requested disks. */ + for (i =3D 0; i < def->ndisks; i++) { + virDomainBackupDiskDefPtr backupdisk =3D &def->disks[i]; + virDomainDiskDefPtr domdisk; + + if (!(domdisk =3D virDomainDiskByTarget(dom, backupdisk->name))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("no disk named '%s'"), backupdisk->name); + return -1; + } + + if (virHashAddEntry(disks, backupdisk->name, NULL) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk '%s' specified twice"), + backupdisk->name); + return -1; + } + + if (backupdisk->backup =3D=3D VIR_TRISTATE_BOOL_YES && + virDomainBackupDefAssignStore(backupdisk, domdisk->src, suffix= ) < 0) + return -1; + } + + if (def->ndisks =3D=3D 0) + backup_all =3D true; + + ndisks =3D def->ndisks; + if (VIR_EXPAND_N(def->disks, def->ndisks, dom->ndisks - def->ndisks) <= 0) + return -1; + + for (i =3D 0; i < dom->ndisks; i++) { + virDomainBackupDiskDefPtr backupdisk =3D NULL; + virDomainDiskDefPtr domdisk =3D dom->disks[i]; + + if (virHashHasEntry(disks, domdisk->dst)) + continue; + + backupdisk =3D &def->disks[ndisks++]; + + if (VIR_STRDUP(backupdisk->name, domdisk->dst) < 0) + return -1; + + if (backup_all && + !virStorageSourceIsEmpty(domdisk->src) && + !domdisk->src->readonly) { + backupdisk->backup =3D VIR_TRISTATE_BOOL_YES; + + if (virDomainBackupDefAssignStore(backupdisk, domdisk->src, su= ffix) < 0) + return -1; + } else { + backupdisk->backup =3D VIR_TRISTATE_BOOL_NO; + } + } + + return 0; +} diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h new file mode 100644 index 0000000000..c970e01920 --- /dev/null +++ b/src/conf/backup_conf.h @@ -0,0 +1,101 @@ +/* + * backup_conf.h: domain backup XML processing + * (based on domain_conf.h) + * + * Copyright (C) 2006-2019 Red Hat, Inc. + * Copyright (C) 2006-2008 Daniel P. Berrange + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + +#include "internal.h" +#include "virconftypes.h" + +/* Items related to incremental backup state */ + +typedef enum { + VIR_DOMAIN_BACKUP_TYPE_DEFAULT =3D 0, + VIR_DOMAIN_BACKUP_TYPE_PUSH, + VIR_DOMAIN_BACKUP_TYPE_PULL, + + VIR_DOMAIN_BACKUP_TYPE_LAST +} virDomainBackupType; + +typedef enum { + VIR_DOMAIN_BACKUP_DISK_STATE_NONE =3D 0, + VIR_DOMAIN_BACKUP_DISK_STATE_RUNNING, + VIR_DOMAIN_BACKUP_DISK_STATE_COMPLETE, + VIR_DOMAIN_BACKUP_DISK_STATE_FAILED, + VIR_DOMAIN_BACKUP_DISK_STATE_CANCELLING, + VIR_DOMAIN_BACKUP_DISK_STATE_CANCELLED, + VIR_DOMAIN_BACKUP_DISK_STATE_LAST +} virDomainBackupDiskState; + +/* Stores disk-backup information */ +typedef struct _virDomainBackupDiskDef virDomainBackupDiskDef; +typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr; +struct _virDomainBackupDiskDef { + char *name; /* name matching the ndisks */ + virDomainBackupDiskDef *disks; +}; + +typedef enum { + VIR_DOMAIN_BACKUP_PARSE_INTERNAL =3D 1 << 0, +} virDomainBackupParseFlags; + +virDomainBackupDefPtr +virDomainBackupDefParseString(const char *xmlStr, + virDomainXMLOptionPtr xmlopt, + unsigned int flags); + +virDomainBackupDefPtr +virDomainBackupDefParseNode(xmlDocPtr xml, + xmlNodePtr root, + virDomainXMLOptionPtr xmlopt, + unsigned int flags); +void +virDomainBackupDefFree(virDomainBackupDefPtr def); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainBackupDef, virDomainBackupDefFree); + +int +virDomainBackupDefFormat(virBufferPtr buf, + virDomainBackupDefPtr def, + bool internal); +int +virDomainBackupAlignDisks(virDomainBackupDefPtr backup, + virDomainDefPtr dom, + const char *suffix); diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index 462842f324..9ed9b68b65 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -93,6 +93,9 @@ typedef virDomainABIStability *virDomainABIStabilityPtr; typedef struct _virDomainActualNetDef virDomainActualNetDef; typedef virDomainActualNetDef *virDomainActualNetDefPtr; +typedef struct _virDomainBackupDef virDomainBackupDef; +typedef virDomainBackupDef *virDomainBackupDefPtr; + typedef struct _virDomainBIOSDef virDomainBIOSDef; typedef virDomainBIOSDef *virDomainBIOSDefPtr; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8fe0bf9365..c7f4c3fb44 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -42,6 +42,14 @@ virAccessPermStorageVolTypeFromString; virAccessPermStorageVolTypeToString; +# conf/backup_conf.h +virDomainBackupAlignDisks; +virDomainBackupDefFormat; +virDomainBackupDefFree; +virDomainBackupDefParseNode; +virDomainBackupDefParseString; + + # conf/capabilities.h virCapabilitiesAddGuest; virCapabilitiesAddGuestDomain; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575393545; cv=none; d=zohomail.com; s=zohoarc; b=m8kJc7FQzHySs0Fzb8S6oMaUMD7zOotKUicbQaqBqnwNRW7Khf5kWi0JN1LtoU/6qp58GJIV03/D/ZTXFVR4MxkZmvRJZ9aoQcmcuRnAE4MiCpKTJRBzbAAtHb+/DXDktcxz6eJLGJm6TNz0zKvb4dZqzCjXoSudf/LBKMjV4q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393545; 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=yyHaCH07dbZoOSXhqAOrwbegBTIVegSFX7ZdZ1kJGP8=; b=D5x0pF6ZKJMVmR5X57YvCClZosJJC1Fezj7A7VUa2ZRGvbmgfYjWe7sDmSy5Raa2HeJe7NYl7WQ7/SnbNIW93s+7HNGyMpLODkWAT5An1/Feby1BGEeo+W3VYL0vv/PDZxEZlO0s/4EH/u3v+vKT46OaDAcRAycUSf6jwlyCLgw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575393545082663.5118317405362; Tue, 3 Dec 2019 09:19:05 -0800 (PST) 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-364-t6r0Zkj8PYqAKzlBGIMkpQ-1; Tue, 03 Dec 2019 12:18:22 -0500 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 CDF9C101F4E6; Tue, 3 Dec 2019 17:18:15 +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 A6ED15D6B7; Tue, 3 Dec 2019 17:18:15 +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 3359E5BC12; Tue, 3 Dec 2019 17:18:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHwDb002897 for ; Tue, 3 Dec 2019 12:17:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 87541600CE; Tue, 3 Dec 2019 17:17:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FB0B600CC for ; Tue, 3 Dec 2019 17:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393542; 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=yyHaCH07dbZoOSXhqAOrwbegBTIVegSFX7ZdZ1kJGP8=; b=dRSvsx136lmLsRVj1PbUBoeMZDevz46B1PbNi7OX6wawfW1y0ufxLVhgVZrkd/uC8al4Vj JTj2BzUpWW1b3m8ChSLtBgi4NocWbh/IwS/qseS/t5/Df6gCJ0nCtruAdxYYVogJz/E+7O M18sh4ldiCjirFjF+IuU7UzZG911mAs= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:31 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 09/25] tests: genericxml2xml: Add testing of backup XML files 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-MC-Unique: t6r0Zkj8PYqAKzlBGIMkpQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that the parser and formatter are in place we can excercise it on the test files. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- tests/Makefile.am | 1 + .../backup-pull-seclabel.xml | 18 ++++++++ tests/domainbackupxml2xmlout/backup-pull.xml | 10 ++++ .../backup-push-seclabel.xml | 17 +++++++ tests/domainbackupxml2xmlout/backup-push.xml | 10 ++++ tests/domainbackupxml2xmlout/empty.xml | 1 + tests/genericxml2xmltest.c | 46 +++++++++++++++++++ tests/virschematest.c | 3 +- 8 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 tests/domainbackupxml2xmlout/backup-pull-seclabel.xml create mode 100644 tests/domainbackupxml2xmlout/backup-pull.xml create mode 100644 tests/domainbackupxml2xmlout/backup-push-seclabel.xml create mode 100644 tests/domainbackupxml2xmlout/backup-push.xml create mode 100644 tests/domainbackupxml2xmlout/empty.xml diff --git a/tests/Makefile.am b/tests/Makefile.am index ea9e2b2ad0..75eee0006c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -92,6 +92,7 @@ EXTRA_DIST =3D \ cputestdata \ domaincapsdata \ domainbackupxml2xmlin \ + domainbackupxml2xmlout \ domainconfdata \ domainschemadata \ fchostdata \ diff --git a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml b/tests/= domainbackupxml2xmlout/backup-pull-seclabel.xml new file mode 100644 index 0000000000..c631c9b979 --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml @@ -0,0 +1,18 @@ + + 1525889631 + + + + + + + + + + + + + + + + diff --git a/tests/domainbackupxml2xmlout/backup-pull.xml b/tests/domainbac= kupxml2xmlout/backup-pull.xml new file mode 100644 index 0000000000..24fce9c0e7 --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-pull.xml @@ -0,0 +1,10 @@ + + 1525889631 + + + + + + + + diff --git a/tests/domainbackupxml2xmlout/backup-push-seclabel.xml b/tests/= domainbackupxml2xmlout/backup-push-seclabel.xml new file mode 100644 index 0000000000..9986889ba3 --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-push-seclabel.xml @@ -0,0 +1,17 @@ + + 1525889631 + + + + + + + + + + + + + + + diff --git a/tests/domainbackupxml2xmlout/backup-push.xml b/tests/domainbac= kupxml2xmlout/backup-push.xml new file mode 100644 index 0000000000..1997c814ae --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-push.xml @@ -0,0 +1,10 @@ + + 1525889631 + + + + + + + + diff --git a/tests/domainbackupxml2xmlout/empty.xml b/tests/domainbackupxml= 2xmlout/empty.xml new file mode 100644 index 0000000000..b1ba4953be --- /dev/null +++ b/tests/domainbackupxml2xmlout/empty.xml @@ -0,0 +1 @@ + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 0d04413712..1376221ef8 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -8,6 +8,7 @@ #include "testutils.h" #include "internal.h" #include "virstring.h" +#include "conf/backup_conf.h" #define VIR_FROM_THIS VIR_FROM_NONE @@ -44,6 +45,41 @@ testCompareXMLToXMLHelper(const void *data) } +static int +testCompareBackupXML(const void *data) +{ + const char *testname =3D data; + g_autofree char *xml_in =3D NULL; + g_autofree char *file_in =3D NULL; + g_autofree char *file_out =3D NULL; + g_autoptr(virDomainBackupDef) backup =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + g_autofree char *actual =3D NULL; + + file_in =3D g_strdup_printf("%s/domainbackupxml2xmlin/%s.xml", + abs_srcdir, testname); + file_out =3D g_strdup_printf("%s/domainbackupxml2xmlout/%s.xml", + abs_srcdir, testname); + + if (virFileReadAll(file_in, 1024 * 64, &xml_in) < 0) + return -1; + + if (!(backup =3D virDomainBackupDefParseString(xml_in, xmlopt, 0))) { + VIR_TEST_VERBOSE("failed to parse backup def '%s'", file_in); + return -1; + } + + if (virDomainBackupDefFormat(&buf, backup, false) < 0) { + VIR_TEST_VERBOSE("failed to format backup def '%s'", file_in); + return -1; + } + + actual =3D virBufferContentAndReset(&buf); + + return virTestCompareToFile(actual, file_out); +} + + static int mymain(void) { @@ -149,6 +185,16 @@ mymain(void) DO_TEST_DIFFERENT("cputune"); +#define DO_TEST_BACKUP(name) \ + if (virTestRun("QEMU BACKUP XML-2-XML " name, testCompareBackupXML, na= me) < 0) \ + ret =3D -1; + + DO_TEST_BACKUP("empty"); + DO_TEST_BACKUP("backup-pull"); + DO_TEST_BACKUP("backup-pull-seclabel"); + DO_TEST_BACKUP("backup-push"); + DO_TEST_BACKUP("backup-push-seclabel"); + virObjectUnref(caps); virObjectUnref(xmlopt); diff --git a/tests/virschematest.c b/tests/virschematest.c index 5ae2d207d1..e4a440afb0 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -205,7 +205,8 @@ mymain(void) "genericxml2xmloutdata", "xlconfigdata", "libxlxml2domconf= igdata", "qemuhotplugtestdomains"); DO_TEST_DIR("domaincaps.rng", "domaincapsdata"); - DO_TEST_DIR("domainbackup.rng", "domainbackupxml2xmlin"); + DO_TEST_DIR("domainbackup.rng", "domainbackupxml2xmlin", + "domainbackupxml2xmlout"); DO_TEST_DIR("domaincheckpoint.rng", "qemudomaincheckpointxml2xmlin", "qemudomaincheckpointxml2xmlout"); DO_TEST_DIR("domainsnapshot.rng", "qemudomainsnapshotxml2xmlin", --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 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=1575393507; cv=none; d=zohomail.com; s=zohoarc; b=STQszWVplDaAsKUezw4LtehPk3FvSJfnZM3NeZcR+D9MeQevI7WRnEljNZgRoOrBW2JTt9VTMcYkE9k0Q4l6dgYBJgaEfH2W8q0DoujYx63qqRwZgsaT9U3fmqpJKxO4ZaUwBQMeFQIIVnknO//1BHU03Cr9SKaEc7uf2FKn7Ng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393507; 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=sJFU557VZ89CcUtYvwe5NobybU9bVO/6nUDQajiJVGo=; b=iq/4rZ00Wur48DTTpXj4nMcGq9gC+XADbTmXUbetEDtXZ69RssTxjy9bg4q5KnaOo4ENFM1gHYBzxZqSa3apcL8K55pkrnIDUzrAGQeIzzZOKNthZOgYwOc1g6qAVNckfos+hSoPhSRUqN2LDzf5kI5RR/zp4qztrI2Gw+dQ/0k= 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1575393507628571.4382969036552; Tue, 3 Dec 2019 09:18:27 -0800 (PST) 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-307-yVoTim3pPdC6hSNVt_AqHA-1; Tue, 03 Dec 2019 12:18:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD949107ACCD; Tue, 3 Dec 2019 17:18:08 +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 9346E5C240; Tue, 3 Dec 2019 17:18: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 514561808878; Tue, 3 Dec 2019 17:18:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HHxu7002919 for ; Tue, 3 Dec 2019 12:17:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 56D49600CE; Tue, 3 Dec 2019 17:17:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3760600CC for ; Tue, 3 Dec 2019 17:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393506; 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=sJFU557VZ89CcUtYvwe5NobybU9bVO/6nUDQajiJVGo=; b=ZxrbQiQFLnNBvZoce84B2hb8+cFaDCrwpj2eLevzfgWEt7Yhzi1z4qCZPbQxeCRr+7PdNo tZ/0k6FFi2WVw5ZFLb/zOXmBe8LpskH72jKEI+wS7sM6KZ1xpaL1cA4ULVHReLmYGD1fE2 4aCSuOrpCgeqfFnNceAyv10SpLnCHgY= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:32 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/25] backup: Implement virsh support for backup 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.16 X-MC-Unique: yVoTim3pPdC6hSNVt_AqHA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake Introduce virsh commands for performing backup jobs. Signed-off-by: Eric Blake Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- po/POTFILES.in | 1 + tools/Makefile.am | 1 + tools/virsh-backup.c | 151 +++++++++++++++++++++++++++++++++++++++++++ tools/virsh-backup.h | 21 ++++++ tools/virsh.c | 2 + tools/virsh.h | 1 + tools/virsh.pod | 31 +++++++++ 7 files changed, 208 insertions(+) create mode 100644 tools/virsh-backup.c create mode 100644 tools/virsh-backup.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 0ff3beeb7e..48f3f431ec 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -329,6 +329,7 @@ @SRCDIR@/src/vz/vz_utils.h @SRCDIR@/tests/virpolkittest.c @SRCDIR@/tools/libvirt-guests.sh.in +@SRCDIR@/tools/virsh-backup.c @SRCDIR@/tools/virsh-checkpoint.c @SRCDIR@/tools/virsh-completer-host.c @SRCDIR@/tools/virsh-console.c diff --git a/tools/Makefile.am b/tools/Makefile.am index 1a541a3984..b9d31838df 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -232,6 +232,7 @@ virt_login_shell_helper_CFLAGS =3D \ virsh_SOURCES =3D \ virsh.c virsh.h \ + virsh-backup.c virsh-backup.h\ virsh-checkpoint.c virsh-checkpoint.h \ virsh-completer.c virsh-completer.h \ virsh-completer-domain.c virsh-completer-domain.h \ diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c new file mode 100644 index 0000000000..04464c6bff --- /dev/null +++ b/tools/virsh-backup.c @@ -0,0 +1,151 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include +#include "virsh-backup.h" +#include "virsh-util.h" + +#include "internal.h" +#include "virfile.h" + +/* + * "backup-begin" command + */ +static const vshCmdInfo info_backup_begin[] =3D { + {.name =3D "help", + .data =3D N_("Start a disk backup of a live domain") + }, + {.name =3D "desc", + .data =3D N_("Use XML to start a full or incremental disk backup of a= live " + "domain, optionally creating a checkpoint") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_backup_begin[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL(0), + {.name =3D "backupxml", + .type =3D VSH_OT_STRING, + .help =3D N_("domain backup XML"), + }, + {.name =3D "checkpointxml", + .type =3D VSH_OT_STRING, + .help =3D N_("domain checkpoint XML"), + }, + {.name =3D "reuse-external", + .type =3D VSH_OT_BOOL, + .help =3D N_("reuse files provided by caller"), + }, + {.name =3D NULL} +}; + +static bool +cmdBackupBegin(vshControl *ctl, + const vshCmd *cmd) +{ + g_autoptr(virshDomain) dom =3D NULL; + const char *backup_from =3D NULL; + g_autofree char *backup_buffer =3D NULL; + const char *check_from =3D NULL; + g_autofree char *check_buffer =3D NULL; + unsigned int flags =3D 0; + + if (vshCommandOptBool(cmd, "reuse-external")) + flags |=3D VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (vshCommandOptStringReq(ctl, cmd, "backupxml", &backup_from) < 0) + return false; + + if (!backup_from) { + backup_buffer =3D g_strdup(""); + } else { + if (virFileReadAll(backup_from, VSH_MAX_XML_FILE, &backup_buffer) = < 0) { + vshSaveLibvirtError(); + return false; + } + } + + if (vshCommandOptStringReq(ctl, cmd, "checkpointxml", &check_from) < 0) + return false; + if (check_from) { + if (virFileReadAll(check_from, VSH_MAX_XML_FILE, &check_buffer) < = 0) { + vshSaveLibvirtError(); + return false; + } + } + + if (virDomainBackupBegin(dom, backup_buffer, check_buffer, flags) < 0) + return false; + + vshPrint(ctl, _("Backup started\n")); + return true; +} + + +/* + * "backup-dumpxml" command + */ +static const vshCmdInfo info_backup_dumpxml[] =3D { + {.name =3D "help", + .data =3D N_("Dump XML for an ongoing domain block backup job") + }, + {.name =3D "desc", + .data =3D N_("Backup Dump XML") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_backup_dumpxml[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL(0), + {.name =3D NULL} +}; + +static bool +cmdBackupDumpXML(vshControl *ctl, + const vshCmd *cmd) +{ + g_autoptr(virshDomain) dom =3D NULL; + g_autofree char *xml =3D NULL; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (!(xml =3D virDomainBackupGetXMLDesc(dom, 0))) + return false; + + vshPrint(ctl, "%s", xml); + return true; +} + + +const vshCmdDef backupCmds[] =3D { + {.name =3D "backup-begin", + .handler =3D cmdBackupBegin, + .opts =3D opts_backup_begin, + .info =3D info_backup_begin, + .flags =3D 0 + }, + {.name =3D "backup-dumpxml", + .handler =3D cmdBackupDumpXML, + .opts =3D opts_backup_dumpxml, + .info =3D info_backup_dumpxml, + .flags =3D 0 + }, + {.name =3D NULL} +}; diff --git a/tools/virsh-backup.h b/tools/virsh-backup.h new file mode 100644 index 0000000000..95c2f5a424 --- /dev/null +++ b/tools/virsh-backup.h @@ -0,0 +1,21 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + +#include "virsh.h" + +extern const vshCmdDef backupCmds[]; diff --git a/tools/virsh.c b/tools/virsh.c index 8c0e9d960d..e70711f5d2 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -47,6 +47,7 @@ #include "virstring.h" #include "virgettext.h" +#include "virsh-backup.h" #include "virsh-checkpoint.h" #include "virsh-console.h" #include "virsh-domain.h" @@ -831,6 +832,7 @@ static const vshCmdGrp cmdGroups[] =3D { {VIRSH_CMD_GRP_NODEDEV, "nodedev", nodedevCmds}, {VIRSH_CMD_GRP_SECRET, "secret", secretCmds}, {VIRSH_CMD_GRP_SNAPSHOT, "snapshot", snapshotCmds}, + {VIRSH_CMD_GRP_BACKUP, "backup", backupCmds}, {VIRSH_CMD_GRP_STORAGE_POOL, "pool", storagePoolCmds}, {VIRSH_CMD_GRP_STORAGE_VOL, "volume", storageVolCmds}, {VIRSH_CMD_GRP_VIRSH, "virsh", virshCmds}, diff --git a/tools/virsh.h b/tools/virsh.h index b4e610b2a4..d84659124a 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -51,6 +51,7 @@ #define VIRSH_CMD_GRP_NWFILTER "Network Filter" #define VIRSH_CMD_GRP_SECRET "Secret" #define VIRSH_CMD_GRP_SNAPSHOT "Snapshot" +#define VIRSH_CMD_GRP_BACKUP "Backup" #define VIRSH_CMD_GRP_HOST_AND_HV "Host and Hypervisor" #define VIRSH_CMD_GRP_VIRSH "Virsh itself" diff --git a/tools/virsh.pod b/tools/virsh.pod index a8331154e1..b04f7c0fdc 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1327,6 +1327,37 @@ addresses, currently 'lease' to read DHCP leases, 'a= gent' to query the guest OS via an agent, or 'arp' to get IP from host's arp tables. If unspecified, 'lease' is the default. +=3Ditem B I [I] [I] +[I<--reuse-external>] + +Begin a new backup job. If I is omitted, this defaults to a full +backup using a push model to filenames generated by libvirt; supplying XML +allows fine-tuning such as requesting an incremental backup relative to an +earlier checkpoint, controlling which disks participate or which +filenames are involved, or requesting the use of a pull model backup. +The B command shows any resulting values assigned by +libvirt. For more information on backup XML, see: +L. + +If I<--reuse-external> is used it instructs libvirt to reuse temporary +and output files provided by the user in I. + +If I is specified, a second file with a top-level +element of is used to create a simultaneous +checkpoint, for doing a later incremental backup relative to the time +the backup was created. See B for more details on +checkpoints. + +This command returns as soon as possible, and the backup job runs in +the background; the progress of a push model backup can be checked +with B or by waiting for an event with B (the +progress of a pull model backup is under the control of whatever third +party connects to the NBD export). The job is ended with B. + +=3Ditem B I + +Output XML describing the current backup job. + =3Ditem B I [I<--inactive>] Print a table showing the brief information of all virtual interfaces --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1575393547; cv=none; d=zohomail.com; s=zohoarc; b=g0W/FyMNRof+Fx3Ohu8i+S2JdlnCCjXmHta32dRi2KWIYj1ntwAEySyqzfL4FCW/LIbzTlkVPTXmCFouSGxhQKZDCWRwP6RtgNZi+bNfOOCS6GPXqgxmPbmF6hBOj4VmYwZjYpIwbw4XcSeobQvbpZO4BOvKur1FT5fuaU2NJqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393547; 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=h5be7qbRhxI/Zbj2FHgUPVLQgj6bf/zapeEeLZ6ESuI=; b=K/UREJ7ZUtyy25eumGmtClXr7N4ZDbnq0FU6A3xBFJ7k229RaCWQLZ2eQeegAc+Q5CvgnhBWI6TrhZKVKXQ4zaRlNjY0in6AGpwt6xpf8qpxBZ5hfyRe1cAZgnmdEqMiFZlQmaGw8Bp72sv0ACkIxfqZW2uMF7NRTbyQprAmHtQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575393547543852.8951365223716; Tue, 3 Dec 2019 09:19:07 -0800 (PST) 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-284-SfNgv-bPO5SYtr7ynYQgSg-1; Tue, 03 Dec 2019 12:18:13 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF049107ACFC; Tue, 3 Dec 2019 17:18:03 +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 78D0919756; Tue, 3 Dec 2019 17:18:03 +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 1D40E18089D8; Tue, 3 Dec 2019 17:18:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI0bR002932 for ; Tue, 3 Dec 2019 12:18:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 279B4600CE; Tue, 3 Dec 2019 17:18:00 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4668600CC for ; Tue, 3 Dec 2019 17:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393546; 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=h5be7qbRhxI/Zbj2FHgUPVLQgj6bf/zapeEeLZ6ESuI=; b=jISU79v7XpgBRqYTclcEBF7bG0ab5lVy0ZdGn82L1bFxLWHv1I0V24R6ul5nBT2JvDrwu3 /Cvx4cNHBn/1LGcp9SyKRmR4kIiyQ+xqBVm4m0kxGnRv0GetjlOSzLrNpliAQ4NW3NqYDr qLMBiqgQCakgvCfBpqMghmlXm+b9WjY= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:33 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 11/25] qemu: Add infrastructure for statistics of a backup job 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.84 on 10.5.11.23 X-MC-Unique: SfNgv-bPO5SYtr7ynYQgSg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP and the convertors and other plumbing to be able to report statistics for the backup job. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 62 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 10 +++++++ src/qemu/qemu_driver.c | 4 +++ 3 files changed, 76 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8d2923300d..c1b0f81c81 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -519,6 +519,12 @@ qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo, info->memRemaining =3D info->memTotal - info->memProcessed; break; + case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP: + info->fileTotal =3D jobInfo->stats.backup.total; + info->fileProcessed =3D jobInfo->stats.backup.transferred; + info->fileRemaining =3D info->fileTotal - info->fileProcessed; + break; + case QEMU_DOMAIN_JOB_STATS_TYPE_NONE: break; } @@ -751,6 +757,59 @@ qemuDomainDumpJobInfoToParams(qemuDomainJobInfoPtr job= Info, } +static int +qemuDomainBackupJobInfoToParams(qemuDomainJobInfoPtr jobInfo, + int *type, + virTypedParameterPtr *params, + int *nparams) +{ + qemuDomainBackupStats *stats =3D &jobInfo->stats.backup; + g_autoptr(virTypedParamList) par =3D g_new0(virTypedParamList, 1); + + if (virTypedParamListAddInt(par, jobInfo->operation, + VIR_DOMAIN_JOB_OPERATION) < 0) + return -1; + + if (virTypedParamListAddULLong(par, jobInfo->timeElapsed, + VIR_DOMAIN_JOB_TIME_ELAPSED) < 0) + return -1; + + if (stats->transferred > 0 || stats->total > 0) { + if (virTypedParamListAddULLong(par, stats->total, + VIR_DOMAIN_JOB_DISK_TOTAL) < 0) + return -1; + + if (virTypedParamListAddULLong(par, stats->transferred, + VIR_DOMAIN_JOB_DISK_PROCESSED) < 0) + return -1; + + if (virTypedParamListAddULLong(par, stats->total - stats->transfer= red, + VIR_DOMAIN_JOB_DISK_REMAINING) < 0) + return -1; + } + + if (stats->tmp_used > 0 || stats->tmp_total > 0) { + if (virTypedParamListAddULLong(par, stats->tmp_used, + VIR_DOMAIN_JOB_DISK_TEMP_USED) < 0) + return -1; + + if (virTypedParamListAddULLong(par, stats->tmp_total, + VIR_DOMAIN_JOB_DISK_TEMP_TOTAL) < 0) + return -1; + } + + if (jobInfo->status !=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE && + virTypedParamListAddBoolean(par, + jobInfo->status =3D=3D QEMU_DOMAIN_JOB= _STATUS_COMPLETED, + VIR_DOMAIN_JOB_SUCCESS) < 0) + return -1; + + *nparams =3D virTypedParamListStealParams(par, params); + *type =3D qemuDomainJobStatusToType(jobInfo->status); + return 0; +} + + int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo, int *type, @@ -765,6 +824,9 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo, case QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP: return qemuDomainDumpJobInfoToParams(jobInfo, type, params, nparam= s); + case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP: + return qemuDomainBackupJobInfoToParams(jobInfo, type, params, npar= ams); + case QEMU_DOMAIN_JOB_STATS_TYPE_NONE: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid job statistics type")); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 608546a27c..a552af6180 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -126,6 +126,7 @@ typedef enum { QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION, QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP, QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP, + QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP, } qemuDomainJobStatsType; @@ -136,6 +137,14 @@ struct _qemuDomainMirrorStats { unsigned long long total; }; +typedef struct _qemuDomainBackupStats qemuDomainBackupStats; +struct _qemuDomainBackupStats { + unsigned long long transferred; + unsigned long long total; + unsigned long long tmp_used; + unsigned long long tmp_total; +}; + typedef struct _qemuDomainJobInfo qemuDomainJobInfo; typedef qemuDomainJobInfo *qemuDomainJobInfoPtr; struct _qemuDomainJobInfo { @@ -160,6 +169,7 @@ struct _qemuDomainJobInfo { union { qemuMonitorMigrationStats mig; qemuMonitorDumpStats dump; + qemuDomainBackupStats backup; } stats; qemuDomainMirrorStats mirrorStats; }; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1911073f3e..3ebc902d4f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13905,6 +13905,10 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr dri= ver, goto cleanup; break; + case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP: + /* TODO implement for backup job */ + break; + case QEMU_DOMAIN_JOB_STATS_TYPE_NONE: break; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1575393498; cv=none; d=zohomail.com; s=zohoarc; b=f/SXTF5rOKq9vAQSlDgPN3iySwS/gaaMjb3UqmuEZT/fb8eipYW8Y5YsCW2ogjqYhQg9/nphdoXtxURNVZklSbnL0ssO9BbMDUbd4DkRE+Q/ubLp28gzB1dUhKNKwWqkUusS4ot0SuT7RfLPw6MLV15ccwzzgFJg0Svz8nMz8lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393498; 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=EX6xZOUZI+y9+eqsWoHfhVdcAjFCFW3tH3BGmQHIZKQ=; b=iFyPA0nMvc6ECGXahAVMxkDQS2TEhzDV4KAuL/r1sn092gNljnt2rQDxmEuczkrkBMkdEOSTEA488Ak3bo/BKKg5xD0QK2dZZGVH7GJSNYwfAtDWjKonBECCGe63rA7OebyvNYoGb/6bXH5Br+cNYHsrCPdJm9wGHho39dHNhkA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575393498909547.967271611265; Tue, 3 Dec 2019 09:18:18 -0800 (PST) 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-186-Iz6k6vjwNWCwB5kBZ6RZUQ-1; Tue, 03 Dec 2019 12:18:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCA8F801E74; Tue, 3 Dec 2019 17:18:07 +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 84FD119C69; Tue, 3 Dec 2019 17:18:07 +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 2905E5BC05; Tue, 3 Dec 2019 17:18:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI00I002941 for ; Tue, 3 Dec 2019 12:18:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id EAF25600CE; Tue, 3 Dec 2019 17:18:00 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73B08600CC for ; Tue, 3 Dec 2019 17:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393497; 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=EX6xZOUZI+y9+eqsWoHfhVdcAjFCFW3tH3BGmQHIZKQ=; b=W2Wx1N4n2vEokzBkN/b93vGbKndmpALmwS5qzvFF5gDPRUTdUJWV9KdeMMOriL2igyLwF/ XtXDyMaM8fAZTWNEVYb40EydFK+iIKJbI1ScZ9jyuZYFmRbZzc5iyY+yeU4EL+kDNw7k9t GWF8q61I0B3XeNWi3qotPBqisVSqo1A= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 12/25] qemu: domain: Introduce QEMU_ASYNC_JOB_BACKUP async job type 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.84 on 10.5.11.23 X-MC-Unique: Iz6k6vjwNWCwB5kBZ6RZUQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We will want to use the async job infrastructure along with all the APIs and event for the backup job so add the backup job as a new async job type. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 3 +++ src/qemu/qemu_domain.h | 1 + src/qemu/qemu_migration.c | 2 ++ src/qemu/qemu_process.c | 25 +++++++++++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c1b0f81c81..4c8ffd60b0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -114,6 +114,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob, "dump", "snapshot", "start", + "backup", ); VIR_ENUM_IMPL(qemuDomainNamespace, @@ -210,6 +211,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, case QEMU_ASYNC_JOB_SNAPSHOT: case QEMU_ASYNC_JOB_START: case QEMU_ASYNC_JOB_NONE: + case QEMU_ASYNC_JOB_BACKUP: G_GNUC_FALLTHROUGH; case QEMU_ASYNC_JOB_LAST: break; @@ -235,6 +237,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob jo= b, case QEMU_ASYNC_JOB_SNAPSHOT: case QEMU_ASYNC_JOB_START: case QEMU_ASYNC_JOB_NONE: + case QEMU_ASYNC_JOB_BACKUP: G_GNUC_FALLTHROUGH; case QEMU_ASYNC_JOB_LAST: break; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a552af6180..4cd7eec4ce 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -104,6 +104,7 @@ typedef enum { QEMU_ASYNC_JOB_DUMP, QEMU_ASYNC_JOB_SNAPSHOT, QEMU_ASYNC_JOB_START, + QEMU_ASYNC_JOB_BACKUP, QEMU_ASYNC_JOB_LAST } qemuDomainAsyncJob; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index dabdda2715..d0e2b65d01 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1415,6 +1415,8 @@ qemuMigrationJobName(virDomainObjPtr vm) return _("snapshot job"); case QEMU_ASYNC_JOB_START: return _("start job"); + case QEMU_ASYNC_JOB_BACKUP: + return _("backup job"); case QEMU_ASYNC_JOB_LAST: default: return _("job"); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 75ee3893c6..cca280992f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -89,6 +89,7 @@ #include "virresctrl.h" #include "virvsock.h" #include "viridentity.h" +#include "virthreadjob.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -3583,6 +3584,7 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv =3D vm->privateData; virDomainState state; int reason; + unsigned long long now; state =3D virDomainObjGetState(vm, &reason); @@ -3632,6 +3634,29 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver, /* Already handled in VIR_DOMAIN_PAUSED_STARTING_UP check. */ break; + case QEMU_ASYNC_JOB_BACKUP: + ignore_value(virTimeMillisNow(&now)); + + /* Restore the config of the async job which is not persisted */ + priv->jobs_queued++; + priv->job.asyncJob =3D QEMU_ASYNC_JOB_BACKUP; + priv->job.asyncOwnerAPI =3D virThreadJobGet(); + priv->job.asyncStarted =3D now; + + qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK | + JOB_MASK(QEMU_JOB_SUSPEND) | + JOB_MASK(QEMU_JOB_MODIFY))); + + /* We reset the job parameters for backup so that the job will look + * active. This is possible because we are able to recover the sta= te + * of blockjobs and also the backup job allows all sub-job types */ + priv->job.current =3D g_new0(qemuDomainJobInfo, 1); + priv->job.current->operation =3D VIR_DOMAIN_JOB_OPERATION_BACKUP; + priv->job.current->statsType =3D QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP; + priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_ACTIVE; + priv->job.current->started =3D now; + break; + case QEMU_ASYNC_JOB_NONE: case QEMU_ASYNC_JOB_LAST: break; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 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=1575393508; cv=none; d=zohomail.com; s=zohoarc; b=AXvSe0UTpnM4gKr0fdDbT2moc3U2oPsRmz+om5+U1tCpT4XxQ9hmNFDI8EOBhGb6wk6S5i81UotsamiJOJq02ZE1Gp78H+j+UvsX8tgoQynPrA46yVT8oG0CrC0WtsSOoeganmHb5yAJD6K4KYGG0qbVeH9xiAIUCZQ0QHMaZIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393508; 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=L9+vAEUGJlJ54JKyMBHdifJiiKT147FqqQ9kWCwzxNI=; b=RbmaUyrvbpV4LHraxaVxnH3NVVeaeJVGT3CjfhOUX7GYCq/eC8UiLOMekQtIFI7m5hzXEGDcPZW3c8sxv1lCC7oD/rUbC2lT9S62ajSVtZY3vLMpFa1wEZhF59bpvFnmO6u7bM9BbH/uFTMmbnuJutfmD38pMVvFXCk0O0GD4Qw= 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 1575393508868923.7163849731907; Tue, 3 Dec 2019 09:18:28 -0800 (PST) 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-291-HISTwTYIPFmzWImOZX96Aw-1; Tue, 03 Dec 2019 12:18:26 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A98A107ACFE; Tue, 3 Dec 2019 17:18:19 +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 6A99E19756; Tue, 3 Dec 2019 17:18:19 +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 2A6931803C41; Tue, 3 Dec 2019 17:18:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI1a8002958 for ; Tue, 3 Dec 2019 12:18:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id BDB10600F0; Tue, 3 Dec 2019 17:18:01 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43661600CC for ; Tue, 3 Dec 2019 17:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393507; 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=L9+vAEUGJlJ54JKyMBHdifJiiKT147FqqQ9kWCwzxNI=; b=etJEEo3KIsF4LNzB/weWw5PJYewiyGgVJ9DULoXvsd9gH2xze5b2ExezYYpCi40Z/054rT Lu8/nQ+gT+wKekxWZ/cKGQNkQoQA/7JPfiGEH5Xzj2xw+10iwKXKxY2a3RmIRuuCCIMisU pU44gbrhdn6C6oztSN6/+Dnhw76Vu5A= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:35 +0100 Message-Id: <93c801f8310554606ddbac84dfd2919864945c19.1575392645.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 13/25] Add 'backup' block job type 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.84 on 10.5.11.23 X-MC-Unique: HISTwTYIPFmzWImOZX96Aw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A backup job may consist of many backup sub-blockjobs. Add the new blockjob type and add all type converter strings. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- examples/c/misc/event-test.c | 3 +++ include/libvirt/libvirt-domain.h | 3 +++ src/conf/domain_conf.c | 2 +- src/qemu/qemu_blockjob.c | 3 +++ src/qemu/qemu_blockjob.h | 1 + src/qemu/qemu_domain.c | 4 ++++ src/qemu/qemu_driver.c | 1 + src/qemu/qemu_monitor_json.c | 4 ++++ tools/virsh-domain.c | 4 +++- 9 files changed, 23 insertions(+), 2 deletions(-) diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c index 5db572175d..ae282a5027 100644 --- a/examples/c/misc/event-test.c +++ b/examples/c/misc/event-test.c @@ -891,6 +891,9 @@ blockJobTypeToStr(int type) case VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT: return "active layer block commit"; + + case VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP: + return "backup"; } return "unknown"; diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 6d1c7f1a3b..f40096af88 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2446,6 +2446,9 @@ typedef enum { * exists as long as sync is active */ VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT =3D 4, + /* Backup (virDomainBackupBegin) */ + VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP =3D 5, + # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_BLOCK_JOB_TYPE_LAST # endif diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9580884747..78436a89a2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1227,7 +1227,7 @@ VIR_ENUM_IMPL(virDomainOsDefFirmware, VIR_ENUM_DECL(virDomainBlockJob); VIR_ENUM_IMPL(virDomainBlockJob, VIR_DOMAIN_BLOCK_JOB_TYPE_LAST, - "", "", "copy", "", "active-commit", + "", "", "copy", "", "active-commit", "", ); VIR_ENUM_IMPL(virDomainMemoryModel, diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index baa79ea80c..5455eaba65 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -65,6 +65,7 @@ VIR_ENUM_IMPL(qemuBlockjob, "copy", "commit", "active-commit", + "backup", "", "create", "broken"); @@ -1276,6 +1277,8 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlock= JobDataPtr job, qemuBlockJobProcessEventConcludedCopyAbort(driver, vm, job, as= yncJob); break; + case QEMU_BLOCKJOB_TYPE_BACKUP: + break; case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index fdfe2c57ec..4734984c99 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -60,6 +60,7 @@ typedef enum { QEMU_BLOCKJOB_TYPE_COPY =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY, QEMU_BLOCKJOB_TYPE_COMMIT =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT, QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT =3D VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_= COMMIT, + QEMU_BLOCKJOB_TYPE_BACKUP =3D VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP, /* Additional enum values local to qemu */ QEMU_BLOCKJOB_TYPE_INTERNAL, QEMU_BLOCKJOB_TYPE_CREATE, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4c8ffd60b0..980287d2a0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2603,6 +2603,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *p= ayload, virBufferAddLit(&attrBuf, " shallownew=3D'yes'"); break; + case QEMU_BLOCKJOB_TYPE_BACKUP: + break; case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: @@ -3169,6 +3171,8 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemu= BlockJobDataPtr job, } break; + case QEMU_BLOCKJOB_TYPE_BACKUP: + break; case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3ebc902d4f..913ab18812 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17427,6 +17427,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, case QEMU_BLOCKJOB_TYPE_PULL: case QEMU_BLOCKJOB_TYPE_COMMIT: + case QEMU_BLOCKJOB_TYPE_BACKUP: case QEMU_BLOCKJOB_TYPE_INTERNAL: case QEMU_BLOCKJOB_TYPE_CREATE: case QEMU_BLOCKJOB_TYPE_BROKEN: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f3783ab70..391f39668a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1147,6 +1147,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon, type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT; else if (STREQ(type_str, "mirror")) type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; + else if (STREQ(type_str, "backup")) + type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP; switch ((virConnectDomainEventBlockJobStatus) event) { case VIR_DOMAIN_BLOCK_JOB_COMPLETED: @@ -4844,6 +4846,8 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr bloc= kJobs, info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT; else if (STREQ(type, "mirror")) info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; + else if (STREQ(type, "backup")) + info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP; else info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 5c313279d7..b009e4bfcc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2550,7 +2550,9 @@ VIR_ENUM_IMPL(virshDomainBlockJob, N_("Block Pull"), N_("Block Copy"), N_("Block Commit"), - N_("Active Block Commit")); + N_("Active Block Commit"), + N_("Backup"), +); static const char * virshDomainBlockJobToString(int type) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 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-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=1575393561; cv=none; d=zohomail.com; s=zohoarc; b=SBIM6gFi4PVExvRgznfzA/Im6ht65mLbdiYzYyig6vtuZKhhMYicrlOaCkG72T5rJBdnLsjYU93Mj4D/400y9/XxUSDKFQ+v3EDeC8TCm0RYdZrk00UfoLnyTDR11GhoeCuXLZ55NsZ5AUXjnsWAC8GrQhdDrwK75SIFeA8+e/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393561; 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=ndtqxuxEYddroUQpaqpPO7lrn99UsNDXJO1DpxX6VSA=; b=fKqFAPWZQJpb72Gg8lMhDYv2tjjjbulo52e9KSaCzuMoVSHVhviqLgZSoyqUZqoVrcXG459ADQIxMDpqlyd8wIYsQJjm9vWuvv1VCzsAVJ81InXbyneTguSHRFOtMRVmOAfoOzLg5tIi3vr9rtz+anGh9IUfSWyWl4evn4qW5X4= 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1575393561028115.2252298061702; Tue, 3 Dec 2019 09:19:21 -0800 (PST) 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-298-lauSWfhdOqWMzJ7t3FNs-g-1; Tue, 03 Dec 2019 12:18:30 -0500 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 D06B48024CA; Tue, 3 Dec 2019 17:18:23 +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 98F3260C80; Tue, 3 Dec 2019 17:18:23 +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 508E15FBEF; Tue, 3 Dec 2019 17:18:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI4NT002985 for ; Tue, 3 Dec 2019 12:18:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7E63600C8; Tue, 3 Dec 2019 17:18:04 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30E4E600CC for ; Tue, 3 Dec 2019 17:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393559; 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=ndtqxuxEYddroUQpaqpPO7lrn99UsNDXJO1DpxX6VSA=; b=TZbpFKNagbMJnSeBCIOS9fzjzfn0xukIqx8XwIwVsy896wOEmcJg6K4wZ30AID+eDo6Yy6 uFQueb2NpXL30IXHpVH4Few9V0LZcKiX10j/wZk/763qpXxRmgyeGcqJnbluURlC+lbEDe 728hIRUs13BupSLUXFZQeDery6CrsrY= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:36 +0100 Message-Id: <4c93e1881c9a6f8a8e3c8b305dbd618c3e874a5c.1575392645.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 14/25] qemu: monitor: Add support for blockdev-backup via 'transaction' 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 X-MC-Unique: lauSWfhdOqWMzJ7t3FNs-g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Implement the transaction actions generator for blockdev-backup. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 13 +++++++++++++ src/qemu/qemu_monitor.h | 15 +++++++++++++++ src/qemu/qemu_monitor_json.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 8 ++++++++ tests/qemumonitorjsontest.c | 8 +++++++- 5 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a48305b046..6e6678eb9b 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4615,3 +4615,16 @@ qemuMonitorTransactionSnapshotBlockdev(virJSONValueP= tr actions, { return qemuMonitorJSONTransactionSnapshotBlockdev(actions, node, overl= ay); } + + +int +qemuMonitorTransactionBackup(virJSONValuePtr actions, + const char *device, + const char *jobname, + const char *target, + const char *bitmap, + qemuMonitorTransactionBackupSyncMode syncmode) +{ + return qemuMonitorJSONTransactionBackup(actions, device, jobname, targ= et, + bitmap, syncmode); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e2bfc420bb..79e078fca4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1392,3 +1392,18 @@ int qemuMonitorTransactionSnapshotBlockdev(virJSONValuePtr actions, const char *node, const char *overlay); + +typedef enum { + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_NONE =3D 0, + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_INCREMENTAL, + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_FULL, + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_LAST, +} qemuMonitorTransactionBackupSyncMode; + +int +qemuMonitorTransactionBackup(virJSONValuePtr actions, + const char *device, + const char *jobname, + const char *target, + const char *bitmap, + qemuMonitorTransactionBackupSyncMode syncmode= ); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 391f39668a..00e1d3ce15 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9198,6 +9198,35 @@ qemuMonitorJSONTransactionSnapshotBlockdev(virJSONVa= luePtr actions, NULL); } +VIR_ENUM_DECL(qemuMonitorTransactionBackupSyncMode); +VIR_ENUM_IMPL(qemuMonitorTransactionBackupSyncMode, + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_LAST, + "none", + "incremental", + "full"); + +int +qemuMonitorJSONTransactionBackup(virJSONValuePtr actions, + const char *device, + const char *jobname, + const char *target, + const char *bitmap, + qemuMonitorTransactionBackupSyncMode sync= mode) +{ + const char *syncmodestr =3D qemuMonitorTransactionBackupSyncModeTypeTo= String(syncmode); + + return qemuMonitorJSONTransactionAdd(actions, + "blockdev-backup", + "s:device", device, + "s:job-id", jobname, + "s:target", target, + "s:sync", syncmodestr, + "S:bitmap", bitmap, + "T:auto-finalize", VIR_TRISTATE_B= OOL_YES, + "T:auto-dismiss", VIR_TRISTATE_BO= OL_NO, + NULL); +} + static qemuMonitorJobInfoPtr qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 25b568d6b0..5d05772fa2 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -667,3 +667,11 @@ int qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValuePtr actions, const char *node, const char *overlay); + +int +qemuMonitorJSONTransactionBackup(virJSONValuePtr actions, + const char *device, + const char *jobname, + const char *target, + const char *bitmap, + qemuMonitorTransactionBackupSyncMode sync= mode); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 21f17f42af..4f3bfad1d7 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2962,7 +2962,13 @@ testQemuMonitorJSONTransaction(const void *opaque) qemuMonitorTransactionBitmapDisable(actions, "node4", "bitmap4") <= 0 || qemuMonitorTransactionBitmapMerge(actions, "node5", "bitmap5", &me= rgebitmaps) < 0 || qemuMonitorTransactionSnapshotLegacy(actions, "dev6", "path", "qco= w2", true) < 0 || - qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7= ") < 0) + qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7= ") < 0 || + qemuMonitorTransactionBackup(actions, "dev8", "job8", "target8", "= bitmap8", + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_= MODE_NONE) < 0 || + qemuMonitorTransactionBackup(actions, "dev9", "job9", "target9", "= bitmap9", + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_= MODE_INCREMENTAL) < 0 || + qemuMonitorTransactionBackup(actions, "devA", "jobA", "targetA", "= bitmapA", + QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_= MODE_FULL) < 0) return -1; if (qemuMonitorTestAddItem(test, "transaction", "{\"return\":{}}") < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1575393607; cv=none; d=zohomail.com; s=zohoarc; b=QvhuvfHIQMd+Gc+5m11Uu6WWMbIzjVzLt2CvYUjk5tKtKfIX6dKSmYozAOWWVnRLYyY/YIpvhVB9p2FkKexdwm0HdOyS3mvImbbjQTWkXEmKm9YX6gWkGZiF5CJVd3+zn8EbY5kMFZ+0LS4Rox7nx6V4R2jEms0GGERfdnVKcpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393607; 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=ELrG4E052U46elTdF87dfTfPShhtAkt2ijUvepy+tqo=; b=Ftnx4Dp5gcd3eGbaOM4Pu3lXwaQd+JxCecFNv7kfB4/5xW2V0tVqWbidYRybuVJp3gvPmoomhyI6eBzJhLJikmnYdW0MHgRGqq1UP+ynxOvRthqqnhB5l0X2OM6DhX2WSqRD/CVf0fqQBu6J4VJE6YO12l8/VsuyLaFSJLUhtes= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575393607285493.62637120950524; Tue, 3 Dec 2019 09:20:07 -0800 (PST) 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-8-zEQgKwluNZm_mfWMQDgFmA-1; Tue, 03 Dec 2019 12:18:22 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CF1818C35A6; Tue, 3 Dec 2019 17:18:12 +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 2F3455C1B5; Tue, 3 Dec 2019 17:18:12 +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 D35881800B6D; Tue, 3 Dec 2019 17:18:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI5ip002990 for ; Tue, 3 Dec 2019 12:18:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 79988600CC; Tue, 3 Dec 2019 17:18:05 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0050E600C8 for ; Tue, 3 Dec 2019 17:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393605; 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=ELrG4E052U46elTdF87dfTfPShhtAkt2ijUvepy+tqo=; b=AIkBUsxst3G1vXdScOQK2odQvlt4cEMTN+1D5V3wW5BmGKFBvr5Vs6JezwZrhYminnxkA+ ZB26FuefhdC5vu+LDEFYsnUTrbM+T11uXoFqhAQzS258Hl1OZ3l1fYDk44TlSI+5zBiPjH zEaGEp2kTIOiuZeZfTIAhIPa1u4cVXY= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:37 +0100 Message-Id: <745943bf8948d084844622450bfb8bc465781201.1575392645.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 15/25] qemu: domain: Track backup job data in the status XML 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.16 X-MC-Unique: zEQgKwluNZm_mfWMQDgFmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Store the data of a backup job along with the index counter for new backup jobs in the status XML. Currently we will support only one backup job and thus there's no necessity to add arrays of jobs. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 58 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 2 files changed, 61 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 980287d2a0..98d0dad861 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -62,6 +62,7 @@ #include "locking/domain_lock.h" #include "virdomainsnapshotobjlist.h" #include "virdomaincheckpointobjlist.h" +#include "backup_conf.h" #ifdef MAJOR_IN_MKDEV # include @@ -2236,6 +2237,9 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr= priv) priv->pflash0 =3D NULL; virObjectUnref(priv->pflash1); priv->pflash1 =3D NULL; + + virDomainBackupDefFree(priv->backup); + priv->backup =3D NULL; } @@ -2643,6 +2647,26 @@ qemuDomainObjPrivateXMLFormatBlockjobs(virBufferPtr = buf, } +static int +qemuDomainObjPrivateXMLFormatBackups(virBufferPtr buf, + virDomainObjPtr vm) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) + return 0; + + if (priv->backup && + virDomainBackupDefFormat(&childBuf, priv->backup, true) < 0) + return -1; + + virXMLFormatElement(buf, "backups", &attrBuf, &childBuf); + return 0; +} + + void qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf, virTristateBool allowReboot) @@ -2938,6 +2962,9 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, virBufferAsprintf(buf, "%i\n", priv->agen= tTimeout); + if (qemuDomainObjPrivateXMLFormatBackups(buf, vm) < 0) + return -1; + return 0; } @@ -3311,6 +3338,34 @@ qemuDomainObjPrivateXMLParseBlockjobs(virDomainObjPt= r vm, } +static int +qemuDomainObjPrivateXMLParseBackups(qemuDomainObjPrivatePtr priv, + xmlXPathContextPtr ctxt) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + ssize_t nnodes =3D 0; + + if ((nnodes =3D virXPathNodeSet("./backups/domainbackup", ctxt, &nodes= )) < 0) + return -1; + + if (nnodes > 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("only one backup job is supported")); + return -1; + } + + if (nnodes =3D=3D 0) + return 0; + + if (!(priv->backup =3D virDomainBackupDefParseNode(ctxt->doc, nodes[0], + priv->driver->xmlopt, + VIR_DOMAIN_BACKUP_PAR= SE_INTERNAL))) + return -1; + + return 0; +} + + int qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt, virTristateBool *allowReboot) @@ -3740,6 +3795,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, if (qemuDomainObjPrivateXMLParseBlockjobs(vm, priv, ctxt) < 0) goto error; + if (qemuDomainObjPrivateXMLParseBackups(priv, ctxt) < 0) + goto error; + qemuDomainStorageIdReset(priv); if (virXPathULongLong("string(./nodename/@index)", ctxt, &priv->nodenameindex) =3D=3D -2) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 4cd7eec4ce..e07c8aa58f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -414,6 +414,9 @@ struct _qemuDomainObjPrivate { * commandline for pflash drives. */ virStorageSourcePtr pflash0; virStorageSourcePtr pflash1; + + /* running backup job */ + virDomainBackupDefPtr backup; }; #define QEMU_DOMAIN_PRIVATE(vm) \ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 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=1575393544; cv=none; d=zohomail.com; s=zohoarc; b=jVq11XPupUhHy/IV5hGnkNiJoVj0HT5FY+QPer6FUma5dgDPrhb61wCvjTzqNA5+ClH1ooNKAm4lEgz4Zcm/1npQGE56u4B9Y5hbXI6kC3tavjjA19rXk2O3+D9eL402XoHI9Smp5NPV/tWBNSsF2foufYZo/SYZ8WhYgvUUoTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393544; 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=vgtN8l0OHonSTCekxrSCALU57mhwg21s7oB4A3Y9q40=; b=fn45UlTKgYq5dAsmEHAoVm1Hh4BZeaHXgxih4g3AHprb8KElNQm7bWJKLuQkfYwPBWqCT9vKSkzsSorD6ImldZHH0S4EKZI6DnsDZmU3/NwF55UJpVnE4PfOOHNq8DmNR+RcMdidMZHwBO60/FKgET6OEtpDgyyeyn+I+RrT+us= 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15753935448201012.1005618530933; Tue, 3 Dec 2019 09:19:04 -0800 (PST) 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-373-qknmzwZzM1S9-oDNO1tFDQ-1; Tue, 03 Dec 2019 12:18:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3634DC07; Tue, 3 Dec 2019 17:18:12 +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 8E6E3600C8; Tue, 3 Dec 2019 17:18:12 +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 47B605BBFF; Tue, 3 Dec 2019 17:18:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI6ak003000 for ; Tue, 3 Dec 2019 12:18:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4840F600CC; Tue, 3 Dec 2019 17:18:06 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C489D600C8 for ; Tue, 3 Dec 2019 17:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393543; 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=vgtN8l0OHonSTCekxrSCALU57mhwg21s7oB4A3Y9q40=; b=IgD9SNcd3UyRf4H3jQLC06WvBwQEqbs8U836p4NZIo9z2Fu4H/OLawr4rglQb03Skgd32/ 7az1GmD9CFZmzaX9V5jBTzYznfA89jHceOgtQTcwaWBzWqWPWCOSleykGxWO3pOOqCXuv2 KpRS2cAeDprLgV08MB1lq68yzRfV2Ds= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:38 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 16/25] qemu: blockjob: Track internal data for 'backup' blockjob 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.11 X-MC-Unique: qknmzwZzM1S9-oDNO1tFDQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A backup blockjob needs to be able to notify the parent backup job as well as track all data to be able to clean up the bitmap and blockdev used for the backup. Add the data structure, job allocation function and status XML formatter and parser. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.c | 34 +++++++++++++++++++++++++++++++++- src/qemu/qemu_blockjob.h | 18 ++++++++++++++++++ src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 5455eaba65..d434b8bddd 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -78,8 +78,12 @@ qemuBlockJobDataDisposeJobdata(qemuBlockJobDataPtr job) { if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_CREATE) virObjectUnref(job->data.create.src); -} + if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_BACKUP) { + virObjectUnref(job->data.backup.store); + g_free(job->data.backup.bitmap); + } +} static void qemuBlockJobDataDispose(void *obj) @@ -370,6 +374,34 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, } +qemuBlockJobDataPtr +qemuBlockJobDiskNewBackup(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr store, + bool deleteStore, + const char *bitmap) +{ + g_autoptr(qemuBlockJobData) job =3D NULL; + g_autofree char *jobname =3D NULL; + + jobname =3D g_strdup_printf("backup-%s-%s", disk->dst, disk->src->node= format); + + if (!(job =3D qemuBlockJobDataNew(QEMU_BLOCKJOB_TYPE_BACKUP, jobname))) + return NULL; + + job->data.backup.bitmap =3D g_strdup(bitmap); + job->data.backup.store =3D virObjectRef(store); + job->data.backup.deleteStore =3D deleteStore; + + /* backup jobs are usually started in bulk by transaction so the caller + * shall save the status XML */ + if (qemuBlockJobRegister(job, vm, disk, false) < 0) + return NULL; + + return g_steal_pointer(&job); +} + + /** * qemuBlockJobDiskGetJob: * @disk: disk definition diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 4734984c99..52b03aaf9e 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -107,6 +107,16 @@ struct _qemuBlockJobCopyData { }; +typedef struct _qemuBlockJobBackupData qemuBlockJobBackupData; +typedef qemuBlockJobBackupData *qemuBlockJobDataBackupPtr; + +struct _qemuBlockJobBackupData { + virStorageSourcePtr store; + bool deleteStore; + char *bitmap; +}; + + typedef struct _qemuBlockJobData qemuBlockJobData; typedef qemuBlockJobData *qemuBlockJobDataPtr; @@ -124,6 +134,7 @@ struct _qemuBlockJobData { qemuBlockJobCommitData commit; qemuBlockJobCreateData create; qemuBlockJobCopyData copy; + qemuBlockJobBackupData backup; } data; int type; /* qemuBlockJobType */ @@ -184,6 +195,13 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, bool shallow, bool reuse); +qemuBlockJobDataPtr +qemuBlockJobDiskNewBackup(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr store, + bool deleteStore, + const char *bitmap); + qemuBlockJobDataPtr qemuBlockJobDiskGetJob(virDomainDiskDefPtr disk) ATTRIBUTE_NONNULL(1); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 98d0dad861..f4f841526e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2608,6 +2608,18 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, break; case QEMU_BLOCKJOB_TYPE_BACKUP: + virBufferEscapeString(&childBuf, "\n", jo= b->data.backup.bitmap); + if (job->data.backup.store) { + if (qemuDomainObjPrivateXMLFormatBlockjobFormatSource(&chi= ldBuf, + "sto= re", + job-= >data.backup.store, + data= ->xmlopt, + fals= e) < 0) + return -1; + + if (job->data.backup.deleteStore) + virBufferAddLit(&childBuf, "\n"); + } break; case QEMU_BLOCKJOB_TYPE_BROKEN: @@ -3199,6 +3211,15 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qem= uBlockJobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_BACKUP: + job->data.backup.bitmap =3D virXPathString("string(./bitmap/@= name)", ctxt); + + if (!(tmp =3D virXPathNode("./store", ctxt)) || + !(job->data.backup.store =3D qemuDomainObjPrivateXMLParseB= lockjobChain(tmp, ctxt, xmlopt))) + goto broken; + + if (virXPathNode("./deleteStore", ctxt)) + job->data.backup.deleteStore =3D true; + break; case QEMU_BLOCKJOB_TYPE_BROKEN: --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1575393510; cv=none; d=zohomail.com; s=zohoarc; b=VsTGsP0cWfWLMGdlBEz5dwRDPa3cFKKuKgf4fDpAtQGPrVjJ0dzGe5aDLD4v/6JUOI3lRdMSLWZiRoz5JrfDyqs16ouWbvEwH4MtJjRtJ5JxsyAi4vuRxBwLKyuxLyChGtUDe4oggSdbcqrf6RLWM/Kr+SQb1iauO3zsiX+HcoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575393510; 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=F7gFJ578H9aPJVCgXJYHxd+mE00iC1AQBSVKOVo4fvg=; b=A46Z478Qh86lxWrchc+lP+XFyajjEqxRXajpIxzLpiVyDxaloyMaoY5u1IgmTQUhw5PJb4B6nQaJ46ioTh/hDJug24LjUfdUIUPJk892j017zXJZ3VW6kmKZ5X0V/ALAJeuo4txbb9BwGEe6pmtkVidkEvGvgxrrN0Znoeqb8vo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575393510487323.6789514308797; Tue, 3 Dec 2019 09:18:30 -0800 (PST) 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-393-FjWdciUZPnuMrvwZOUq91w-1; Tue, 03 Dec 2019 12:18:25 -0500 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 0858F8024D2; Tue, 3 Dec 2019 17:18:16 +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 D4D0C5D6BE; Tue, 3 Dec 2019 17:18:15 +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 8CF165BC15; Tue, 3 Dec 2019 17:18:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB3HI9Ir003018 for ; Tue, 3 Dec 2019 12:18:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id AF397600CE; Tue, 3 Dec 2019 17:18:09 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34B2C600C8 for ; Tue, 3 Dec 2019 17:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575393509; 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=F7gFJ578H9aPJVCgXJYHxd+mE00iC1AQBSVKOVo4fvg=; b=UB+VOLSEUjk+ITQJM5p58f6CIsjuAWbOSSf5XtJujohaRwbXHevR4dsgbAXFiJwuxsCn65 yWmTRCkDLTA5p1Z9sRkc/EHo7Ew6UW3PG3Aztn4GKE949lU9eIRWsMFN79sAsh9jwwuDVn F9xlcwOekgRtPrEjTYB9uWPIErQJkwA= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 18:17:39 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 17/25] tests: qemustatusxml2xml: Add test for 'pull' type backup job 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-MC-Unique: FjWdciUZPnuMrvwZOUq91w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- .../qemustatusxml2xmldata/backup-pull-in.xml | 608 ++++++++++++++++++ .../qemustatusxml2xmldata/backup-pull-out.xml | 1 + tests/qemuxml2xmltest.c | 2 + 3 files changed, 611 insertions(+) create mode 100644 tests/qemustatusxml2xmldata/backup-pull-in.xml create mode 120000 tests/qemustatusxml2xmldata/backup-pull-out.xml diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemusta= tusxml2xmldata/backup-pull-in.xml new file mode 100644 index 0000000000..6ef4965bed --- /dev/null +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -2 + + + 12345 + + + + + + + + + + copy + 0439a4a8-db56-4933-9183-d8681d7b0746 + 1024000 + 1024000 + 1 + + /machine + + + hvm + + + + + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + + + + + + + pull3.qcow2 + + + + + + + + + + + pull2.qcow2 + + + + + + + + + + + pull1.qcow2 + + + + + + + + + + + pull0.qcow2 + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + commit3.qcow2 + + + + + + + + + + + commit2.qcow2 + + + + + + + + + + + commit1.qcow2 + + + + + + + + + + + commit0.qcow2 + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + copy3.qcow2 + + + + + + + + + + + copy2.qcow2 + + + + + + + + + + + copy1.qcow2 + + + + + + + + + + + copy0.qcow2 + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + activecommit3.qcow2 + + + + + + + + + + + activecommit2.qcow2 + + + + + + + + + + + activecommit1.qcow2 + + + + + + + + + + + activecommit0.qcow2 + + + + + + + + + +
      + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + +