From nobody Mon Feb 9 09:32:30 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 1489033618292532.0743646351866; Wed, 8 Mar 2017 20:26:58 -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 v294N7Hd019974; Wed, 8 Mar 2017 23:23:08 -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 v294N6OP008679 for ; Wed, 8 Mar 2017 23:23:06 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v294N6B5002924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 8 Mar 2017 23:23:06 -0500 Received: from m15-112.126.com (m15-112.126.com [220.181.15.112]) by mx1.redhat.com (Postfix) with ESMTP id 0588C8124B for ; Thu, 9 Mar 2017 04:23:05 +0000 (UTC) Received: from localhost.localdomain.localdomain (unknown [58.213.111.46]) by smtp2 (Coremail) with SMTP id DMmowAAHvaWg2MBYhIiADg--.22235S4; Thu, 09 Mar 2017 12:23:03 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ec+ZmE+BGasyJfzeYf jQ2qFouaPSY7v8bPpWy5egHy8=; b=m5jN6f3OfZfk2qbJ91+y2OC/omaLyLuoRA /Zz//H1xEDOD3JlA9janYShSC8dnOxMc7kpy5zW9fDanOOZRMscNMz1s+tcFfQff 7c/5ZlYFrbnVPznqdv6Vq2J/XkHlWuFNjqXPe5p0nVnItw1Y6zkNHOJY1UP/cH8e PP4Hd5mJs= From: Chen Hanxiao To: libvir-list@redhat.com Date: Thu, 9 Mar 2017 12:22:23 +0800 Message-Id: <1489033343-15084-3-git-send-email-chen_han_xiao@126.com> In-Reply-To: <1489033343-15084-1-git-send-email-chen_han_xiao@126.com> References: <1489033343-15084-1-git-send-email-chen_han_xiao@126.com> X-CM-TRANSID: DMmowAAHvaWg2MBYhIiADg--.22235S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxuF1rXFW3uFWxAF4ktF1UJrb_yoW5Xw1kpa 95ur1Ika4fXr1ktws3uF15uFy8G397Zry0qan3Ww1qvFnxGan5Wr1SqFyq9Fy3Zr40yanY vFy2gr9rJr1rJFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j4FAJUUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaQeVrlag2dbbQwAAs0 X-Greylist: Delayed for 64:41:50 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 09 Mar 2017 04:23:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 09 Mar 2017 04:23:05 +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: 1.999 * (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.25 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH v3 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 --- v3: rebase on upstream 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 09a9f82..d96e894 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4192,6 +4192,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") @@ -4228,6 +4232,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 ee79046..9dcb527 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1928,7 +1928,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 @@ -1943,6 +1943,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