Am 13.06.25 um 12:00 schrieb Fabian Grünbichler: > On June 12, 2025 4:02 pm, Fiona Ebner wrote: >> @@ -5649,54 +5647,20 @@ sub vm_start_nolock { >> $nodename, $migrate_opts->{network}); >> } >> >> + my $res = {}; >> + my $statefile_is_a_volume; >> + my $state_cmdline = []; >> if ($statefile) { >> - if ($statefile eq 'tcp') { >> - my $migrate = $res->{migrate} = { proto => 'tcp' }; >> - $migrate->{addr} = "localhost"; >> - my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); >> - my $nodename = nodename(); >> - >> - if (!defined($migration_type)) { >> - if (defined($datacenterconf->{migration}->{type})) { >> - $migration_type = $datacenterconf->{migration}->{type}; >> - } else { >> - $migration_type = 'secure'; >> - } >> - } > > I think this fallback here was already not needed.. > > the migration type is always set in migration context, either via `qm > start` (intra-cluster) or via the start call over mtunnel (remote > migration).
Okay, I can add a preparatory patch. > a few lines up we already have the assumptions the $statefile being set > implies $migration_type being set as well. What assumption do you mean? $statefile might also be set after hibernation for example and then there is no $migration_type. >> diff --git a/PVE/QemuServer/StateFile.pm b/PVE/QemuServer/StateFile.pm >> index e297839b..630ccca3 100644 >> --- a/PVE/QemuServer/StateFile.pm >> +++ b/PVE/QemuServer/StateFile.pm >> @@ -29,4 +29,60 @@ sub get_migration_ip { >> return PVE::Cluster::remote_node_ip($nodename, 1); >> } >> >> +# $migration_ip must be defined if using insecure TCP migration >> +sub statefile_cmdline_option { >> + my ($storecfg, $vmid, $statefile, $migrate_opts, $migration_ip) = @_; >> + >> + my $migration_type = $migrate_opts->{type}; >> + >> + my $statefile_is_a_volume = 0; >> + my $res = {}; >> + my $cmd = []; >> + >> + if ($statefile eq 'tcp') { >> + my $migrate = $res->{migrate} = { proto => 'tcp' }; >> + $migrate->{addr} = "localhost"; >> + my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); >> + >> + if (!defined($migration_type)) { >> + if (defined($datacenterconf->{migration}->{type})) { >> + $migration_type = $datacenterconf->{migration}->{type}; >> + } else { >> + $migration_type = 'secure'; >> + } >> + } > > and here we can just assert that a type is set, instead of parsing > datacenter.cfg again and falling back.. Why "again"? It is the very same fallback, just moved here. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel