From nobody Mon Feb 9 19:26:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487844117342509.99141237185427; Thu, 23 Feb 2017 02:01:57 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1N9wLb1035118; Thu, 23 Feb 2017 04:58:21 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1N9wKxD017431 for ; Thu, 23 Feb 2017 04:58:20 -0500 Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1N9wKME013791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 23 Feb 2017 04:58:20 -0500 Received: from m15-112.126.com (m15-112.126.com [220.181.15.112]) by mx1.redhat.com (Postfix) with ESMTP id E6B8B3A7696 for ; Thu, 23 Feb 2017 09:58:17 +0000 (UTC) Received: from localhost.localdomain.localdomain (unknown [58.213.111.46]) by smtp2 (Coremail) with SMTP id DMmowABnEhgpsq5YuhpHDA--.11907S4; Thu, 23 Feb 2017 17:58:15 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=V8LqiH5pCx9snOwYjp TI6DpD+DFUwhYi80Y08r4lXNk=; b=c05+0ZrR43B1QYS8EZVzWRvhv8JDcPSnIh u6KHZKQd/6/+FY3bbgrixP5qzP70896xPrCCBxY1hNvOj4ZAi/TAH/0tr1vj/DPm 3Y+9A0ZxQmxsPPzvdvdPh6/iotlXrCzRi2kQmSKHZkxPJsgpbdpT4PgrcK0LQkYl onEVSRGZ4= From: Chen Hanxiao To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 17:57:57 +0800 Message-Id: <1487843877-3497-3-git-send-email-chen_han_xiao@126.com> In-Reply-To: <1487843877-3497-1-git-send-email-chen_han_xiao@126.com> References: <1487843877-3497-1-git-send-email-chen_han_xiao@126.com> X-CM-TRANSID: DMmowABnEhgpsq5YuhpHDA--.11907S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxuF1rXFW3uFWxAFyUJr1DKFg_yoW5XFWUpa yruw12ka4fXr1ktws3uF1ruFy8GrZ7Zry0qan3Ww1qvF13Gan5WF1SqFyq9Fy3Zr4FywsY vFy2gr9rJr15AFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07joa0QUUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbikRiHrlP7KMORxQAAs3 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 23 Feb 2017 09:58:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 23 Feb 2017 09:58:19 +0000 (UTC) for IP:'220.181.15.112' DOMAIN:'m15-112.126.com' HELO:'m15-112.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 3.499 *** (BAYES_60, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, RP_MATCHES_RCVD, SPF_PASS) 220.181.15.112 m15-112.126.com 220.181.15.112 m15-112.126.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH resend v2 2/2] virsh: introduce flage --direct for save command 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao Base upon patches from Roy Keene This patch introduces --direct flag for save command. We could use this flag to save vm to a PIPE. We could saving a VM state directly to Ceph RBD images without having an intermediate file. How to test: fifo=3D"$(mktemp -u)"; mkfifo "${fifo}" && virsh save --pipe cirros "${fif= o}" & cat "${fifo}" | rbd --id cinder import - hotsnapshot/test1234 & wait; rm -f= "${fifo}" Signed-off-by: Roy Keene Signed-off-by: Chen Hanxiao --- v2-resend: rebase on upstream v2: rename VIR_DOMAIN_SAVE_PIPE to VIR_DOMAIN_SAVE_DIRECT tools/virsh-domain.c | 6 ++++++ tools/virsh.pod | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 93587e8..88492e0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4187,6 +4187,10 @@ static const vshCmdOptDef opts_save[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("set domain to be paused on restore") }, + {.name =3D "direct", + .type =3D VSH_OT_BOOL, + .help =3D N_("write the file directly, needed by PIPE/FIFO") + }, {.name =3D "verbose", .type =3D VSH_OT_BOOL, .help =3D N_("display the progress of save") @@ -4223,6 +4227,8 @@ doSave(void *opaque) flags |=3D VIR_DOMAIN_SAVE_RUNNING; if (vshCommandOptBool(cmd, "paused")) flags |=3D VIR_DOMAIN_SAVE_PAUSED; + if (vshCommandOptBool(cmd, "direct")) + flags |=3D VIR_DOMAIN_SAVE_DIRECT; =20 if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0) goto out; diff --git a/tools/virsh.pod b/tools/virsh.pod index 0e434c0..25cfce3 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1896,7 +1896,7 @@ have also reverted all storage volumes back to the sa= me contents as when the state file was created. =20 =3Ditem B I I [I<--bypass-cache>] [I<--xml> B] -[{I<--running> | I<--paused>}] [I<--verbose>] +[{I<--running> | I<--paused>}] [I<--direct>] [I<--verbose>] =20 Saves a running domain (RAM, but not disk state) to a state file so that it can be restored @@ -1911,6 +1911,9 @@ with B command (sent by another virsh in= stance). Another option is to send SIGINT (usually with C) to the virsh process running B command. I<--verbose> displays the progress of save. =20 +Usually B command will save the domain's state as a regular file. +If you want to save it into a PIPE/FIFO, then flag I<--direct> must be set. + This is roughly equivalent to doing a hibernate on a running computer, with all the same limitations. Open network connections may be severed upon restore, as TCP timeouts may have expired. --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list