mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-07 01:10:26 +00:00
Refactor has_feature
backup_only is currently not used as snapshot backups are handled by qemu, but this makes the signatures identical to LXC.pm's has_feature.
This commit is contained in:
parent
afa5eae56a
commit
b2ca930a79
@ -5964,7 +5964,8 @@ sub snapshot_prepare {
|
|||||||
if defined($conf->{snapshots}->{$snapname});
|
if defined($conf->{snapshots}->{$snapname});
|
||||||
|
|
||||||
my $storecfg = PVE::Storage::config();
|
my $storecfg = PVE::Storage::config();
|
||||||
die "snapshot feature is not available\n" if !has_feature('snapshot', $conf, $storecfg);
|
die "snapshot feature is not available\n"
|
||||||
|
if !has_feature('snapshot', $conf, $storecfg, undef, undef, $snapname eq 'vzdump');
|
||||||
|
|
||||||
$snap = $conf->{snapshots}->{$snapname} = {};
|
$snap = $conf->{snapshots}->{$snapname} = {};
|
||||||
|
|
||||||
@ -6367,13 +6368,14 @@ sub snapshot_delete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub has_feature {
|
sub has_feature {
|
||||||
my ($feature, $conf, $storecfg, $snapname, $running) = @_;
|
my ($feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
|
||||||
|
|
||||||
my $err;
|
my $err;
|
||||||
foreach_drive($conf, sub {
|
foreach_drive($conf, sub {
|
||||||
my ($ds, $drive) = @_;
|
my ($ds, $drive) = @_;
|
||||||
|
|
||||||
return if drive_is_cdrom($drive);
|
return if drive_is_cdrom($drive);
|
||||||
|
return if $backup_only && !$drive->{backup};
|
||||||
my $volid = $drive->{file};
|
my $volid = $drive->{file};
|
||||||
$err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $volid, $snapname, $running);
|
$err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $volid, $snapname, $running);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user