From nobody Tue Nov 4 08:30:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504120657151175.75512833948903; Wed, 30 Aug 2017 12:17:37 -0700 (PDT) Received: from localhost ([::1]:52304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8UY-0000Kb-T2 for importer@patchew.org; Wed, 30 Aug 2017 15:17:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8T1-0007l0-7P for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn8Sy-000827-So for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:59 -0400 Received: from research.iiit.ac.in ([196.12.53.8]:45862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn8Sx-000809-CA for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:56 -0400 Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id B293D744E33; Thu, 31 Aug 2017 00:45:50 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LTtLKCfEgNmN; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id 6862C744E3E; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YqhtswiG2jmP; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from ishani-Inspiron-5558.iiit.ac.in (unknown [10.2.20.52]) by research.iiit.ac.in (Postfix) with ESMTPSA id 54346744E33; Thu, 31 Aug 2017 00:45:49 +0530 (IST) DKIM-Filter: OpenDKIM Filter v2.9.2 research.iiit.ac.in 6862C744E3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=research.iiit.ac.in; s=4E8815E6-5B55-11E4-B758-8D4964374E96; t=1504120549; bh=3K/o5+8SwEQifN9wnHZDUeD5+jRdA9Lsp9nssfoRrjw=; h=From:To:Subject:Date:Message-Id; b=Kh8VkTpjPDtEaKaNHLxg2U27jslo67nrrX9aOK0AB2awb7OXf9PrqLWwyW9SJMFcA QUFJpY4cQTevvCrblZkeDKMgO9XNMX8G529i0nBc9KCzy996mkXQxLVULTpXVaJwrH Cj0660QsFNyDMVhSWLMX4DY80TIgpi9eSbqMlDCg= X-Virus-Scanned: amavisd-new at research.iiit.ac.in From: Ishani Chugh To: qemu-devel@nongnu.org Date: Thu, 31 Aug 2017 00:45:36 +0530 Message-Id: <1504120538-9309-2-git-send-email-chugh.ishani@research.iiit.ac.in> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> References: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 196.12.53.8 Subject: [Qemu-devel] [PATCH 1/3] Backup Tool: Manpage for Incremental Backup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ishani Chugh , jsnow@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Adds command description to perform incremental backup and a full example for the same. Signed-off-by: Ishani Chugh --- contrib/backup/qemu-backup.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/contrib/backup/qemu-backup.texi b/contrib/backup/qemu-backup.t= exi index 7ad266c..8e5cb86 100644 --- a/contrib/backup/qemu-backup.texi +++ b/contrib/backup/qemu-backup.texi @@ -58,6 +58,7 @@ qemu-backup command [command options]. @item qemu-backup restore --guest guestname @item qemu-backup guest remove --guest guestname @item qemu-backup drive remove --guest guestname --id driveid +@item qemu-backup backup --inc --guest guestname @end itemize @node Command Parameters @chapter Command Parameters @@ -67,6 +68,7 @@ qemu-backup command [command options]. @item --id: id of guest or drive. @item --qmp: Path of qmp socket. @item --target: Destination path on which you want your backup to be made. +@item --inc: incremental backup (Optional). @end itemize =20 @node Command Descriptions @@ -119,6 +121,11 @@ This command helps remove a drive which is set for bac= kup in configuration of gi =20 example: drive remove --guest=3Dfedora --id=3Droot =20 +@item qemu-backup backup --inc --guest guestname +This command is used for making incremental backup. + +example: qemu-backup backup --inc --guest fedora + @item A full backup can be performed by following the given steps: =20 Perform a full backup of 'vm001', which has one drive: @@ -129,6 +136,17 @@ qemu-backup add --id drive0 --guest vm001 --target /ba= ckups/vm001-drive0.img =20 qemu-backup backup --guest vm001 =20 +@item An incremental backup can be performed by following the given steps: + +Perform an incremental backup of 'vm001', which has one drive: + +qemu-backup guest add --guest vm001 --qmp /path/to/vm001.sock + +qemu-backup add --id drive0 --guest vm001 --target /backups/vm001-drive0.i= mg + +qemu-backup backup --inc --guest vm001 + +qemu-backup backup --inc --guest vm001 =20 @end itemize =20 --=20 2.7.4 From nobody Tue Nov 4 08:30:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504120777182340.5311179920607; Wed, 30 Aug 2017 12:19:37 -0700 (PDT) Received: from localhost ([::1]:52309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8WV-0002AE-13 for importer@patchew.org; Wed, 30 Aug 2017 15:19:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8T1-0007l1-7N for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn8Sy-00081y-GS for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:59 -0400 Received: from research.iiit.ac.in ([196.12.53.8]:45858) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn8Sx-000804-C1 for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:56 -0400 Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id 1D336744E36; Thu, 31 Aug 2017 00:45:51 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mVTRZC5w0kUz; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id 7611A744E41; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id v4MRWevieVY7; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from ishani-Inspiron-5558.iiit.ac.in (unknown [10.2.20.52]) by research.iiit.ac.in (Postfix) with ESMTPSA id 58468744E36; Thu, 31 Aug 2017 00:45:49 +0530 (IST) DKIM-Filter: OpenDKIM Filter v2.9.2 research.iiit.ac.in 7611A744E41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=research.iiit.ac.in; s=4E8815E6-5B55-11E4-B758-8D4964374E96; t=1504120549; bh=SMUJOevgF60U8+t+IllCQooY1DzlaTp0Kv3md9qQv90=; h=From:To:Subject:Date:Message-Id; b=tIDbqCpkvhfXOOlTPU6La2iyObCEWfqPOqQLb1LknEyNvIW6qTDJxCUfJIwyJhyn5 Itgh2FXsfeGvc29y4KIj7575t4zZGT00VZEHYaWxqENHx6wzSENFV2O+v64YaeGJoX xFWEBMgGkMNmPqvjXSS1b3FTjbeUE+tDP8Jnd6Kk= X-Virus-Scanned: amavisd-new at research.iiit.ac.in From: Ishani Chugh To: qemu-devel@nongnu.org Date: Thu, 31 Aug 2017 00:45:37 +0530 Message-Id: <1504120538-9309-3-git-send-email-chugh.ishani@research.iiit.ac.in> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> References: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 196.12.53.8 Subject: [Qemu-devel] [PATCH 2/3] Backup Tool: Support for Incremental Backup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ishani Chugh , jsnow@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Adds incremental backup functionality. Signed-off-by: Ishani Chugh --- contrib/backup/qemu-backup.py | 101 ++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/contrib/backup/qemu-backup.py b/contrib/backup/qemu-backup.py index 248ca9f..7a3077a 100644 --- a/contrib/backup/qemu-backup.py +++ b/contrib/backup/qemu-backup.py @@ -24,11 +24,13 @@ from __future__ import print_function from argparse import ArgumentParser import os import errno +from string import Template from socket import error as socket_error try: import configparser except ImportError: import ConfigParser as configparser +from configparser import NoOptionError import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts', 'qmp')) @@ -41,7 +43,6 @@ class BackupTool(object): '/.config/qemu/qemu-backup-config'): if "QEMU_BACKUP_CONFIG" in os.environ: self.config_file =3D os.environ["QEMU_BACKUP_CONFIG"] - else: self.config_file =3D config_file try: @@ -129,6 +130,97 @@ class BackupTool(object): drive_list.remove(event['data']['device']) print("Backup Complete") =20 + def _inc_backup(self, guest_name): + """ + Performs Incremental backup + """ + if guest_name not in self.config.sections(): + print ("Cannot find specified guest", file=3Dsys.stderr) + exit(1) + + self.verify_guest_running(guest_name) + connection =3D QEMUMonitorProtocol( + self.get_socket_address( + self.config[guest_name]['qmp'= ])) + connection.connect() + backup_cmd =3D {"execute": "transaction", + "arguments": {"actions": [], "properties": + {"completion-mode": "grouped"}}} + bitmap_cmd =3D {"execute": "transaction", "arguments": {"actions":= []}} + for key in self.config[guest_name]: + if key.startswith("drive_"): + drive =3D key[len('drive_'):] + target =3D self.config.get(guest_name, key).rsplit('/', 1)= [0] + inc_backup_pattern =3D Template('${drive}_inc_${N}') + bitmap =3D 'qemu_backup_'+guest_name + try: + query_block_cmd =3D {'execute': 'query-block'} + returned_json =3D connection.cmd_obj(query_block_cmd) + device_present =3D False + for device in returned_json['return']: + if device['device'] =3D=3D drive: + device_present =3D True + bitmap_present =3D False + for bitmaps in device['dirty-bitmaps']: + if bitmap =3D=3D bitmaps['name']: + bitmap_present =3D True + if os.path.isfile(self.config.get( + guest_name, + 'inc_'+drive)) is Fa= lse: + print("Initial Backup does not exi= st") + bitmap_remove =3D {"execute": + "block-dirty" + + "-bitmap-remove", + "arguments": + {"node": drive, + "name": + "qemu_backup_" + + guest_name}} + connection.cmd_obj(bitmap_remove) + bitmap_present =3D False + if bitmap_present is False: + raise NoOptionError(guest_name, 'inc_'+dri= ve) + break + + if not device_present: + print("No such drive in guest", file=3Dsys.stderr) + sys.exit(1) + N =3D int(self.config.get(guest_name, drive+'_N'))+1 + target =3D self.config.get(guest_name, key).rsplit( + '/', 1= )[0]\ + + '/' + inc_backup_pattern.substitute(drive=3Ddriv= e, N=3DN) + os.system("qemu-img create -f qcow2 " + target + " -b = " + + self.config.get(guest_name, 'inc_' + + drive) + " -F qcow2") + sub_cmd =3D {"type": "drive-backup", + "data": {"device": drive, "bitmap": bitmap, + "mode": "existing", + "sync": "incremental", + "target": target}} + backup_cmd['arguments']['actions'].append(sub_cmd) + self.config.set(guest_name, drive+'_N', + str(int(self.config.get(guest_name, + drive+'_N'))+1= )) + self.config.set(guest_name, 'inc_'+drive, target) + except (NoOptionError, KeyError) as e: + target =3D self.config.get(guest_name, key).rsplit( + '/', 1= )[0]\ + + '/' + inc_backup_pattern.substitute(drive=3Ddriv= e, N=3D0) + sub_cmd_1 =3D {"type": "block-dirty-bitmap-add", + "data": {"node": drive, "name": bitmap, + "persistent": True, + "autoload": True}} + sub_cmd_2 =3D {"type": "drive-backup", + "data": {"device": drive, "target": targe= t, + "sync": "full", "format": "qcow2= "}} + self.config.set(guest_name, drive+'_N', '0') + self.config.set(guest_name, 'inc_'+drive, target) + bitmap_cmd['arguments']['actions'].append(sub_cmd_1) + bitmap_cmd['arguments']['actions'].append(sub_cmd_2) + connection.cmd_obj(bitmap_cmd) + connection.cmd_obj(backup_cmd) + self.write_config() + def _drive_add(self, drive_id, guest_name, target=3DNone): """ Adds drive for backup @@ -275,7 +367,10 @@ class BackupTool(object): """ Wrapper for _full_backup method """ - self._full_backup(args.guest) + if args.inc is False: + self._full_backup(args.guest) + else: + self._inc_backup(args.guest) =20 def restore_wrapper(self, args): """ @@ -329,6 +424,8 @@ def main(): backup_parser =3D subparsers.add_parser('backup', help=3D'Creates back= up') backup_parser.add_argument('--guest', action=3D'store', type=3Dstr, help=3D'Name of the guest') + backup_parser.add_argument('--inc', nargs=3D'?', + default=3DFalse, help=3D'Destination path') backup_parser.set_defaults(func=3Dbackup_tool.fullbackup_wrapper) =20 backup_parser =3D subparsers.add_parser('restore', help=3D'Restores dr= ives') --=20 2.7.4 From nobody Tue Nov 4 08:30:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504120656401846.9790624998244; Wed, 30 Aug 2017 12:17:36 -0700 (PDT) Received: from localhost ([::1]:52303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8UX-0000Im-Qa for importer@patchew.org; Wed, 30 Aug 2017 15:17:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8T1-0007ky-6x for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn8Sy-00081r-4r for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:59 -0400 Received: from research.iiit.ac.in ([196.12.53.8]:45870) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn8Sx-00080m-CD for qemu-devel@nongnu.org; Wed, 30 Aug 2017 15:15:56 -0400 Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id C71ED744E38; Thu, 31 Aug 2017 00:45:51 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id BD3tBL10NG5E; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from localhost (localhost [127.0.0.1]) by research.iiit.ac.in (Postfix) with ESMTP id 7B7D6744E42; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from research.iiit.ac.in ([127.0.0.1]) by localhost (research.iiit.ac.in [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xkcTnlkOQlvk; Thu, 31 Aug 2017 00:45:49 +0530 (IST) Received: from ishani-Inspiron-5558.iiit.ac.in (unknown [10.2.20.52]) by research.iiit.ac.in (Postfix) with ESMTPSA id 671D3744E38; Thu, 31 Aug 2017 00:45:49 +0530 (IST) DKIM-Filter: OpenDKIM Filter v2.9.2 research.iiit.ac.in 7B7D6744E42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=research.iiit.ac.in; s=4E8815E6-5B55-11E4-B758-8D4964374E96; t=1504120549; bh=IdwgQSX6Q9FVMfmg/GQl/a6QcSEr4qFzL6iL6/dGMPk=; h=From:To:Subject:Date:Message-Id; b=JfPpQao/QQc/WUhqyEdFRjOLTdrmBbI8yEg52wW0BQI9RhOp4iSaIsc3nIbfHLTGT jJpZudmQ0YkxvUt2ktWtrlSf2uY21nyM9GDN4SGtQyFRO1+uz09i08YN2S4IndeHZh c1rom2VGXSPBAMzsQmM9ZcyNeI4YnCgyOhZtGSNU= X-Virus-Scanned: amavisd-new at research.iiit.ac.in From: Ishani Chugh To: qemu-devel@nongnu.org Date: Thu, 31 Aug 2017 00:45:38 +0530 Message-Id: <1504120538-9309-4-git-send-email-chugh.ishani@research.iiit.ac.in> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> References: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 196.12.53.8 Subject: [Qemu-devel] [PATCH 3/3] Backup Tool: Test for Incremental Backup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ishani Chugh , jsnow@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch is the test for incremental backup implementation in Backup tool. The test employs two basic subtests: 1) Backing up an empty guest and comparing it with base image. 2) Writing a pattern to the guest, creating backup, writing a pattern again, creating backup and comparing with base image. Signed-off-by: Ishani Chugh --- tests/qemu-iotests/193 | 86 ++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/193.out | 34 ++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 121 insertions(+) create mode 100755 tests/qemu-iotests/193 create mode 100644 tests/qemu-iotests/193.out diff --git a/tests/qemu-iotests/193 b/tests/qemu-iotests/193 new file mode 100755 index 0000000..500e5df --- /dev/null +++ b/tests/qemu-iotests/193 @@ -0,0 +1,86 @@ +#!/bin/bash +# +# Test Incremental backup functionality of qemu-backup tool +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dchugh.ishani@research.iiit.ac.in + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_supported_fmt generic +_supported_proto generic +_supported_os Linux + + +CONFIG_FILE=3D$TEST_DIR/backup-config +SOCKET=3Dunix:$TEST_DIR/backup_socket +size=3D128M + +_make_test_img $size +export QEMU_BACKUP_CONFIG=3D$CONFIG_FILE +qemu_comm_method=3D"monitor" +echo +_launch_qemu -drive if=3Dvirtio,file=3D$TEST_IMG -qmp $SOCKET,server,nowait +$PYTHON ../../contrib/backup/qemu-backup.py guest add --guest adad --qmp $= SOCKET +$PYTHON ../../contrib/backup/qemu-backup.py drive add --id virtio0 --guest= adad --target $TEST_DIR/virtio0 +echo +echo "=3D=3D Creating backup =3D=3D" +$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad +_send_qemu_cmd $QEMU_HANDLE 'quit' '' +wait=3D1 _cleanup_qemu +echo +echo "=3D=3D Comparing images =3D=3D" +$QEMU_IMG compare $TEST_DIR/virtio0_inc_0 $TEST_IMG + +rm $TEST_DIR/virtio0_inc_0 + +_launch_qemu -drive if=3Dvirtio,id=3Dvirtio0,file=3D$TEST_IMG -qmp $SOCKET= ,server,nowait +echo +echo "=3D=3D Writing Pattern =3D=3D" +_send_qemu_cmd $QEMU_HANDLE 'qemu-io virtio0 "write -P 0x22 0 1M"' "(qemu)= " | _filter_qemu_io +echo + +echo "=3D=3D Creating backup =3D=3D" +$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad + +echo "=3D=3D Writing Pattern =3D=3D" +_send_qemu_cmd $QEMU_HANDLE 'qemu-io virtio0 "write -P 0x22 0 1M"' "(qemu)= " | _filter_qemu_io +echo +$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad +_send_qemu_cmd $QEMU_HANDLE 'quit' '' +wait=3D1 _cleanup_qemu +echo +echo "=3D=3D Comparing images =3D=3D" +$QEMU_IMG compare $TEST_DIR/virtio0_inc_1 $TEST_IMG +rm $TEST_DIR/virtio0_inc_0 +rm $TEST_DIR/virtio0_inc_1 +rm $CONFIG_FILE + +echo "*** done" +status=3D0 \ No newline at end of file diff --git a/tests/qemu-iotests/193.out b/tests/qemu-iotests/193.out new file mode 100644 index 0000000..3a836c2 --- /dev/null +++ b/tests/qemu-iotests/193.out @@ -0,0 +1,34 @@ +QA output created by 193 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 + +Successfully Added Guest +Successfully Added Drive + +=3D=3D Creating backup =3D=3D +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) Formatting 'TEST_DIR/virtio0_inc_0', fmt=3Dqcow2 size=3D134217728 c= luster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 +quit + +=3D=3D Comparing images =3D=3D +Images are identical. + +=3D=3D Writing Pattern =3D=3D +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) qemu-io virtio0 "write -P 0x22 0 1M" + +=3D=3D Creating backup =3D=3D +Initial Backup does not exist +=3D=3D Writing Pattern =3D=3D +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +(qemu) Formatting 'TEST_DIR/virtio0_inc_0', fmt=3Dqcow2 size=3D134217728 c= luster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 + +Formatting '/home/ishani/Desktop/opw/qemu/tests/qemu-iotests/scratch/virti= o0_inc_1', fmt=3Dqcow2 size=3D134217728 backing_file=3D/home/ishani/Desktop= /opw/qemu/tests/qemu-iotests/scratch/virtio0_inc_0 backing_fmt=3Dqcow2 encr= yption=3Doff cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 +qemu-io virtio0 "write -P 0x22 0 1M" +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +(qemu) quit + +=3D=3D Comparing images =3D=3D +Images are identical. +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 33c945b..6b9e034 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -189,3 +189,4 @@ 191 rw auto 192 rw auto quick 194 rw auto migration quick +193 rw auto --=20 2.7.4