unless we are in cleanup mode from a failed snapshot_create,
in which case the config already has a 'snapshot' lock.
this is necessary to prevent concurrent starting of or other
actions on the guest in the windows inbetween holding the
flock, e.g. when removing the volume snapshot (which can
take a bit of time).
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
my $snap;
my $unused = [];
my $snap;
my $unused = [];
+ $class->set_lock($vmid, 'snapshot-delete')
+ if (!$drivehash); # doesn't already have a 'snapshot' lock
+
my $unlink_parent = sub {
my ($confref, $new_parent) = @_;
my $unlink_parent = sub {
my ($confref, $new_parent) = @_;
my $conf = $class->load_config($vmid);
if (!$drivehash) {
my $conf = $class->load_config($vmid);
if (!$drivehash) {
- $class->check_lock($conf);
die "you can't delete a snapshot if vm is a template\n"
if $class->is_template($conf);
}
die "you can't delete a snapshot if vm is a template\n"
if $class->is_template($conf);
}
$snap->{snapstate} = 'delete';
} else {
delete $conf->{snapshots}->{$snapname};
$snap->{snapstate} = 'delete';
} else {
delete $conf->{snapshots}->{$snapname};
- delete $conf->{lock} if $drivehash;
foreach my $volid (@$unused) {
$class->add_unused_volume($conf, $volid);
}
foreach my $volid (@$unused) {
$class->add_unused_volume($conf, $volid);
}