[pve-devel] [PATCH qemu-server 09/10] migrate: add remote migration handling

Fabian Ebner f.ebner at proxmox.com
Thu Nov 11 13:57:24 CET 2021


Am 11.11.21 um 13:25 schrieb Fabian Grünbichler:
> On November 10, 2021 12:17 pm, Fabian Ebner wrote:
>> Am 05.11.21 um 14:03 schrieb Fabian Grünbichler:
>>>    
>>>        # set environment variable useful inside network script
>>> -    $ENV{PVE_MIGRATED_FROM} = $migratedfrom if $migratedfrom;
>>> +    if ($migrate_opts->{remote_node}) {
>>> +	$ENV{PVE_MIGRATED_FROM} = $migrate_opts->{remote_node};
>>> +    } elsif ($migratedfrom) {
>>> +	$ENV{PVE_MIGRATED_FROM} = $migratedfrom;
>>> +    }
>>
>> But the network script tries to load the config from that node and if
>> it's not in the cluster that doesn't work?
>>
> 
> this is a bit confusing, yeah.
> 
> $migratedfrom contains the source node, which is unusable on the remote
> cluster
> remote_node contains the target node, which actually has the full config
> when we start the VM there over the tunnel (in contrast to a local
> migration, where the target node doesn't yet have the config!)
> 
> so this should be correct? but even easier would be to just not set it
> (for remote migrations), since the start MUST happen on the node where
> mtunnel is running/the config is located.

Yes, sorry, I think I might've misread the code yesterday ;)

> 
>>>    
>>>        PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'pre-start', 1);
>>>    
>>> @@ -5621,7 +5625,7 @@ sub vm_start_nolock {
>>>    
>>>    	my $migrate_storage_uri;
>>>    	# nbd_protocol_version > 0 for unix socket support
>>> -	if ($nbd_protocol_version > 0 && $migration_type eq 'secure') {
>>> +	if ($nbd_protocol_version > 0 && ($migration_type eq 'secure' || $migration_type eq 'websocket')) {
>>>    	    my $socket_path = "/run/qemu-server/$vmid\_nbd.migrate";
>>>    	    mon_cmd($vmid, "nbd-server-start", addr => { type => 'unix', data => { path => $socket_path } } );
>>>    	    $migrate_storage_uri = "nbd:unix:$socket_path";
>>>
>>





More information about the pve-devel mailing list