[Users] Clone a Template using API

Omer Frenkel ofrenkel at redhat.com
Thu Mar 6 07:20:19 UTC 2014


----- Original Message -----

> From: "Tejesh M" <tejeshmk at gmail.com>
> To: "Moti Asayag" <masayag at redhat.com>
> Cc: "users at oVirt.org" <users at ovirt.org>, "Omer Frenkel" <ofrenkel at redhat.com>
> Sent: Thursday, March 6, 2014 7:40:47 AM
> Subject: Re: Clone a Template using API

> Thanks Moti.

> On Wed, Mar 5, 2014 at 7:06 PM, Moti Asayag < masayag at redhat.com > wrote:

> > ----- Original Message -----
> 
> > > From: "Tejesh M" < tejeshmk at gmail.com >
> 
> > > To: "users at oVirt.org" < users at ovirt.org >, "Moti Asayag" <
> > > masayag at redhat.com >
> 
> > > Sent: Wednesday, March 5, 2014 1:01:18 PM
> 
> > > Subject: Clone a Template using API
> 
> > >
> 
> > > Hi,
> 
> > >
> 
> > > While creating VM from Template via Web Admin portal, the default
> 
> > > provisioning is Clone. But while doing the same via API its is doing Thin
> 
> > > provisioning. Can someone share there view.
> 
> > >
> 
> > >
> 
> > > org.ovirt.engine.sdk.entities.Template templateData = new Template();
> 
> > > templateData.setName(templateName);
> 
> > > org.ovirt.engine.sdk.entities.Cluster clusterData = new Cluster();
> 
> > > clusterData.setName(clusterName);
> 
> > > org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
> 

> > Try with those lines:
> 

> > Disks disks = new Disks();
> 
> > disks.setClone(true);
> 
> > vm.setDisks(disks);
> 

> > Adding Omer to confirm.
> 

yes, should work 

> > > vmDataForCreate.setName(vmName);
> 
> > > vmDataForCreate.setCluster(clusterData);
> 
> > > vmDataForCreate.setTemplate(templateData);
> 
> > > api.getVMs().add(vmDataForCreate);
> 
> > >
> 
> > > --
> 
> > > Thanks & Regards
> 
> > > Tejesh
> 
> > >
> 

> --
> Thanks & Regards
> Tejesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140306/d755de1f/attachment-0001.html>


More information about the Users mailing list