Re: [ovirt-users] Bulk move vm disks?

2017-03-26 Thread Yaniv Kaul
On Fri, Mar 24, 2017 at 1:29 PM, Ernest Beinrohr  wrote:

> On 24.03.2017 11:11, gflwqs gflwqs wrote:
>
> Hi list,
> I need to move 600+ vms:from one data domain to another, however from what
> i can see in the GUI i can only move one vm disk at the time which would be
> very time consuming.
>
> I there any way i can bulk move those vm disks?
> By the way, I can't stop the vms they have to be online during the
> migration..
>
> This is my python program:
>
> # ... API init
>
> vms= api.vms.list(query = 'vmname')
>
> for vm in vms:
>   print vm.name
>   for disk in vm.disks.list( ):
>

I personally would not move it disk by disk, VM by VM. It'll take a lot of
time and you can usually move multiple disks at a time.
How many, depend on your storage bottlenecks usually, but few at a time
makes sense to me.


>
> print " disk: " + disk.name + " " + disk.get_alias()
> sd = api.storagedomains.get('NEWSTORAGE')
>
> try:
>   disk.move(params.Action(storage_domain=sd))
>
>   disk_id = disk.get_id()
>   while True:
>

Not breaking for any kind of timeout or state other than 'ok' ?


>
>   print("Waiting for movement to complete ...")
>   time.sleep(10)
>   disk = vm.disks.get(id=disk_id)
>   if disk.get_status().get_state() == "ok":
>   break
>
> except:
>   print "Cannot move."
>

A bit more information here might help diagnosing what has failed.
Y.


>
>
> api.disconnect()
>
>
>
> --
> Ernest Beinrohr, AXON PRO
> Ing , RHCE
> , RHCVA ,
> LPIC , VCA
> ,
> +421-2-62410360 <+421%202/624%20103%2060> +421-903-482603
> <+421%20903%20482%20603>
>
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Bulk move vm disks?

2017-03-24 Thread Staniforth, Paul
Hello Christian,
   I have recently moved around 700 VM disks between 
storage domains, you can select multiple disks in the GUI and move them. I did 
this on oVirt 3.6 most of these were dependant on template disks so I had to 
copy the template disks to the destination domain once all the dependant VM 
disks were moved I could remove the template disk from the source domain.
If the VMs are up it automatically creates a snapshot, in version 3.6 these 
aren't automatically removed.
Regards,
 Paul S.

On 24 Mar 2017 10:12, gflwqs gflwqs  wrote:
Hi list,
I need to move 600+ vms:from one data domain to another, however from what i 
can see in the GUI i can only move one vm disk at the time which would be very 
time consuming.

I there any way i can bulk move those vm disks?
By the way, I can't stop the vms they have to be online during the migration..

Regards
Christian

To view the terms under which this email is distributed, please go to:-
http://disclaimer.leedsbeckett.ac.uk/disclaimer/disclaimer.html
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Bulk move vm disks?

2017-03-24 Thread nicolas
You can use oVirt 4.1 with the ovirt-engine-sdk-python package version 
3.x, they are backwards compatible.


Regards.

El 2017-03-24 11:12, gflwqs gflwqs escribió:

Ok Thank you Nicolas we are using ovirt4.1..

Regards
Christian

2017-03-24 12:03 GMT+01:00 :


El 2017-03-24 10:29, Ernest Beinrohr escribió:
On 24.03.2017 11 [1]:11, gflwqs gflwqs wrote:

Hi list,
I need to move 600+ vms:from one data domain to another, however
from what i can see in the GUI i can only move one vm disk at the
time which would be very time consuming.

I there any way i can bulk move those vm disks?
By the way, I can't stop the vms they have to be online during the
migration..
 This is my python program:

 # ... API init

 vms= api.vms.list(query = 'vmname')


 If you're planning to do it that way, make sure you install version
3.x of ovirt-engine-sdk-python. Newer versions (4.x) differ too much
in syntax.

 Also, if you want to move a whole Storage Domain, you might be
interested in listing VMs by the storage domain name, i.e.:

 api.vms.list(query='Storage=myoldstoragedomain')

 That will return a list of all machines in that storage domain.


 for vm in vms:
   print vm.name [2]
   for disk in vm.disks.list( ):
 print " disk: " + disk.name [3] + " " + disk.get_alias()
 sd = api.storagedomains.get('NEWSTORAGE')

 try:
   disk.move(params.Action(storage_domain=sd))

   disk_id = disk.get_id()
   while True:
   print("Waiting for movement to complete ...")
   time.sleep(10)
   disk = vm.disks.get(id=disk_id)
   if disk.get_status().get_state() == "ok":
   break

 except:
   print "Cannot move."

 api.disconnect()

--

 Ernest Beinrohr, AXON PRO
 Ing [1], RHCE [2], RHCVA [2], LPIC [3], VCA [4],
 +421-2-62410360 [4] +421-903-482603 [5]

Links:
--
[1] http://www.beinrohr.sk/ing.php [6]
[2] http://www.beinrohr.sk/rhce.php [7]
[3] http://www.beinrohr.sk/lpic.php [8]
[4] http://www.beinrohr.sk/vca.php [9]

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users [10]

 ___
 Users mailing list
 Users@ovirt.org
 http://lists.ovirt.org/mailman/listinfo/users [10]



Links:
--
[1] tel:24.03.2017%2011
[2] http://vm.name
[3] http://disk.name
[4] tel:%2B421-2-62410360
[5] tel:%2B421-903-482603
[6] http://www.beinrohr.sk/ing.php
[7] http://www.beinrohr.sk/rhce.php
[8] http://www.beinrohr.sk/lpic.php
[9] http://www.beinrohr.sk/vca.php
[10] http://lists.ovirt.org/mailman/listinfo/users

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Bulk move vm disks?

2017-03-24 Thread nicolas

El 2017-03-24 10:29, Ernest Beinrohr escribió:

On 24.03.2017 11:11, gflwqs gflwqs wrote:


Hi list,
I need to move 600+ vms:from one data domain to another, however
from what i can see in the GUI i can only move one vm disk at the
time which would be very time consuming.

I there any way i can bulk move those vm disks?
By the way, I can't stop the vms they have to be online during the
migration..

 This is my python program:

 # ... API init

 vms= api.vms.list(query = 'vmname')


If you're planning to do it that way, make sure you install version 3.x 
of ovirt-engine-sdk-python. Newer versions (4.x) differ too much in 
syntax.


Also, if you want to move a whole Storage Domain, you might be 
interested in listing VMs by the storage domain name, i.e.:


api.vms.list(query='Storage=myoldstoragedomain')

That will return a list of all machines in that storage domain.



 for vm in vms:
   print vm.name
   for disk in vm.disks.list( ):
     print " disk: " + disk.name + " " + disk.get_alias()
     sd = api.storagedomains.get('NEWSTORAGE')

     try:
   disk.move(params.Action(storage_domain=sd))

   disk_id = disk.get_id()
   while True:
   print("Waiting for movement to complete ...")
   time.sleep(10)
   disk = vm.disks.get(id=disk_id)
   if disk.get_status().get_state() == "ok":
   break

     except:
   print "Cannot move."

 api.disconnect()

--

 Ernest Beinrohr, AXON PRO
 Ing [1], RHCE [2], RHCVA [2], LPIC [3], VCA [4],
 +421-2-62410360 +421-903-482603


Links:
--
[1] http://www.beinrohr.sk/ing.php
[2] http://www.beinrohr.sk/rhce.php
[3] http://www.beinrohr.sk/lpic.php
[4] http://www.beinrohr.sk/vca.php

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Bulk move vm disks?

2017-03-24 Thread Ernest Beinrohr

On 24.03.2017 11:11, gflwqs gflwqs wrote:

Hi list,
I need to move 600+ vms:from one data domain to another, however from 
what i can see in the GUI i can only move one vm disk at the time 
which would be very time consuming.


I there any way i can bulk move those vm disks?
By the way, I can't stop the vms they have to be online during the 
migration..



This is my python program:

# ... API init

vms= api.vms.list(query = 'vmname')

for vm in vms:
  print vm.name
  for disk in vm.disks.list( ):
print " disk: " + disk.name + " " + disk.get_alias()
sd = api.storagedomains.get('NEWSTORAGE')

try:
  disk.move(params.Action(storage_domain=sd))

  disk_id = disk.get_id()
  while True:
  print("Waiting for movement to complete ...")
  time.sleep(10)
  disk = vm.disks.get(id=disk_id)
  if disk.get_status().get_state() == "ok":
  break

except:
  print "Cannot move."

api.disconnect()



--
Ernest Beinrohr, AXON PRO
Ing , RHCE 
, RHCVA 
, LPIC 
, VCA ,

+421-2-62410360 +421-903-482603
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[ovirt-users] Bulk move vm disks?

2017-03-24 Thread gflwqs gflwqs
Hi list,
I need to move 600+ vms:from one data domain to another, however from what
i can see in the GUI i can only move one vm disk at the time which would be
very time consuming.

I there any way i can bulk move those vm disks?
By the way, I can't stop the vms they have to be online during the
migration..

Regards
Christian
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users