<div dir="ltr">I'm using libvirt 1.2.20. Also I noticed that if I specify the file format in the target xml the file is cloned correctly:<div><div>destXML = """</div><div>            <volume></div><div>              <name>"""+name+""".qcow2</name>                  </div><div>              <target></div><div>                <path>/jffs2/disk0/"""+poolName+'/'+name+""".qcow2</path></div><div>                <b><format type='qcow2'/></b></div><div>                <permissions></div><div>                  <owner>-1</owner></div><div>                  <group>-1</group></div><div>                  <mode>0644</mode></div><div>                  <label>virt_image_t</label></div><div>                </permissions></div><div>              </target></div><div>            </volume>"""</div></div><div><br></div><div>But it does not say anything about this part on <a href="http://libvirt.org">libvirt.org</a>. So it's either a bug or the tutorial is not correct.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div><font color="#666666" face="verdana, sans-serif">Andrei</font></div></div></div>
<br><div class="gmail_quote">On Mon, Feb 22, 2016 at 11:10 AM, Martin Kletzander <span dir="ltr"><<a href="mailto:mkletzan@redhat.com" target="_blank">mkletzan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Feb 19, 2016 at 12:33:10PM +0000, Andrei Perietanu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Feb 19, 2016 at 12:12 PM, Martin Kletzander <<a href="mailto:mkletzan@redhat.com" target="_blank">mkletzan@redhat.com</a>><br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Feb 19, 2016 at 11:12:32AM +0000, Andrei Perietanu wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to clone a volume in a storage pool and I'm following the steps<br>
described here:<br>
<br>
<a href="http://libvirt.org/docs/libvirt-appdev-guide-python/en-US/html/libvirt_application_development_guide_using_python-Storage_Pools-Cloning.html" rel="noreferrer" target="_blank">http://libvirt.org/docs/libvirt-appdev-guide-python/en-US/html/libvirt_application_development_guide_using_python-Storage_Pools-Cloning.html</a><br>
<br>
My code looks like:<br>
<br>
destXML = """<br>
           <volume><br>
             <name>"""+newDiskName+""".qcow2</name><br>
             <target><br>
<br>
<path>/jffs2/disk0/"""+poolName+'/'+newDiskName+""".qcow2</path><br>
               <format type='qcow2'/><br>
               <permissions><br>
                 <owner>-1</owner><br>
                 <group>-1</group><br>
                 <mode>0644</mode><br>
                 <label>virt_image_t</label><br>
               </permissions><br>
             </target><br>
           </volume>"""<br>
<br>
srcDisk = tmpPool.storageVolLookupByName(vDisk)<br>
newVol = sp.createXMLFrom(destXML,srcDisk, 0)<br>
<br>
According to the steps described in the link, this should be it; but I<br>
can't start any VM that are using this volume.<br>
<br>
Also comparing the volume XML files for src/dest it looks like the format<br>
is not copied over:<br>
source:<br>
<volume type='file'><br>
 <name>k.qcow2</name><br>
 <key>/jffs2/disk0/sp/vDisk.qcow2</key><br>
 <source><br>
 </source><br>
 <capacity unit='bytes'>3221225472</capacity><br>
 <allocation unit='bytes'>332075008</allocation><br>
 <target><br>
   <path>/jffs2/disk0/sp/vDisk.qcow2</path><br>
   *<format type='qcow2'/>*<br>
   <permissions><br>
     <mode>0644</mode><br>
     <owner>0</owner><br>
     <group>0</group><br>
   </permissions><br>
   <timestamps><br>
     <atime>1455879195</atime><br>
     <mtime>1455879171</mtime><br>
     <ctime>1455879171</ctime><br>
   </timestamps><br>
 </target><br>
<br>
<br>
dest:<br>
<volume type='file'><br>
 <name>newDiskName.qcow2</name><br>
 <key>/jffs2/disk0/sp/newDiskName.qcow2</key><br>
 <source><br>
 </source><br>
 <capacity unit='bytes'>3221225472</capacity><br>
 <allocation unit='bytes'>326868992</allocation><br>
 <target><br>
   <path>/jffs2/disk0/sp/newDiskName.qcow2</path><br>
   *<format type='raw'/>*<br>
<br>
</blockquote>
<br>
<br>
So there are two bugs here, probably.  Does this go away if you refresh<br>
the pool?<br>
<br>
</blockquote>
         No, refreshing the pool does not help. The problem is not that I<br>
don't see the new volume, the problem is I get a "raw" file instead of<br>
"qcow2"<br>
<br>
</blockquote>
<br></div></div>
I know, I wanted to see whether that format changed.  Are those files<br>
really cloned?  I tried the same thing you did and I have the right<br>
format there.  What libvirt version are you running?<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The other thing is that it doesn't matter what's here, you should<br>
explicitly specify the format in the domain XML anyway.  Do you do that?<br>
<br>
</blockquote>
      The tutorial I followed (<a href="http://libvirt.org" rel="noreferrer" target="_blank">libvirt.org</a>) says:<br>
"Cloning a storage volume is similar to creating a new storage volume,<br>
except that an existing storage volume is used for most of the attributes.<br>
Only the name and permissions in the XML parameter are used for the new<br>
volume, everything else is inherited from the existing volume."<br>
So I don't specifically mention the file formal in the xml for the new<br>
volume.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   <permissions><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     <mode>0644</mode><br>
     <owner>0</owner><br>
     <group>0</group><br>
   </permissions><br>
   <timestamps><br>
     <atime>1455878686</atime><br>
     <mtime>1455878681</mtime><br>
     <ctime>1455878681</ctime><br>
   </timestamps><br>
 </target><br>
</volume><br>
<br>
I this a bug in  libvirt->createXMLFrom ?? Or am I missing something?<br>
<br>
Thanks,<br>
Andrei<br>
<br>
--<br>
<br>
<br>
The information transmitted is intended only for the person or entity to<br>
which it is addressed and may contain confidential and/or privileged<br>
material. Any review, retransmission, dissemination or other use of or<br>
taking of any action in reliance upon this information by persons or<br>
entities other than the intended recipient is prohibited. If you receive<br>
this in error please contact the sender and delete the material from any<br>
computer immediately. It is the policy of Klas  Limited to disavow the<br>
sending of offensive material and should you consider that the material<br>
contained in the message is offensive you should contact the sender<br>
immediately and also your I.T. Manager.<br>
<br>
Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St.<br>
NW,<br>
Washington, DC 20007.<br>
<br>
Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish<br>
Limited Liability Company, with its registered office at Fourth Floor, One<br>
Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland.<br>
<br>
</blockquote>
<br>
_______________________________________________<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
libvirt-users mailing list<br>
<a href="mailto:libvirt-users@redhat.com" target="_blank">libvirt-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvirt-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/libvirt-users</a><br>
<br>
</blockquote>
<br>
</blockquote>
<br>
--<br>
<br>
<br>
The information transmitted is intended only for the person or entity to<br>
which it is addressed and may contain confidential and/or privileged<br>
material. Any review, retransmission, dissemination or other use of or<br>
taking of any action in reliance upon this information by persons or<br>
entities other than the intended recipient is prohibited. If you receive<br>
this in error please contact the sender and delete the material from any<br>
computer immediately. It is the policy of Klas  Limited to disavow the<br>
sending of offensive material and should you consider that the material<br>
contained in the message is offensive you should contact the sender<br>
immediately and also your I.T. Manager.<br>
<br>
Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St. NW,<br>
Washington, DC 20007.<br>
<br>
Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish<br>
Limited Liability Company, with its registered office at Fourth Floor, One<br>
Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland.<br>
</blockquote>
</div></div></blockquote></div><br></div></div>

<br>

        
        
        


<p><img src="http://www.klasonline.com/klas_telecom_email_sig_1_01.jpg"></p><p><span style="font-family:Arial;font-size:x-small">The information
transmitted is intended only for the person or entity to which it is
addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of or taking
of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you
receive this in error please contact the sender and delete the
material from any computer immediately. It is the policy of Klas
 Limited to disavow the sending of offensive material and should
you consider that the material contained in the message is offensive
you should contact the sender immediately and also your I.T. Manager.</span></p><p><span style="font-family:Arial;font-size:x-small">Klas Telecom
Inc., a Virginia Corporation with offices at 1101 30th St. NW,
Washington, DC 20007.</span></p>
<p>
<font color="#000000"><font face="Arial"><font size="1">Klas Limited
(Company Number 163303) trading as Klas Telecom, an Irish Limited
Liability Company, with its registered office at Fourth Floor, One
Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland.</font></font></font></p>