mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 18:45:29 +00:00
api/restore: do not trigger autostart task from locked context
Do the same as for the "create" case, only trigger the "start after create/restore" task after the locked "realcmd" was done. Else, the start can never succeed, it also acquires a lock, but restore only release it once outside of realcmd. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
ae200950d4
commit
0c97024d35
@ -574,17 +574,18 @@ __PACKAGE__->register_method({
|
|||||||
}
|
}
|
||||||
|
|
||||||
PVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;
|
PVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;
|
||||||
|
|
||||||
if ($start_after_create) {
|
|
||||||
eval { PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }) };
|
|
||||||
warn $@ if $@;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# ensure no old replication state are exists
|
# ensure no old replication state are exists
|
||||||
PVE::ReplicationState::delete_guest_states($vmid);
|
PVE::ReplicationState::delete_guest_states($vmid);
|
||||||
|
|
||||||
return PVE::QemuConfig->lock_config_full($vmid, 1, $realcmd);
|
PVE::QemuConfig->lock_config_full($vmid, 1, $realcmd);
|
||||||
|
|
||||||
|
if ($start_after_create) {
|
||||||
|
print "Execute autostart\n";
|
||||||
|
eval { PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }) };
|
||||||
|
warn $@ if $@;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
my $createfn = sub {
|
my $createfn = sub {
|
||||||
|
Loading…
Reference in New Issue
Block a user