From nobody Tue Apr 16 06:19:53 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=1574804426; cv=none; d=zohomail.com; s=zohoarc; b=hispHF2W6QK3AghCGzZtWez+lBRAqbMy2Z2TkbRrplayRBTvoIdOCr+cJEHY1qdlq4gaiRqhzc9lXK4Q94MTZQz6sUGdICyQPcsit+RdE2AdV88lhhoyD9XodWDgGNDGqBxxXZD0/fbFnemL2DjMfdvGLZpUADPNKLZEiKuCJ8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804426; 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=dOnqg+Bl3iU678+dXlb4yJq922Tf/m7R+Ofqsf7Q230=; b=kHst1PmUDGZuf+NZzOzAnYbDJuzoqFMM+3yqi/wxh/cruLgD2wrpHVXUzumGekkhhyME+Pj5QC9zhhCuofzUGp7J22vfkbh0HJAVSTaOmAfuQ2YDz3rk/6904dE6s56AROXyfJyU2v/rfM1YNi+CRX9DMAhC8xX4h/Tj9unr59A= 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 1574804426061450.7758064829005; Tue, 26 Nov 2019 13:40: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-104-AD0j40KmOf2odZ0KzW4Kig-1; Tue, 26 Nov 2019 16:40:23 -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 943EADBA6; Tue, 26 Nov 2019 21:40:18 +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 D084B5D9CD; Tue, 26 Nov 2019 21:40:16 +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 5FB8018089CD; Tue, 26 Nov 2019 21:40: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 xAQLeCvK027806 for ; Tue, 26 Nov 2019 16:40:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 045C7600CA; Tue, 26 Nov 2019 21:40:12 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F8EA600C8 for ; Tue, 26 Nov 2019 21:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804424; 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=dOnqg+Bl3iU678+dXlb4yJq922Tf/m7R+Ofqsf7Q230=; b=KbxwZNMoe8heV2uGD3YVHow/dODLHmNCwyg4eUB+aRmeepFRy2l2tnFjTdkzJJEFMX+vj8 AOJqk0Y9gq4KBXxOgtqMwXvpdBUKiKXtsyWtnMa60LdrjuIY1Bhr42I2WVxs8yt0/zmaq4 QQoBYlG19IOTX16U2kNCCCWfTL+A2ao= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:47 +0100 Message-Id: <3e2e83c99c15dc547dd849699931390128a4b419.1574803735.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 01/21] 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.14 X-MC-Unique: AD0j40KmOf2odZ0KzW4Kig-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 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 --- 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 0e490254fd..b52f58aa8f 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 Tue Apr 16 06:19:53 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=1574804434; cv=none; d=zohomail.com; s=zohoarc; b=Tj6iwqezEXy8XMZV5df2MeQC2PlRcrTRautzCYQdnmuZcnU8uRLFZjzgei2zfhInDtH1VHJAG/GOHB75+OSi1q40RJuGj7pC3YIzXA986BilE6aDMeLB4QzpnEbEiOqdEu6GgUveo3hKbxmAUk9DFFovx9msTRonDqUtHJ38jOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804434; 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=kP7ROJRbBQyctTRYQZ7vUfBgpYJ69rkn5cCeR3Z4Q6U=; b=ifUWgGM7bRPeI1qHsTcjt9ZfDBPONbH15MXFLIn5Zd7r2kocOjz2+b44gHtrW4ISiL8sty/gSEyGm2RndikU5nMtoM5JNgLcaebZThonJFPlnHWh1do4q4bUJ7duROzMZnizPjDT5izy4pcXbfHLmV8LTmaukS44Fs+z7i85+nc= 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 1574804434928946.3558482442354; Tue, 26 Nov 2019 13:40:34 -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-410-v3Pu1EkhNSKbSajZr7uvQA-1; Tue, 26 Nov 2019 16:40:32 -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 157B7800C74; Tue, 26 Nov 2019 21:40:27 +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 E24ED5D9E1; Tue, 26 Nov 2019 21:40:26 +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 9EBF64E562; Tue, 26 Nov 2019 21:40:26 +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 xAQLeCaY027814 for ; Tue, 26 Nov 2019 16:40:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA8A5600CC; Tue, 26 Nov 2019 21:40:12 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52D2C600C8 for ; Tue, 26 Nov 2019 21:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804433; 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=kP7ROJRbBQyctTRYQZ7vUfBgpYJ69rkn5cCeR3Z4Q6U=; b=WNqcpLMiDqAf8X7OwbOGSn+3FI1SnU45wmDKc9/ouPYW20iqZEA62VXyJNAkG5aGMYID+l QVImcHyuQ6yRDHXOJMjl+iacLU9CztL8RgBkDgIAvi1kigH6JIJsorUJb5stun4VEJSkOR Qkrvq/y6WeCa7jb+KHC5gYzMqLt1lBU= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:48 +0100 Message-Id: <88779729f5e69d1c4c84635604ad5c7ec05839ea.1574803735.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 02/21] 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.14 X-MC-Unique: v3Pu1EkhNSKbSajZr7uvQA-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 --- tools/virsh-domain.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 325d748b49..ec9292a5c1 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 Tue Apr 16 06:19:53 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=1574804440; cv=none; d=zohomail.com; s=zohoarc; b=etZhDh+d5ioFk3amUAMNJKYDgBaKMdQk6/QsyALfke81+zSzkF6Pqz6bCd0B0kmaLwvcH2O4nAt1dZW//djLMoEEYXkSya10z5NMfHCfguuB8zvwj8aM20/XR5Sg9kUCTng4VOT/qckXJ+vyBbgW+CF5oD+5IediZHBL/tEej6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804440; 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=8gJIvtfRQI1/O/RCSxrDDf/V2U05lC/qmQrK4FL6mTo=; b=WDuRkS2s7sa9mvN8Gu8pP/59NL23Aec6vyRHKrEUWziG7j+K3nKC4Gh4/SmkMBuE+twmhU8udAf6+v6uSHd3yAailA0cxjo9FNY9OsvVxpa6pgnzGUiNKLR4gPwHJm4jy9IVmDEIpNrYHJprYWAgU/gQkly2ZlzljcUaYDfkUmc= 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 1574804440855376.9671132437428; Tue, 26 Nov 2019 13:40:40 -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-138-cmsIZNHcN8-UP0YvENtJTg-1; Tue, 26 Nov 2019 16:40:36 -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 960FBDBAD; Tue, 26 Nov 2019 21:40:30 +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 5E6A219481; Tue, 26 Nov 2019 21:40:30 +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 1E7DB18089D6; Tue, 26 Nov 2019 21:40:30 +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 xAQLeD8A027821 for ; Tue, 26 Nov 2019 16:40:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id C4E74600CA; Tue, 26 Nov 2019 21:40:13 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2454E600C8 for ; Tue, 26 Nov 2019 21:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804438; 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=8gJIvtfRQI1/O/RCSxrDDf/V2U05lC/qmQrK4FL6mTo=; b=Sh6vLS7qQp/EGMyaPQh5OdnVSC9bQtRTOJklq9mN36P6eg/Q0QP2kNlnohV1/skmochXxR j1fC4nz+c3sAcOiwoygS8+KZ8jq35pu0Prt1wgKeaTaE8JipFz2gRZQr56ouQV4Ks4N975 Z6SF2YhQtsw7XNQuUkMwFuPLOrDtXtw= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:49 +0100 Message-Id: <3b8cba586ff7f3ce61c896a16cf0ab5a342a321d.1574803735.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 03/21] 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.23 X-MC-Unique: cmsIZNHcN8-UP0YvENtJTg-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 --- docs/docs.html.in | 3 +- docs/format.html.in | 1 + docs/formatbackup.html.in | 161 ++++++++++++++ docs/formatcheckpoint.html.in | 12 +- docs/index.html.in | 3 +- docs/schemas/domainbackup.rng | 214 +++++++++++++++++++ libvirt.spec.in | 1 + mingw-libvirt.spec.in | 2 + tests/Makefile.am | 3 + tests/domainbackupxml2xmlin/backup-pull.xml | 9 + tests/domainbackupxml2xmlin/backup-push.xml | 9 + tests/domainbackupxml2xmlin/empty.xml | 1 + tests/domainbackupxml2xmlout/backup-pull.xml | 9 + tests/domainbackupxml2xmlout/backup-push.xml | 9 + tests/domainbackupxml2xmlout/empty.xml | 7 + tests/virschematest.c | 2 + 16 files changed, 438 insertions(+), 8 deletions(-) create mode 100644 docs/formatbackup.html.in create mode 100644 docs/schemas/domainbackup.rng create mode 100644 tests/domainbackupxml2xmlin/backup-pull.xml create mode 100644 tests/domainbackupxml2xmlin/backup-push.xml create mode 100644 tests/domainbackupxml2xmlin/empty.xml create mode 100644 tests/domainbackupxml2xmlout/backup-pull.xml create mode 100644 tests/domainbackupxml2xmlout/backup-push.xml create mode 100644 tests/domainbackupxml2xmlout/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..b417331dfe --- /dev/null +++ b/docs/formatbackup.html.in @@ -0,0 +1,161 @@ + + + + +

    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.
      +
      +
      +
      +
      +
      + +

      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..cb6e12b2a7 --- /dev/null +++ b/docs/schemas/domainbackup.rng @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + push + + + + + + + pull + + + + + + + + tcp + + + + + + + + + + + + + + + + + + unix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + begin + inprogress + ready + + + + + + + + + + + + + + + + + + + on + + + + + + no + + + + + + + + file + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + diff --git a/libvirt.spec.in b/libvirt.spec.in index a6219da604..40d7f91451 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1884,6 +1884,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..775526c358 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -91,6 +91,9 @@ EXTRA_DIST =3D \ commanddata \ cputestdata \ domaincapsdata \ + domainbackupxml2xmlin \ + domainbackupxml2xmlout \ + domaincapsschemadata \ domainconfdata \ domainschemadata \ fchostdata \ diff --git a/tests/domainbackupxml2xmlin/backup-pull.xml b/tests/domainback= upxml2xmlin/backup-pull.xml new file mode 100644 index 0000000000..2ce5cd6711 --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-pull.xml @@ -0,0 +1,9 @@ + + 1525889631 + + + + + + + diff --git a/tests/domainbackupxml2xmlin/backup-push.xml b/tests/domainback= upxml2xmlin/backup-push.xml new file mode 100644 index 0000000000..1b7d3061fd --- /dev/null +++ b/tests/domainbackupxml2xmlin/backup-push.xml @@ -0,0 +1,9 @@ + + 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/domainbackupxml2xmlout/backup-pull.xml b/tests/domainbac= kupxml2xmlout/backup-pull.xml new file mode 100644 index 0000000000..2ce5cd6711 --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-pull.xml @@ -0,0 +1,9 @@ + + 1525889631 + + + + + + + diff --git a/tests/domainbackupxml2xmlout/backup-push.xml b/tests/domainbac= kupxml2xmlout/backup-push.xml new file mode 100644 index 0000000000..1b7d3061fd --- /dev/null +++ b/tests/domainbackupxml2xmlout/backup-push.xml @@ -0,0 +1,9 @@ + + 1525889631 + + + + + + + diff --git a/tests/domainbackupxml2xmlout/empty.xml b/tests/domainbackupxml= 2xmlout/empty.xml new file mode 100644 index 0000000000..13600fbb1c --- /dev/null +++ b/tests/domainbackupxml2xmlout/empty.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/virschematest.c b/tests/virschematest.c index df50ef1717..e4a440afb0 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -205,6 +205,8 @@ mymain(void) "genericxml2xmloutdata", "xlconfigdata", "libxlxml2domconf= igdata", "qemuhotplugtestdomains"); DO_TEST_DIR("domaincaps.rng", "domaincapsdata"); + 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 Tue Apr 16 06:19:53 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=1574804436; cv=none; d=zohomail.com; s=zohoarc; b=fsRBz7N9DDJu2GKYsQM6dMfjY9lclKqhuOksrH5A3I/cZyIYq05ZShQW6wfmRG5M96+wojChSL7h3ovrlUkmo/N8VxzExz+ao6v+gg/h2pNWd94tXlC/a7AX+lVFdh72upRg55LKDNp6ejIRM60ZUbJ/pYtdl1EYotUrPBoYsYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804436; 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=vmHK76rdIqQ4aD4JLAm79rN2oKN9v4EhZFhD3fdChbs=; b=dW1moeIGdiKPEAvyDAI3DTDrs5En7L8IpWfOkt2wzPQ+8z8fqLbkLaMdNb/SCjjWFF09oxTlQTnEsf7fF3FzNdm/01Xx/Xwfh2mxTJ/9vc7OVVksO2cYQ4yqteUDn6JzJF1XDSLTlUnu2KidUEpNJ7HU4xHS4sPUzP7A9BVkVf0= 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 1574804436570923.8390144680245; Tue, 26 Nov 2019 13:40:36 -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-100-ISlCGFu2Pn2wNBFK8UpruQ-1; Tue, 26 Nov 2019 16:40:32 -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 C2F37DBA7; Tue, 26 Nov 2019 21:40:27 +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 9AB4519C69; Tue, 26 Nov 2019 21:40:27 +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 5B1DE4E567; Tue, 26 Nov 2019 21:40:27 +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 xAQLeEnb027826 for ; Tue, 26 Nov 2019 16:40:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 97F1A600CA; Tue, 26 Nov 2019 21:40:14 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ECDB600C8 for ; Tue, 26 Nov 2019 21:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804435; 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=vmHK76rdIqQ4aD4JLAm79rN2oKN9v4EhZFhD3fdChbs=; b=U8aTKcrbucmmNjQn8ey3eBagGSRCwdrjZORLIKgIXlhu4uQxYhdSCxMzSNQpe0ptnyl/Mi p7J6vJg5f1gjB1tEMyVl5hFBCbwpjBFI9yn0UXx7DJQZ7Q0PCj4ot7Llj+puvO+1uZfbQo y86Is2GQmHpQsx3b4qKnUOSh6uL1JnU= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:50 +0100 Message-Id: <23a5261ea072f413242907bf67ae5b94cd87c8b0.1574803735.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 04/21] 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.84 on 10.5.11.23 X-MC-Unique: ISlCGFu2Pn2wNBFK8UpruQ-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 --- include/libvirt/libvirt-domain.h | 14 +++- src/driver-hypervisor.h | 12 +++ src/libvirt-domain-checkpoint.c | 7 +- src/libvirt-domain.c | 138 +++++++++++++++++++++++++++++++ src/libvirt_public.syms | 6 ++ 5 files changed, 173 insertions(+), 4 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index b52f58aa8f..e2ad4967e4 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,12 @@ int virDomainAgentSetResponseTimeout(virDomainPtr do= main, int timeout, unsigned int flags); +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 77169ec4ca..ec402ba5c0 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12541,3 +12541,141 @@ 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: unused; callers must pass 0 + * + * 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 libvir 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 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 Tue Apr 16 06:19:53 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=1574804428; cv=none; d=zohomail.com; s=zohoarc; b=R2asHzQJdfnH7CsY8ONN8UCzSWx2JO07PgVZuLi/1K+qrqtLep/Gjg+O2rZx/PBQJv2Kk1IiJf6HtC5rulYNj7MPeGtwPrVad/olbgJpnaAm5NoQgTndADN0rZZKV386vEUqroSt5KmaPe8RYPiC7zMpykIhdtut4qx6iqK52XE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804428; 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=fJEpLwazCIF+y1BnkgYCnXtPMakNAN3KPRctfyGujbg=; b=lvwcKfN5PPnpNNhCGrocIJgdW+7IL5NJbYI6Zgfq8cb343VdejTebW8f0Lo54WPbUNG3lOUAoRID4bNaX5/aECnS+hf+INo8MLMlcpUps94tdS8zqT7wgvW2jsvybtJrldGVi5XMyKmnnOFw7psr+4DequZwYVj9ZaiN85NINW0= 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 1574804428241822.3931856846251; Tue, 26 Nov 2019 13:40: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-213-NS7TambZOpC_4HWKobf0Tg-1; Tue, 26 Nov 2019 16:40:25 -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 A37801050905; Tue, 26 Nov 2019 21:40: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 7DB921001902; Tue, 26 Nov 2019 21:40: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 2EB6818089CF; Tue, 26 Nov 2019 21:40: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 xAQLeFGO027831 for ; Tue, 26 Nov 2019 16:40:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 68D4B600CC; Tue, 26 Nov 2019 21:40:15 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4BA8600CA for ; Tue, 26 Nov 2019 21:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804427; 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=fJEpLwazCIF+y1BnkgYCnXtPMakNAN3KPRctfyGujbg=; b=TjhNrHXDbXGw6STkcyFn9BU50mVsn2VAihoZ6JDuR4iXcClX4to5zxG8OuL9K90jFYeimk aVwUQSagRKhiRvLwoTCtSdNThVJspirRf8pRqQ+yYcVNvqI3E1m4nomiPhJQJLXW8Hev47 3s3+NtMiPxk4lGG02kUTTYqkjgN5O68= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:51 +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 05/21] 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.84 on 10.5.11.22 X-MC-Unique: NS7TambZOpC_4HWKobf0Tg-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: Eric Blake --- 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 e2ad4967e4..5fe431c152 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 ec9292a5c1..45af0b1427 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 Tue Apr 16 06:19:53 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=1574804447; cv=none; d=zohomail.com; s=zohoarc; b=Qd31Ki/YfjWfV6DBOhgSJqssO0dsT9JiNcDCo0A2AHlSg1RQRYeY0yI16ftivaJrodtfvXqNTM7XN9keR/HWLHfXoP8eh0bJ6SzHZxAuEoLn+XEPtUcpog7eHaJKNhgG1bZUMbx0h2bZXouG6gGtaWpb/UsUCous9D2AVEVlrOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804447; 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=KYsPiwQ1ubPjvxppW/A1t3VvDLo9OcCUA7hO0FTwIfGRA391qRc9DrD48SWQtTJVVyOBuDD757+CwzIuz1xbTSci397GOoWZe68iJ8gA1eVbRYMacqDzRfsSAAWXi/bQVl9u42MGpJ+nlWZ+ffTYwbgoTk3zjP8ognTWfk1nWvU= 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 1574804447910589.9944457548115; Tue, 26 Nov 2019 13:40:47 -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-181-OEOJDTItPBmYUgUqsLfbDg-1; Tue, 26 Nov 2019 16:40:43 -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 42C46800EB5; Tue, 26 Nov 2019 21:40:34 +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 1826E600C8; Tue, 26 Nov 2019 21:40:34 +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 C77804E56F; Tue, 26 Nov 2019 21:40:33 +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 xAQLeGwv027839 for ; Tue, 26 Nov 2019 16:40:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B658600CA; Tue, 26 Nov 2019 21:40:16 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7662600C8 for ; Tue, 26 Nov 2019 21:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804446; 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=h+NsuTqfyXxsc0yJNm2j2AQ6nTHtlF0Jb80lqUilQoBsJ3uga1HWfhlQLjV88M3nyqUCBJ hykN0qXi3xiOi3Z7R9U1libWEjgTDARsZJNvORDG65SP5DNV9yRfqOhLoq1Ffh9+EUuBr3 Nj/Fvb4d1tga2cqYMhrlxnyvm7jX0Gc= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:52 +0100 Message-Id: <8e3c339d36b9ae4db3e18d8e9e282a11b1e9e732.1574803735.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 06/21] 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.11 X-MC-Unique: OEOJDTItPBmYUgUqsLfbDg-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 --- 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 Tue Apr 16 06:19:53 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=1574804436; cv=none; d=zohomail.com; s=zohoarc; b=PLZd2uEwh5IkyECRY1PNVkdfmRHzJtC9kE8Y0s+6g3jouWjCHrNccnuRzRDMeAEPAePhc3VO8R21JScU7ENvhbXCLBRhIUjl/PR1kVIlMwsQUE6KAG4Govp/MSRV8yuu/d9A7Yac9fPk56uvvAxA+/L54B94X87RgDVAmxOTjbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804436; 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=Vv/vseSY01Gi+ssIiYKfOInGnHX2tOjLOVJ1Bwqxnj+cGUQN5GxvdbUBl8AqnPv5j3R/pRtsjoXlcQS9NACeglWSbYA58RL6EUM8cAi+VEUUl1nSL6tWFox0NYflCe/ebwCUu0aEDGRB7npDgOvx1PkaqteWfMKVkWV1Wu2jgD4= 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 1574804436488608.3975849128956; Tue, 26 Nov 2019 13:40:36 -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-28-lP10JhcjNmqAmNQFZttMdQ-1; Tue, 26 Nov 2019 16:40:32 -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 185D6DBB2; Tue, 26 Nov 2019 21:40:27 +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 DFC0F60BE2; Tue, 26 Nov 2019 21:40:26 +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 9F15D18089D0; Tue, 26 Nov 2019 21:40:26 +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 xAQLeH7n027849 for ; Tue, 26 Nov 2019 16:40:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 34CAA600CC; Tue, 26 Nov 2019 21:40:17 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89EC6600C8 for ; Tue, 26 Nov 2019 21:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804435; 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=Wyo/aGkXRfYlJnCU36alr07pnM+c0MEwY94Z5T+VPY5MR8eMLHzBNDk0h4lxl+PQzIHOTJ /FZIkuByXcQKbTSelZlCRjaQGowjpNs6bXfxd7665Jb+NbRC3W8Swlr+8gW73TME9Updhg V9en2ZClSIZ3C9tKfkC681rIGIdnqZA= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:53 +0100 Message-Id: <9837b9474892a8f9b21ee79d4dd1c23d066c81ed.1574803735.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 07/21] 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.12 X-MC-Unique: lP10JhcjNmqAmNQFZttMdQ-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 --- 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 Tue Apr 16 06:19:53 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=1574804441; cv=none; d=zohomail.com; s=zohoarc; b=m1FOLU04Z0XrQnU1oWrvJKXWLslQSy6XjGI88T2HBgzZxEOBiTEJIb88262pULoe5Axi5AZBFiV9Hp/njXhareySrEooqcin71aZF8y3o/2OHHFqeHSRkgrrAiYIgqIJyTFG7Z3RIuBFJr4avLUeYY7F+Cl7DwptNNe4hXy4C3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804441; 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=hvcW/VdG3cysb396EO4zsiR0obSAgxk213GdOUQ0v6c=; b=b+EyYcUX34Mf12/hgFZLSx6sZ/dve3OYxExqljUpmDUrcr6Zwl0Njve0a1jlTF/wEAcxl5d6BIxDIM0yAHC5THe3pm0gjPj8hQfb0UPF3xHL2lqgJPB56Ix3KXtaJ3OuhIa3M7mN8wBBJgPzc55LZBlM9wgiwGPeYsh1DO/p034= 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 15748044418911020.6826735222829; Tue, 26 Nov 2019 13:40:41 -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-222-gVR5LKc_MnOdduMc2Yk42w-1; Tue, 26 Nov 2019 16:40:36 -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 7A402800589; Tue, 26 Nov 2019 21:40:30 +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 4EB4C5D6C8; Tue, 26 Nov 2019 21:40:30 +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 095AF4E56C; Tue, 26 Nov 2019 21:40:30 +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 xAQLeI0J027859 for ; Tue, 26 Nov 2019 16:40:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 05D1F600CC; Tue, 26 Nov 2019 21:40:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81CBE600C8 for ; Tue, 26 Nov 2019 21:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804440; 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=hvcW/VdG3cysb396EO4zsiR0obSAgxk213GdOUQ0v6c=; b=gS6f/KczIUALQn8x7Z4uByJEM+QH1/5DesCRG5Jnx+1TduveSF2mCpg1jrgK2uB1tjJsyr Oo0mkCVs0qru/Wbr8Fv/brpO/8GfJ0dHuq/xd7To2qzZ3bPozqX2tdEE3lS3mvn55Tu7Us eVI3Km/QlN4qmLMM7hBYuWvmFThKwDs= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:54 +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 08/21] 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.15 X-MC-Unique: gVR5LKc_MnOdduMc2Yk42w-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 --- po/POTFILES.in | 1 + tools/Makefile.am | 1 + tools/virsh-backup.c | 144 +++++++++++++++++++++++++++++++++++++++++++ tools/virsh-backup.h | 21 +++++++ tools/virsh.c | 2 + tools/virsh.h | 1 + tools/virsh.pod | 28 +++++++++ 7 files changed, 198 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..b5cb912e80 --- /dev/null +++ b/tools/virsh-backup.c @@ -0,0 +1,144 @@ +/* + * 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 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 (!(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 951cb738a0..0d3d432d21 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1327,6 +1327,34 @@ 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 + +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 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 Tue Apr 16 06:19:53 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=1574804535; cv=none; d=zohomail.com; s=zohoarc; b=EB2tp3MefEODxRtWyyHONUNNfvBiDRUoxva1KLC63Lf/NGtkxA5/rjE8/5cnK9ku3kcHEvBItrfkdhIrm0qS93uCiiDiGW8QKF5O7E+Wr4R52qZIdAZ4zXZMhTDFRfqWRpr7u99K0x9JW6TrEM5pEYujnZKDXNqja1N7vmU1cNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804535; 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=UNijBUphkjwKnle7VYjqHjGqzmjhnhL33GePEL84ezE=; b=Zio+h/mUfHmY8Kja/8qu6RMTPAH/eK+RBQCZ+2jReT15IwwbefV8uBTL4AzLF8d1CVQLfDRorQjmtS726wOg9dzN7nmEmZRsC/XQ5K9mIE28u88msYhcO9ZhJg7er0SIbipcmVc1qpQLSr/S7GM0JWpz+Y1wRnUnMFPlBaHnpUo= 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 1574804535696778.8653675883971; Tue, 26 Nov 2019 13:42:15 -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-77-bD208pELNi-u3ePsFdTxiw-1; Tue, 26 Nov 2019 16:40:43 -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 06276801E57; Tue, 26 Nov 2019 21:40:34 +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 D16D7600CA; Tue, 26 Nov 2019 21:40:33 +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 8C58A4E56E; Tue, 26 Nov 2019 21:40:33 +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 xAQLeIlo027866 for ; Tue, 26 Nov 2019 16:40:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD928600CC; Tue, 26 Nov 2019 21:40:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54D56600C8 for ; Tue, 26 Nov 2019 21:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804534; 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=UNijBUphkjwKnle7VYjqHjGqzmjhnhL33GePEL84ezE=; b=h789yN2c6otf62AkWj8g/JO3tQVw5Sy0fyWkMlgQlGAShwZsmRCRHPFrTzqXYYimRmKGjv gVXbeU5lEgN5lASKLO3tV0yWUX5o8ogxWa1AZo+XSHF9NPvztuqRd+Bb/6G0QsJzKglS17 w19B5SutfvMyvIY+e0iCkSRzeKwxWdk= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:55 +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 09/21] 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.79 on 10.5.11.11 X-MC-Unique: bD208pELNi-u3ePsFdTxiw-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: Eric Blake --- 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 470d342afc..6d335ff8cf 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 f626d3a54c..850cae1c4f 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 62c2055a7b..5956f51f17 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13899,6 +13899,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 Tue Apr 16 06:19:53 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=1574804466; cv=none; d=zohomail.com; s=zohoarc; b=NtfyY4jwMUts9NQBux36ySx7vq34U9Yj+lQMC344/tmPPo13o5gXfuB23xPPlJvrgoU2hInGsvyF4pbhpOtqIol/IWqKhwVS3MGHC0cGdmQQtpzhx+u9kXoNPTDgwcscQ/KmK0+oETfU1F6S4NUvrD+MoNWcFOrhyIsyW/pL2rM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804466; 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=iHrrn3z1j0dPkTNECWpVEHLNDfhrDSflL+W6whjF7tQ=; b=Flpb3rW9Bs21oPzpTlHAtCqiu3CJMDwBtQ7BKYNFBKZJbb6BD8ZG65zpD8S2aCfX59c4NEPGtoSV/8nr4K9ZsBpxr0Ull8n79HTjEMbqVNNck2zjM0vjzk4lSVwHBVJyxN2SQUjfszgK6lzEZrTrRA0V+Qr4Tj47L+I1rM5gu3o= 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 1574804466844866.481498180482; Tue, 26 Nov 2019 13:41: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-279-m31-jd3WPsWI4yliH1Tj7w-1; Tue, 26 Nov 2019 16:40:44 -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 82754800580; Tue, 26 Nov 2019 21:40:38 +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 56B1F5D6C8; Tue, 26 Nov 2019 21:40:38 +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 1824B4E575; Tue, 26 Nov 2019 21:40:38 +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 xAQLeJhC027874 for ; Tue, 26 Nov 2019 16:40:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9D84D600CC; Tue, 26 Nov 2019 21:40:19 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 259E2600C8 for ; Tue, 26 Nov 2019 21:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804465; 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=iHrrn3z1j0dPkTNECWpVEHLNDfhrDSflL+W6whjF7tQ=; b=iyAgJOZzyzdZdWd5MiQtz40j4Mf7qjyGlozbE2C3xRRhnrnfFv4pmqrhVeTT0/r+oqMGiZ kaHjoETEUZt5zGelRENlnHNo6RLggVnhUHa7tepuLWa1S4RVsumKXEGHzZL5ukM/5xkxJT n7D8Pu898ScvwlmhryQePqUmd3QUMGk= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:56 +0100 Message-Id: <9b4bdf63a59f3f3e37c12386deee8d906b08fa44.1574803736.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 10/21] 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.79 on 10.5.11.15 X-MC-Unique: m31-jd3WPsWI4yliH1Tj7w-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: Eric Blake --- 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 6d335ff8cf..436b8d331b 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 850cae1c4f..eb3faeb761 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 c38bf342d7..bab5b4ca93 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 af14630859..08b7f61cfe 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 Tue Apr 16 06:19:53 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=1574804449; cv=none; d=zohomail.com; s=zohoarc; b=IofPArJBfUKXMiCYZNmBLFw1h0L80wei24OQDxCR/ty0DrTQO1188l5s9RGFzfMSMq5z9IztHJgNZRhGmYkjMgc4dzbhZOpdId+a2/kEwAk9dWKAQWwMDY4OaWQBain7lWdsotYBLNP3eHnwPKyCu+ibSt73oAV5u1VATRIXktE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804449; 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=7WmBSEL+12gmfl4g8Yuzw5cbmKCNjO3YezuKlSEnNvo=; b=SCR9bwkMoC6hbTmHWSGnfFbdRkMvEpzxA5RoDNT3F5RVlWMR0lCPJDc5/vjA4Hex2IjgAvEhPGp0jg6FND45ChOrTESj7MzAT/sbeB1FYB3AgCAaX/2Cn6PqSYTq+dOcg5ufTLkqM5axwof32dXPZsSgWUsnhE2WzdXKVBAaPdY= 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 1574804449234376.22765958431216; Tue, 26 Nov 2019 13:40:49 -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-26-JD2Noo3fOwGBb3pj9b9pJA-1; Tue, 26 Nov 2019 16:40:46 -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 AB0D7DBB6; Tue, 26 Nov 2019 21:40:37 +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 854925D6D2; Tue, 26 Nov 2019 21:40:37 +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 42636180880D; Tue, 26 Nov 2019 21:40:37 +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 xAQLeKdt027885 for ; Tue, 26 Nov 2019 16:40:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6ED6B600CC; Tue, 26 Nov 2019 21:40:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB42B600C8 for ; Tue, 26 Nov 2019 21:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804448; 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=7WmBSEL+12gmfl4g8Yuzw5cbmKCNjO3YezuKlSEnNvo=; b=StwEkjmH2glf4v6Op9SYop+7eZ5K9yWa2fAC3pO3/dx8YTbJ+7VM9pSPIXvW3lh/rImL7p xT2svMxwmc+mkUUPUIr1meRGw1eZbUutE98SNeRjvav6kGAJlrA+HJdIDrGGbXIrAae5dS OdOxQTxiSpeuRiedOzSflLc3heeNow8= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:57 +0100 Message-Id: <9e1820f02bbcd2bc595f427238cff7a1682968cd.1574803736.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 11/21] 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.79 on 10.5.11.15 X-MC-Unique: JD2Noo3fOwGBb3pj9b9pJA-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: Eric Blake --- 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 5fe431c152..8136a8d031 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), job exists until virDomainBackupEnd = */ + 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 2c51367c67..eafad0432c 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"); @@ -1275,6 +1276,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 436b8d331b..344601c8d6 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 5956f51f17..b955c3efe1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17421,6 +17421,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 45af0b1427..51ba573819 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 Tue Apr 16 06:19:53 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=1574804524; cv=none; d=zohomail.com; s=zohoarc; b=XvR3kCT6aU2di1wtTW3hCL00XvSCBXxefayJCXUISWgwKaT8z48saT0bTZj6MdWtPydwv+KvfMcYttvKdk7uOiq0ECPi/0p/IkEQzNLjsNpGR2yzEMh+bPYC5FzUWyFDPk/JQhH/+HGVKZ2iczaIuMLZ8SAxF+6zWtpFpCrBSso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804524; 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=FsvOPejPlwUJ77DZG1yYKrOET0YfeGiObQqRb+HnwaqdgFIYHSuS9oYaPpy9phYhclWpkTf1MnhJv4yNSJ1pGCKDAvMepfz537fOpC8wZhrDASt1DJwFJXmbNk7h3NdMTk4riAHwsgBGj6IFLY0FpTieN/FMqZXIQ51e7AANph4= 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 1574804524779867.8937677520972; Tue, 26 Nov 2019 13:42: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-379-m_BDxQnjPW2rS6cZMzdbxA-1; Tue, 26 Nov 2019 16:40:50 -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 39D5F107AFFA; Tue, 26 Nov 2019 21:40:41 +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 141875D6D4; Tue, 26 Nov 2019 21:40:41 +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 C29BB1803C33; Tue, 26 Nov 2019 21:40:40 +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 xAQLeLG8027895 for ; Tue, 26 Nov 2019 16:40:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 40107600CC; Tue, 26 Nov 2019 21:40:21 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC79F600C8 for ; Tue, 26 Nov 2019 21:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804523; 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=YzDOvGBQbtiW3b+sxjs+p9UemxKXhbhB+T5vezob0w55tsTPdO9VDOG2157g9/uJKxOBR6 6Qq17+PNnsPEDTo+u4mMlQr5OLMr8Ws6b5tXYhgtj6xY+1YbvzZvv9JNJscTBoQ1x7wHZ8 ZHx39WnkjDocTGPgEfGuCkln/wv9aPQ= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:58 +0100 Message-Id: <96e67dfdd26047957ecffdf0c2ffd9d4b746337f.1574803736.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 12/21] 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.15 X-MC-Unique: m_BDxQnjPW2rS6cZMzdbxA-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: Eric Blake --- 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 Tue Apr 16 06:19:53 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=1574804450; cv=none; d=zohomail.com; s=zohoarc; b=VoMBeUh71nQURDutNcKeRDNZUt2W2/jrc5q6diNSL3wMIqxKPph8i0dIPbeG9ttezEs6bY159O3UPTzf+3cKoqUY2xIJdftbyzh7epMDVN0cn7byRwXAvw1sHDaqBWLXCYtp5ddl+5jv76i8+rSbXQQ1+EekDbtPl8w+OojXlTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804450; 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=A2lzKOqBhsYWOIZswSeQS+3/7LldI2SMhLQBbsqOYas=; b=ccAc7Q0NiedEZUT8NkK74rsBuXJHVy0Ngc/eJnUc8nTX2PioAcTDVGpUbP9x27QOwbjrqdDO9ryg6tL2CV8HnkCr5pIZr7j8sgAgBlN5j1jVTkGfa6yA/67td+qoehdz4gH2vuvUdbNWxiJZzGVlK++ejMSaY52XzOo+o6HtD8Y= 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 1574804450732781.2467267838585; Tue, 26 Nov 2019 13:40:50 -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-222-ddSawYbJMrOkuMU0T_yHPg-1; Tue, 26 Nov 2019 16:40:48 -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 0C046106BBDC; Tue, 26 Nov 2019 21:40:42 +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 D63AF60C63; Tue, 26 Nov 2019 21:40:41 +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 96B7D1803C40; Tue, 26 Nov 2019 21:40:41 +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 xAQLeM6q027904 for ; Tue, 26 Nov 2019 16:40:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1300B600CD; Tue, 26 Nov 2019 21:40:22 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DAF9600C8 for ; Tue, 26 Nov 2019 21:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804449; 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=A2lzKOqBhsYWOIZswSeQS+3/7LldI2SMhLQBbsqOYas=; b=ZxvuSNRq8H7u3RqgOk0vBAmRTWu8/zp+afA6M6t+mYWdZ77HnXy/rr8IunJmRXamU1V0X0 XDltO3pe+3HImeHvcnfCiKY9KnK3As7ffh3uvLNEPSW735szVPfe++F+ebMaJAl7fsk038 PFJlQsA7y283TglwMdFCva4x8/z6sBE= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:39:59 +0100 Message-Id: <619005be389b1ffdb34006dd6b1b319c4e7d2ae9.1574803736.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 13/21] 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.12 X-MC-Unique: ddSawYbJMrOkuMU0T_yHPg-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: Eric Blake --- 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 344601c8d6..a4c9ac11be 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 eb3faeb761..54397643d9 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 jobs. */ + 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 Tue Apr 16 06:19:53 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=1574804454; cv=none; d=zohomail.com; s=zohoarc; b=GS+gZd2XSW/MexPBh3Z3p3X20GCntw0c9cZeqPpqxX/YXMN9hL8VmN6eazYzNPPG1enmCJVcjdQ3LrjkGYw61L7k1H9P0keu4twXP1l9lF1s1LCiaE4RPQ5GkMc1AEHtPi80XNsCkjtYuqu/yoTbY3GvGvJEjPTd/ni7nSdfUDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804454; 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=YDlulf5pkrFrqwopDhGHoBBPUzhP+VeO7GzJberlhew=; b=g4/uAqIea2nzGt9wBtTvU/yWa15HvBZWNWxn1nSHvaZYYCmNcZOJ+J13Ly3a0O5fkPne5qo5hxSgWBuuFkUWP8a27c96/MvnA7grcX5s4scJJmXlf63cLY6I3Fl6I+834LP6ytKNtlP9c1+luI6wTpeuytO7NIelmfmNTofePqU= 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 1574804454836450.75578399627216; Tue, 26 Nov 2019 13:40:54 -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-175-EXExQ-13MKOfqik6W9EAAA-1; Tue, 26 Nov 2019 16:40:51 -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 7D443106BBE0; Tue, 26 Nov 2019 21:40:44 +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 5442060C63; Tue, 26 Nov 2019 21:40:44 +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 13FDA4E57B; Tue, 26 Nov 2019 21:40:44 +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 xAQLeMl9027911 for ; Tue, 26 Nov 2019 16:40:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id D71CD600CE; Tue, 26 Nov 2019 21:40:22 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EA0E600C8 for ; Tue, 26 Nov 2019 21:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804453; 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=YDlulf5pkrFrqwopDhGHoBBPUzhP+VeO7GzJberlhew=; b=BeZsYdXPuIDaSX++NeZQzRmUW2yJxYqU7/48gaTBX2NIvTSdcZwJ6vYB9nSpZACLFBbnKn DbE4hsioEWB7oxfCFCDbQIcoOQtihCow7/RqB9b2/q7PnYdkHnwItKZ+4mnwopngyZIthm A5GlJ9OgdT33YsSEkJtrSS/aPb+0qJU= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:40:00 +0100 Message-Id: <3e6a22a86c6221200aec8e3a2978908beeae95fb.1574803736.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 14/21] 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.12 X-MC-Unique: EXExQ-13MKOfqik6W9EAAA-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 --- src/qemu/qemu_blockjob.c | 32 +++++++++++++++++++++++++++++++- src/qemu/qemu_blockjob.h | 16 ++++++++++++++++ src/qemu/qemu_domain.c | 13 +++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index eafad0432c..8dbb09c30a 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -77,8 +77,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) @@ -369,6 +373,32 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, } +qemuBlockJobDataPtr +qemuBlockJobDiskNewBackup(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr store, + 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); + + /* 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..bfae410d14 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -107,6 +107,15 @@ struct _qemuBlockJobCopyData { }; +typedef struct _qemuBlockJobBackupData qemuBlockJobBackupData; +typedef qemuBlockJobBackupData *qemuBlockJobDataBackupPtr; + +struct _qemuBlockJobBackupData { + virStorageSourcePtr store; + char *bitmap; +}; + + typedef struct _qemuBlockJobData qemuBlockJobData; typedef qemuBlockJobData *qemuBlockJobDataPtr; @@ -124,6 +133,7 @@ struct _qemuBlockJobData { qemuBlockJobCommitData commit; qemuBlockJobCreateData create; qemuBlockJobCopyData copy; + qemuBlockJobBackupData backup; } data; int type; /* qemuBlockJobType */ @@ -184,6 +194,12 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, bool shallow, bool reuse); +qemuBlockJobDataPtr +qemuBlockJobDiskNewBackup(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr store, + 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 a4c9ac11be..94d291e881 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2608,6 +2608,14 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, break; case QEMU_BLOCKJOB_TYPE_BACKUP: + virBufferEscapeString(&childBuf, "\n", jo= b->data.backup.bitmap); + if (job->data.backup.store && + qemuDomainObjPrivateXMLFormatBlockjobFormatSource(&childBu= f, + "store", + job->dat= a.backup.store, + data->xm= lopt, + false) <= 0) + return -1; break; case QEMU_BLOCKJOB_TYPE_BROKEN: @@ -3199,6 +3207,11 @@ 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; 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 Tue Apr 16 06:19:53 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=1574804446; cv=none; d=zohomail.com; s=zohoarc; b=JSG7/xDElglgPmE0KJ+VBcyjdn5fth9lbkoon9ac0B//l5my5ycySVVKS9z4W6pUQvm+rimLOzjfTBadMQpbBqCYxWDGIwWZNZx2mIkHHkeJuFxRXgUI4H03w8G4dw6rPizN0GjVtZRPY+/G1LV/Ka0vpm2Ymdt+G7XD0svpYGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574804446; 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=A0L83g9+eYuBwpU+Hjuk9QwFLvBvfVZ8YOX6RMz8ByY=; b=NtCi+EJAikhrEwE+wrajOZ3evQu9JuoOUcZ9aHCnlj5DUXECSk1WGtA0Sg08h/W8y1nkKcwMSMv/BfZJVsz8Y3EgVt+teLT2JBnDlnuQtExTyRLwiPDvl3K3aUIiBp7yK0xmm20+PEDaKrbAspSdNAq1rx/0qn60BmB5FlZAZq8= 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 1574804446736914.5551772430813; Tue, 26 Nov 2019 13:40:46 -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-335-paHHy1DAMLKhv8Xq6_Qw0w-1; Tue, 26 Nov 2019 16:40:41 -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 4E6E9DBA3; Tue, 26 Nov 2019 21:40:34 +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 29CDB5D9CD; Tue, 26 Nov 2019 21:40:34 +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 DC24B1808855; Tue, 26 Nov 2019 21:40:33 +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 xAQLePTf027923 for ; Tue, 26 Nov 2019 16:40:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id BC534600CD; Tue, 26 Nov 2019 21:40:25 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40A89600C8 for ; Tue, 26 Nov 2019 21:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574804445; 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=A0L83g9+eYuBwpU+Hjuk9QwFLvBvfVZ8YOX6RMz8ByY=; b=Vf7FyBBhyAS7MJkhcyD1J3Qp8RPRnZR5AaMnuW9VpIUWDIa2NZPSzKx5He9Oi9qcLqyPxj fYrDTOcuKVmxYBgZliAXlsqPIQsiLCkDmxFoRKdVqvi8mNuCTuPOIt5CqgRvhOFVkHO+Cf RBATunXzF7p/GypS9b9R4jhw5cactyE= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Nov 2019 22:40:01 +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 15/21] 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.14 X-MC-Unique: paHHy1DAMLKhv8Xq6_Qw0w-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 --- .../qemustatusxml2xmldata/backup-pull-in.xml | 607 ++++++++++++++++++ .../qemustatusxml2xmldata/backup-pull-out.xml | 1 + tests/qemuxml2xmltest.c | 2 + 3 files changed, 610 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..3c69c41840 --- /dev/null +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -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 + + + + + + + + + +
      + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + +