<div dir="ltr"><div class="gmail_quote"><br>
                <div><span style="font-size:24px">Hi, dear friends.</span></div><div><span style="font-size:24px">My guest has two disks, vda and vdb. both are qcow2 local file.</span></div><div><span style="font-size:24px">When guest running state.</span></div><div><span style="font-size:24px">I want to take the vda snapshot of guest(just vda, no include vdb). but I met libvirt do snapshot for all disks of guest.</span></div><div><span style="font-size:24px"><br></span></div><div><span style="font-size:24px">About methods as follow:</span></div><div><span style="font-size:24px">1、</span></div><div><span style="font-size:24px">``` bash</span></div><div><span style="font-size:24px">virsh</span></div><div><span style="font-variant-ligatures:no-common-ligatures;font-size:24px">snapshot-create-as 8x0lbzvS --name sys_disk3 --disk-only --diskspec "vda,snapshot=external"</span></div><div><span style="font-size:24px">```</span></div><div><span style="font-size:24px">``` result</span></div><div><p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">[root@10k03 ~]# ls -lh /opt/Images/*sys_disk3</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">-rw-------. 1 qemu qemu 194K 3月  20 23:27 /opt/Images/00d76a58-9637-<wbr>4402-9739-21afd1246e06.sys_<wbr>disk3</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">-rw-------. 1 qemu qemu 704K 3月  20 23:52 /opt/Images/8d582c1c-355a-<wbr>4297-9434-2f2f562c77df.sys_<wbr>disk3</span></p></div><div><span style="font-size:24px">```</span></div><div><span style="font-size:24px"><br></span></div><div><span style="font-size:24px">2、</span></div><div><span style="font-size:24px">``` python</span></div><div><p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(115,207,248);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">#!/usr/bin/env python</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(115,207,248);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"># -*- coding: utf-8 -*-</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures;color:#cd32cc">import</span><span style="font-variant-ligatures:no-common-ligatures"> libvirt</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures;color:#cd32cc">import</span><span style="font-variant-ligatures:no-common-ligatures"> libvirt_qemu</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(205,50,204);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">import</span><span style="font-variant-ligatures:no-common-ligatures;color:#908e91"> json</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(205,50,204);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">import</span><span style="font-variant-ligatures:no-common-ligatures;color:#908e91"> sys</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">name = sys.argv[</span><span style="font-variant-ligatures:no-common-ligatures;color:#fe3116">1</span><span style="font-variant-ligatures:no-common-ligatures">]</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures;color:#93d6ee">print</span><span style="font-variant-ligatures:no-common-ligatures"> name</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">conn = libvirt.</span><span style="font-variant-ligatures:no-common-ligatures;color:#93d6ee">open</span><span style="font-variant-ligatures:no-common-ligatures">()</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">dom = conn.lookupByName(name)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">xml = </span><span style="font-variant-ligatures:no-common-ligatures;color:#fe3116">"""</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"><domainsnapshot></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"><name>sysdisk_by_xml</name></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"><description>By xml</description></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"><disks></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"><disk name='vda' snapshot='external'></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"></disk></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"></disks></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures"></domainsnapshot></span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(254,49,22);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">"""</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">flags = </span><span style="font-variant-ligatures:no-common-ligatures;color:#fe3116">0</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">flags |= libvirt.VIR_DOMAIN_SNAPSHOT_<wbr>CREATE_DISK_ONLY</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">flags |= libvirt.VIR_DOMAIN_SNAPSHOT_<wbr>CREATE_QUIESCE</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224);min-height:19px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">ret = dom.snapshotCreateXML(xmlDesc=<wbr>xml, flags=flags)</span></p></div><div><span style="font-size:24px">```</span></div><div><span style="font-size:24px">``` result</span></div><div><p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">[root@10k03 ~]# ls -lh /opt/Images/*sysdisk_by_xml</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">-rw-------. 1 qemu qemu 194K 3月  20 23:52 /opt/Images/00d76a58-9637-<wbr>4402-9739-21afd1246e06.<wbr>sysdisk_by_xml</span></p>
<p style="margin:0px;font-stretch:normal;font-size:15px;line-height:normal;font-family:"Meslo LG S for Powerline";color:rgb(144,142,145);background-color:rgb(248,241,224)"><span style="font-variant-ligatures:no-common-ligatures">-rw-------. 1 qemu qemu 1.2M 3月  21 00:03 /opt/Images/8d582c1c-355a-<wbr>4297-9434-2f2f562c77df.<wbr>sysdisk_by_xml</span></p></div><div><span style="font-size:24px">```</span></div><div><span style="font-size:24px">。</span></div><div><span style="font-size:24px"><br></span></div><div><span style="font-size:24px"><br></span></div><div><span style="font-size:24px">Then, I searched by google. see your page(</span><a href="https://www.redhat.com/archives/libvirt-users/2013-June/msg00102.html" target="_blank">https://www.redhat.com/<wbr>archives/libvirt-users/2013-<wbr>June/msg00102.html</a><span style="font-size:24px">).</span></div><div><span style="font-size:24px"><br></span></div><div><span style="font-size:24px">Now, I want to ask you, have you found the method?</span></div><span class="HOEnZb"><font color="#888888"><div><span style="font-size:24px"><br></span></div>
                <div><div><br></div><div>-- </div><div>James Iter</div><div><br></div></div>
            </font></span></div><br></div>