mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-04 09:29:31 +00:00
get_replicatable_volumes: use PVE::QemuServer::foreach_volid
This commit is contained in:
parent
392f8b5dff
commit
f949eb7760
@ -69,9 +69,7 @@ sub get_replicatable_volumes {
|
||||
my $volhash = {};
|
||||
|
||||
my $test_volid = sub {
|
||||
my ($volid, $drive) = @_;
|
||||
|
||||
return if !$volid;
|
||||
my ($volid, $attr) = @_;
|
||||
|
||||
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
|
||||
return if !$storeid;
|
||||
@ -79,9 +77,9 @@ sub get_replicatable_volumes {
|
||||
my $scfg = storage_config($storecfg, $storeid);
|
||||
return if $scfg->{shared};
|
||||
|
||||
return if PVE::QemuServer::drive_is_cdrom($drive);
|
||||
return if $attr->{cdrom};
|
||||
|
||||
return if !$cleanup && defined($drive->{replicate}) && !$drive->{replicate};
|
||||
return if !$cleanup && !$attr->{replicate};
|
||||
|
||||
if (!PVE::Storage::volume_has_feature($storecfg, 'replicate', $volid)) {
|
||||
return if $cleanup || $noerr;
|
||||
@ -91,19 +89,7 @@ sub get_replicatable_volumes {
|
||||
$volhash->{$volid} = 1;
|
||||
};
|
||||
|
||||
PVE::QemuServer::foreach_drive($conf, sub {
|
||||
my ($ds, $drive) = @_;
|
||||
$test_volid->($drive->{file}, $drive);
|
||||
});
|
||||
|
||||
foreach my $snapname (keys %{$conf->{snapshots}}) {
|
||||
my $snap = $conf->{snapshots}->{$snapname};
|
||||
# fixme: what about $snap->{vmstate}
|
||||
PVE::QemuServer::foreach_drive($snap, sub {
|
||||
my ($ds, $drive) = @_;
|
||||
$test_volid->($drive->{file}, $drive);
|
||||
});
|
||||
}
|
||||
PVE::QemuServer::foreach_volid($conf, $test_volid);
|
||||
|
||||
return $volhash;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user