<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Tejesh M" &lt;tejeshmk@gmail.com&gt;<br><b>To: </b>"Moti Asayag" &lt;masayag@redhat.com&gt;<br><b>Cc: </b>"users@oVirt.org" &lt;users@ovirt.org&gt;, "Omer Frenkel" &lt;ofrenkel@redhat.com&gt;<br><b>Sent: </b>Thursday, March 6, 2014 7:40:47 AM<br><b>Subject: </b>Re: Clone a Template using API<br><div><br></div><div dir="ltr">Thanks Moti.<br></div><div class="gmail_extra"><br><div><br></div><div class="gmail_quote">On Wed, Mar 5, 2014 at 7:06 PM, Moti Asayag <span dir="ltr">&lt;<a href="mailto:masayag@redhat.com" target="_blank" data-mce-href="mailto:masayag@redhat.com">masayag@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><br><br> ----- Original Message -----<br> &gt; From: "Tejesh M" &lt;<a href="mailto:tejeshmk@gmail.com" target="_blank" data-mce-href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a>&gt;<br> &gt; To: "users@oVirt.org" &lt;<a href="mailto:users@ovirt.org" target="_blank" data-mce-href="mailto:users@ovirt.org">users@ovirt.org</a>&gt;, "Moti Asayag" &lt;<a href="mailto:masayag@redhat.com" target="_blank" data-mce-href="mailto:masayag@redhat.com">masayag@redhat.com</a>&gt;<br> &gt; Sent: Wednesday, March 5, 2014 1:01:18 PM<br> &gt; Subject: Clone a Template using API<br> &gt;<br> &gt; Hi,<br> &gt;<br> &gt; While creating VM from Template via Web Admin portal, the default<br> &gt; provisioning is Clone. But while doing the same via API its is doing Thin<br> &gt; provisioning. Can someone share there view.<br> &gt;<br> &gt;<br> &gt; &nbsp; org.ovirt.engine.sdk.entities.Template templateData = new Template();<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; templateData.setName(templateName);<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; org.ovirt.engine.sdk.entities.Cluster clusterData = new Cluster();<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clusterData.setName(clusterName);<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();<br><br><br> Try with those lines:<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Disks disks = new Disks();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disks.setClone(true);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vm.setDisks(disks);<br><br> Adding Omer to confirm.<br></blockquote></div></div></blockquote><div>yes, should work<br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vmDataForCreate.setName(vmName);<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vmDataForCreate.setCluster(clusterData);<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vmDataForCreate.setTemplate(templateData);<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;api.getVMs().add(vmDataForCreate);<br><span class="HOEnZb"><span style="color: #888888;" data-mce-style="color: #888888;" color="#888888">&gt;<br> &gt; --<br> &gt; Thanks &amp; Regards<br> &gt; Tejesh<br> &gt;<br> </span></span></blockquote></div><br><br clear="all"><br>-- <br><div>Thanks &amp; Regards</div><div>Tejesh</div></div></blockquote><div><br></div></div></body></html>