[pve-devel] [PATCH qemu-server v7 0/3] online vm migration to external cluster

Alexandre Derumier aderumier at odiso.com
Mon Apr 29 12:01:42 CEST 2019


This add support to migrate a vm online to an different external cluster.
(This a rework of a previous patch series sent 2years ago)


qm migrate_external <vmid> <node> [--targetstorage otherstorage] [--targetvmid] [--targetkey]       
   --net[n] [,bridge=<bridge>] [,firewall=<1|0>] [,link_down=<1|0>] [,rate=<number>] [,tag=<integer>] [,trunks=<vlanid[;vlanid...]>]


- node is an ip or fqdn host from another cluster. 


OPTIONS:
- targetstorage : allow to choose a different storage name than source.e

- targetvmid : allow to choose a specific vmid. (default is auto/first available)

- targetkey : allow to choose a specific ssh key located in /etc/pve/priv/migrate_external/

- net[n] : allow to override net config 




Migration is done through an ssh tunnel, and 1 private ssh key need to be created for each targetremotenode in:
/etc/pve/priv/migrate_external/id_rsa_mytargetnode

source vm is not deleted currently for safety, just stopped and the migrate lock keeped to avoid
to restart it.


Changelog v7:
  - use QemuMigrate as base
  - reuse QemuMigrate splitted code
  - move exec start remote vm in phase1
  - delete targetvm in phase1_cleanup


Changelog v6:
  - ident cleanp
  - use identity file in ssh connection test

Changelog v5:
  - api : add experimental in desc
  - api : add -net[n] instead --targetbridge. (Cleanme: I'm allowing all options from $netdesc, but filtering them later, to avoid model/mac change)
  - api : don't use noerr for ip/fqdn check.
  - QemuMigrateExternal.pm : bugfix : dclone $conf, to avoid write source vm conf if we change net config
  - QemuMigrateExternal.pm : use net[n] instead targetbridge, skip model/mac/queues.


Changelog v4:
 - fix targetremovenode : can be fqdn or ip address
 - add optionnal targetkey && targetvmid
 - migrate : add a new QemuMigrationExternal.pm with all migration code + remove some part not used, like sync_disk and zfs replication.
 - migrate : force ssh tunnel for migration
 - vm_start : put code in patch3 + remove old no more used  migration_type=external option 


Alexandre Derumier (3):
  api2 : add migrate_vm_external
  add QemuMigrateExternal.pm
  qemu : vm_start : add external_migration

 PVE/API2/Qemu.pm           | 106 +++++++++++++-
 PVE/CLI/qm.pm              |   2 +
 PVE/Makefile               |   1 +
 PVE/QemuMigrateExternal.pm | 340 +++++++++++++++++++++++++++++++++++++++++++++
 PVE/QemuServer.pm          |  32 ++++-
 5 files changed, 475 insertions(+), 6 deletions(-)
 create mode 100644 PVE/QemuMigrateExternal.pm

-- 
2.11.0




More information about the pve-devel mailing list