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

gregor gregor_forum at catrix.at
Fri Jan 22 09:25:10 UTC 2016


Hi,

if you have issues or improvements please post this on github to improve
the backup tool.

https://github.com/wefixit-AT/oVirtBackup/issues

regards
gregor

On 20/01/16 10:20, Algirdas Žemaitis wrote:
> 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.
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list