<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><br></div></div></div>
<br><div class="gmail_quote">On Fri, Feb 19, 2016 at 12:12 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Fri, Feb 19, 2016 at 11:12:32AM +0000, Andrei Perietanu wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5">
I'm trying to clone a volume in a storage pool and I'm following the steps<br>
described here:<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></div></div>
   *<format type='qcow2'/>*<span class=""><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></span>
   *<format type='raw'/>*<br>
</blockquote>
<br>
<br>
So there are two bugs here, probably.  Does this go away if you refresh<br>
the pool?<br></blockquote><div>          No, refreshing the pool does not help. The problem is not that I don't see the new volume, the problem is I get a "raw" file instead of "qcow2" </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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></blockquote><div>       The tutorial I followed (<a href="http://libvirt.org">libvirt.org</a>) says:</div><div><span style="color:rgb(0,0,0);font-family:'liberation sans','Myriad ','Bitstream Vera Sans','Lucida Grande','Luxi Sans','Trebuchet MS',helvetica,verdana,arial,sans-serif;font-size:12px;line-height:15.48px">"Cloning a storage volume is similar to creating a new storage volume, except that an existing storage volume is used for most of the attributes. Only the name and permissions in the XML parameter are used for the new volume, everything else is inherited from the existing volume."</span><br></div><div><span style="font-size:12px;line-height:15.48px;color:rgb(0,0,0);font-family:'liberation sans',Myriad,'Bitstream Vera Sans','Lucida Grande','Luxi Sans','Trebuchet MS',helvetica,verdana,arial,sans-serif">So I don't specifically mention the file formal in the xml for the new volume.</span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
   <permissions><br>
     <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></span>
--<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>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
_______________________________________________<br>
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>
</blockquote>
</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>