with following addition on top (shown here with `-w`), to repeat even more of the checks after forking/locking:
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 59e083eb..a359d096 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -3046,7 +3046,6 @@ __PACKAGE__->register_method({ my $vmid = extract_param($param, 'vmid'); my $newid = extract_param($param, 'newid'); my $pool = extract_param($param, 'pool'); - $rpcenv->check_pool_exist($pool) if defined($pool); my $snapname = extract_param($param, 'snapname'); my $storage = extract_param($param, 'storage'); @@ -3059,6 +3058,10 @@ __PACKAGE__->register_method({ undef $target; } + my $running = PVE::QemuServer::check_running($vmid) || 0; + + my $load_and_check = sub { + $rpcenv->check_pool_exist($pool) if defined($pool); PVE::Cluster::check_node_exists($target) if $target; my $storecfg = PVE::Storage::config(); @@ -3071,15 +3074,13 @@ __PACKAGE__->register_method({ PVE::Storage::storage_check_enabled($storecfg, $storage, $target); # clone only works if target storage is shared my $scfg = PVE::Storage::storage_config($storecfg, $storage); - die "can't clone to non-shared storage '$storage'\n" if !$scfg->{shared}; + die "can't clone to non-shared storage '$storage'\n" + if !$scfg->{shared}; } } PVE::Cluster::check_cfs_quorum(); - my $running = PVE::QemuServer::check_running($vmid) || 0; - - my $load_and_check = sub { my $conf = PVE::QemuConfig->load_config($vmid); PVE::QemuConfig->check_lock($conf); @@ -3159,6 +3160,7 @@ __PACKAGE__->register_method({ my $clonefn = sub { my ($conffile, $newconf, $oldconf, $vollist, $drives, $fullclone) = $load_and_check->(); + my $storecfg = PVE::Storage::config(); # auto generate a new uuid my $smbios1 = PVE::QemuServer::parse_smbios1($newconf->{smbios1} || ''); On January 27, 2022 3:01 pm, Fabian Ebner wrote: > The second patch is fixing a concrete bug with vm_{resume,suspend} not being > issued for a full clone of a running VM without guest agent. Other patches are > minor improvements, mostly trying to prevent future bugs. > > Fabian Ebner (4): > drive mirror monitor: warn when suspend/resume/freeze/thaw calls fail > api: clone: fork before locking > api: move disk: fork before locking > clone disk: don't modify drive parameter > > PVE/API2/Qemu.pm | 382 ++++++++++++++++++++++++---------------------- > PVE/QemuServer.pm | 10 +- > 2 files changed, 205 insertions(+), 187 deletions(-) > > -- > 2.30.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel