Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> --- PVE/API2/Qemu.pm | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 24f0dfd..a3592ed 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -35,6 +35,7 @@ use PVE::API2::Qemu::Agent; use PVE::VZDump::Plugin; use PVE::DataCenterConfig; use PVE::SSHInfo; +use PVE::RemoteConfig; BEGIN { if (!$ENV{PVE_GENERATING_DOCS}) { @@ -3297,6 +3298,10 @@ __PACKAGE__->register_method({ description => "Target node.", completion => \&PVE::Cluster::complete_migration_target, }), + remote => { + type => 'string', + optional => 1, + }, online => { type => 'boolean', description => "Use online/live migration if VM is running. Ignored if VM is stopped.", @@ -3354,9 +3359,17 @@ __PACKAGE__->register_method({ PVE::Cluster::check_cfs_quorum(); - PVE::Cluster::check_node_exists($target); + my $targetip; + + if ($param->{remote}) { + my $remote_config = PVE::RemoteConfig->new(); + my (undef, $conn_args) = $remote_config->get_remote_info($param->{remote}, $target); + $targetip = $conn_args->{host}; + } else { + PVE::Cluster::check_node_exists($target); - my $targetip = PVE::Cluster::remote_node_ip($target); + $targetip = PVE::Cluster::remote_node_ip($target); + } my $vmid = extract_param($param, 'vmid'); @@ -3389,14 +3402,18 @@ __PACKAGE__->register_method({ my $storecfg = PVE::Storage::config(); - if( $param->{targetstorage}) { - PVE::Storage::storage_check_node($storecfg, $param->{targetstorage}, $target); - } else { - PVE::QemuServer::check_storage_availability($storecfg, $conf, $target); + if (!$param->{remote}) { + if($param->{targetstorage}) { + PVE::Storage::storage_check_node($storecfg, $param->{targetstorage}, $target); + } else { + PVE::QemuServer::check_storage_availability($storecfg, $conf, $target); + } } if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { + raise_param_exc({ remote => "Remote migration not supported for HA-managed VMs." }); + my $hacmd = sub { my $upid = shift; -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel