Ovirt python API clone VM to other data domain

</o:p></span></p> <p class=3D"MsoNormal"><span class=3D"br0">##<o:p></o:p></span></p> <p class=3D"MsoNormal"><span class=3D"br0"># temp is =84other=93 storage do=
--_000_DB5PR09MB0422E945B518A88DA81C075999C00DB5PR09MB0422eurp_ Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: quoted-printable 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 =93clone= =94 In pop-up window you can enter new VM name etc, under =93resource allocatio= n=94 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 =3D params.VM(name=3Dvm_from_list + '__bak', cluster=3Dapi.cluste= rs.get("Default"), storage_domain=3Dapi.storagedomains.get("temp"), memory= =3Dvm.get_memory(), snapshots=3Dsnapshots_param) api.vms.add(vm_params) ## # temp is =84other=93 storage domain, NFS v3 VM will be still created on same storage as original VM, no matter what dom= ain 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 pro= bably half of Ovirt users use. In my case, it is not very smart to do snapshot and create VM (allocate dis= k space, etc) on same storage domain where there is already running a lot o= f VMs, environment is already busy. Thanks ! --_000_DB5PR09MB0422E945B518A88DA81C075999C00DB5PR09MB0422eurp_ Content-Type: text/html; charset="windows-1257" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:= //www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dwindows-1= 257"> <meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} a:link, span.MsoHyperlink {mso-style-priority:99; color:#0563C1; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:#954F72; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri",sans-serif; color:windowtext;} span.sy0 {mso-style-name:sy0;} span.me1 {mso-style-name:me1;} span.br0 {mso-style-name:br0;} span.st0 {mso-style-name:st0;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} @page WordSection1 {size:612.0pt 792.0pt; margin:3.0cm 1.0cm 2.0cm 3.0cm;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3D"LT" link=3D"#0563C1" vlink=3D"#954F72"> <div class=3D"WordSection1"> <p class=3D"MsoNormal"><span lang=3D"EN-US">Hello,<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">It seems ovirt API lacks of pos= sibility 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 = ?<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">Scenario using WEB GUI :<o:p></= o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">Create snapshot of any running = VM, right-click on snapshot, select =93clone=94<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">In pop-up window you can enter = new VM name etc, under =93resource allocation=94 section *<b>you can select= where it will be created</b>*<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">Scenario using python-sdk/ovirt= -api<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">I was trying to create vm for e= xample like this:<o:p></o:p></span></p> <p class=3D"MsoNormal">##<o:p></o:p></p> <p class=3D"MsoNormal">vm_params <span class=3D"sy0">=3D</span> params.<spa= n class=3D"me1">VM</span><span class=3D"br0">(</span>name<span class=3D"sy0= ">=3D</span>vm_from_list + <span class=3D"st0">'__bak'</span><span class=3D"sy0">,</span> cluster<span= class=3D"sy0">=3D</span>api.<span class=3D"me1">clusters</span>.<span clas= s=3D"me1">get</span><span class=3D"br0">(</span><span class=3D"st0">"D= efault"</span><span class=3D"br0">)</span><span class=3D"sy0">,</span> storage_domain<span class=3D"sy0">=3D</span>api.<span class=3D"me1">storag= edomains</span>.<span class=3D"me1">get</span><span class=3D"br0">(</span><= span class=3D"st0">"temp"</span><span class=3D"br0">)</span><span= class=3D"sy0">,</span> memory<span class=3D"sy0">=3D</span>vm.<span class= =3D"me1">get_memory</span><span class=3D"br0">()</span><span class=3D"sy0">= ,</span> snapshots<span class=3D"sy0">=3D</span>snapshots_param<span class=3D"br0">= )<o:p></o:p></span></p> <p class=3D"MsoNormal">api.<span class=3D"me1">vms</span>.<span class=3D"me= 1">add</span><span class=3D"br0">(</span>vm_params<span class=3D"br0">)<o:p= main, NFS v3<o:p></o:p></span></p> <p class=3D"MsoNormal"><span class=3D"br0">VM will be still created on same= storage as original VM, no matter what domain I will define in params...<o= :p></o:p></span></p> <p class=3D"MsoNormal"><span class=3D"br0"><o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">Also tried other variations, us= ing templates, disk profiles and so on, but nothing has changed where new V= M is created.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">I know cloning is not intended = for backup purpose, but it is workaround probably half of Ovirt users use.<= o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">In my case, it is not very smar= t to do snapshot and create VM (allocate disk space, etc) on same storage d= omain where there is already running a lot of VMs, environment is already b= usy.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">Thanks !<o:p></o:p></span></p> </div> </body> </html> --_000_DB5PR09MB0422E945B518A88DA81C075999C00DB5PR09MB0422eurp_--

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.

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@redhat.com] Sent: Monday, January 18, 2016 5:37 PM To: Algirdas Žemaitis <algirdas@host1plus.com>; users@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.

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@redhat.com] Sent: Monday, January 18, 2016 5:37 PM To: Algirdas Žemaitis <algirdas@host1plus.com>; users@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@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (3)
-
Algirdas Žemaitis
-
gregor
-
Juan Hernández