[ovirt-users] How to create a vm cloned independent from python sdk

Juan Hernández jhernand at redhat.com
Wed Dec 10 18:12:31 UTC 2014


On 12/10/2014 05:11 PM, Amedeo Salvati wrote:
> Hello all,
> 
> I'm trying to create a new VM using python sdk with it's disks
> cloned/independent and not on thin provisioning, when I create vm I use
> template (that has a preallocated disks), and I use this code to create
> a vm:
> 
> api.vms.add(params.VM(name=VMNAME, memory=MEM*GB,
> cluster=api.clusters.get(CLUSTER),
>                               template=api.templates.get(templatename),
> description='PROVA' ))
> 
> if I use web portal I'm able to preallocate/clone disks under resource
> allocation tab (New VM -> resource allocation), instead I can't found
> same operations on python sdk...
> 
> someone can let me know what params I should pass to api.vms.add to
> clone disks?
> 
> Best regards
> Amedeo Salvati
> 

To specify that you want to clone the disks (the default is to not clone
them) you need an additional "disks" parameter with the "clone=True"
attribute:

  api.vms.add(
    params.VM(
      vmname=VMNAME,
      memory=MEM*GB,
      cluster=...,
      template=...,
      description=...,
      disks=params.Disks(
        clone=True
      )
    )
  )

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.



More information about the Users mailing list