[ovirt-users] Ovirt python API clone VM to other data domain

Algirdas Žemaitis algirdas at host1plus.com
Wed Jan 20 09:20:16 UTC 2016


Thank you, this was the solution, 
Modified version of original script available here: http://pastebin.com/GEtSJMCN
Original : https://github.com/wefixit-AT/oVirtBackup

Diff: moded version is doing backup for all running VMS in cluster, trying to clone VM into different storage domain (avoiding load on main domain)
Please remove "iterration" if statement, I was using it to stop script from doing backup for all VMs (testing)

-----Original Message-----
From: Juan Hernández [mailto:jhernand at redhat.com] 
Sent: Monday, January 18, 2016 5:37 PM
To: Algirdas Žemaitis <algirdas at host1plus.com>; users at ovirt.org
Subject: Re: [ovirt-users] Ovirt python API clone VM to other data domain

On 01/18/2016 03:39 PM, Algirdas Žemaitis wrote:
> Hello,
> 
>  
> 
> It seems ovirt API lacks of possibility to define storage domain, in 
> which cloned vm (from snapshot) will be created, is it done on 
> purpose, or it is just missing/under development ?
> 
>  
> 
> Scenario using WEB GUI :
> 
> Create snapshot of any running VM, right-click on snapshot, select “clone”
> 
> In pop-up window you can enter new VM name etc, under “resource 
> allocation” section **you can select where it will be created**
> 
>  
> 
>  
> 
> Scenario using python-sdk/ovirt-api
> 
>  
> 
> I was trying to create vm for example like this:
> 
> ##
> 
> vm_params = params.VM(name=vm_from_list + '__bak', 
> cluster=api.clusters.get("Default"),
> storage_domain=api.storagedomains.get("temp"), memory=vm.get_memory(),
> snapshots=snapshots_param)
> 
> api.vms.add(vm_params)
> 
> ##
> 
> # temp is „other“ storage domain, NFS v3
> 
> VM will be still created on same storage as original VM, no matter 
> what domain I will define in params...
> 
> Also tried other variations, using templates, disk profiles and so on, 
> but nothing has changed where new VM is created.
> 
>  
> 
> I know cloning is not intended for backup purpose, but it is 
> workaround probably half of Ovirt users use.
> 
> In my case, it is not very smart to do snapshot and create VM 
> (allocate disk space, etc) on same storage domain where there is 
> already running a lot of VMs, environment is already busy.
> 
>  
> 
> Thanks !
> 

See here:

http://lists.ovirt.org/pipermail/users/2016-January/037321.html

--
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