mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-05 20:30:12 +00:00
migrate: enforce that image content type is available
and use it for the vdisk_list call too. This avoids scanning (and picking up volumes from!) storages that are not even configured to hold images. Previously, the content type was only enforced when a storage map was present. Also serves a bit as a preparation to enforce content type on guest startup, because now migration failure happens early and not only when trying to start the guest on the remote node. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
0d2db08414
commit
24b84b4766
@ -341,7 +341,14 @@ sub prepare {
|
|||||||
my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
|
my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
|
||||||
|
|
||||||
my $scfg = PVE::Storage::storage_check_enabled($self->{storecfg}, $sid);
|
my $scfg = PVE::Storage::storage_check_enabled($self->{storecfg}, $sid);
|
||||||
PVE::Storage::storage_check_enabled($self->{storecfg}, $targetsid, $self->{node});
|
my $target_scfg = PVE::Storage::storage_check_enabled(
|
||||||
|
$self->{storecfg},
|
||||||
|
$targetsid,
|
||||||
|
$self->{node},
|
||||||
|
);
|
||||||
|
|
||||||
|
die "content type 'images' is not available on storage '$targetsid'\n"
|
||||||
|
if !$target_scfg->{content}->{images};
|
||||||
|
|
||||||
if ($scfg->{shared}) {
|
if ($scfg->{shared}) {
|
||||||
# PVE::Storage::activate_storage checks this for non-shared storages
|
# PVE::Storage::activate_storage checks this for non-shared storages
|
||||||
@ -396,20 +403,20 @@ sub scan_local_volumes {
|
|||||||
next if !PVE::Storage::storage_check_enabled($storecfg, $storeid, undef, 1);
|
next if !PVE::Storage::storage_check_enabled($storecfg, $storeid, undef, 1);
|
||||||
|
|
||||||
# get list from PVE::Storage (for unused volumes)
|
# get list from PVE::Storage (for unused volumes)
|
||||||
my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, $vmid);
|
my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, $vmid, undef, 'images');
|
||||||
|
|
||||||
next if @{$dl->{$storeid}} == 0;
|
next if @{$dl->{$storeid}} == 0;
|
||||||
|
|
||||||
my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $storeid);
|
my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $storeid);
|
||||||
# check if storage is available on target node
|
# check if storage is available on target node
|
||||||
PVE::Storage::storage_check_enabled($storecfg, $targetsid, $self->{node});
|
my $target_scfg = PVE::Storage::storage_check_enabled(
|
||||||
|
$storecfg,
|
||||||
|
$targetsid,
|
||||||
|
$self->{node},
|
||||||
|
);
|
||||||
|
|
||||||
# grandfather in existing mismatches
|
|
||||||
if ($targetsid ne $storeid) {
|
|
||||||
my $target_scfg = PVE::Storage::storage_config($storecfg, $targetsid);
|
|
||||||
die "content type 'images' is not available on storage '$targetsid'\n"
|
die "content type 'images' is not available on storage '$targetsid'\n"
|
||||||
if !$target_scfg->{content}->{images};
|
if !$target_scfg->{content}->{images};
|
||||||
}
|
|
||||||
|
|
||||||
my $bwlimit = PVE::Storage::get_bandwidth_limit(
|
my $bwlimit = PVE::Storage::get_bandwidth_limit(
|
||||||
'migration',
|
'migration',
|
||||||
|
@ -2460,6 +2460,9 @@ sub check_storage_availability {
|
|||||||
# check if storage is available on both nodes
|
# check if storage is available on both nodes
|
||||||
my $scfg = PVE::Storage::storage_check_enabled($storecfg, $sid);
|
my $scfg = PVE::Storage::storage_check_enabled($storecfg, $sid);
|
||||||
PVE::Storage::storage_check_enabled($storecfg, $sid, $node);
|
PVE::Storage::storage_check_enabled($storecfg, $sid, $node);
|
||||||
|
|
||||||
|
die "content type 'images' is not available on storage '$sid'\n"
|
||||||
|
if !$scfg->{content}->{images};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user