Migrate VS from Xen to KVM

To migrate a Linux-based VS from Xen to KVM compute resource, use the following request:

POST /virtual_machines/:virtual_machine_id/migration.xml
POST /virtual_machines/:virtual_machine_id/migration.json

XML Request Example

curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass --url http://onapp.test/virtual_machines/4/migration.xml -d '<virtual_machine><migration_type>xen_to_kvm</migration_type><backup_before_migration>0</backup_before_migration><delete_old_backups>0</delete_old_backups><backup_after_migration>0</backup_after_migration><destination><hypervisor_group_id>6</hypervisor_group_id><hypervisor_id>5</hypervisor_id><disks_destinations><disk_id>24727</disk_id><data_store_id>47</data_store_id></disks_destinations></destination></virtual_machine>' 

JSON Request Example

curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass --url http://onapp.test/virtual_machines/4/migration.json -d '{"virtual_machine":{"migration_type":"xen_to_kvm","backup_before_migration":"1","delete_old_backups":"1","backup_after_migration":"1","destination":{"hypervisor_group_id":21,"hypervisor_id":8,"disks_destinations":{"4":5}}}}' 

Where:

migration_type*set to xen_to_kvm if you want to run the migration from Xen to KVM.

backup_before_migration - set to 1 if you want to schedule a backup before the migration. Otherwise, set to(default state is "1")

delete_old_backups - set to 1 if you want to remove old backups incompatible with KVM after the migration is completed. Otherwise, set to 0 (default state is "1") 

If enabled, this option deletes all the old backups besides the one that is taken right before the migration provided that you also enabled scheduling a backup before the migration.

backup_after_migration - set to 1 if you want to schedule backups in case of successful migration. Otherwise, set to(default state is "1")

destination* - hash of destination parameters:

      hypervisor_group_id - the ID of a target compute zone where you migrate a VS

      hypervisor_id - the ID of a target compute resource where you migrate a VS

      disks_destinations - the array where you can pass the following parameters:

          disk_id - the ID of the disk that you want to migrate

          data_store_id - the ID of the target data store