]> git.proxmox.com Git - pve-container.git/commitdiff
migrate: enforce that rootdir content type is available
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 18 Jun 2021 10:59:32 +0000 (12:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Jun 2021 08:40:27 +0000 (10:40 +0200)
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 container images.

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>
src/PVE/LXC/Migrate.pm

index 1e5cb1e924b00e288af885bcef2729c8aa2866da..3cd895da50bdee46d56eb50413f4855976e8a8c9 100644 (file)
@@ -66,6 +66,8 @@ sub prepare {
        my $scfg = PVE::Storage::storage_check_enabled($self->{storecfg}, $storage);
        PVE::Storage::storage_check_enabled($self->{storecfg}, $storage, $self->{node});
 
+       die "content type 'rootdir' is not available on storage '$storage'\n"
+           if !$scfg->{content}->{rootdir};
 
        if ($scfg->{shared}) {
            # PVE::Storage::activate_storage checks this for non-shared storages
@@ -187,13 +189,16 @@ sub phase1 {
        next if !PVE::Storage::storage_check_enabled($self->{storecfg}, $storeid, undef, 1);
 
        # get list from PVE::Storage (for unreferenced volumes)
-       my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid);
+       my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid, undef, 'rootdir');
 
        next if @{$dl->{$storeid}} == 0;
 
        # check if storage is available on target node
        PVE::Storage::storage_check_enabled($self->{storecfg}, $storeid, $self->{node});
 
+       die "content type 'rootdir' is not available on storage '$storeid'\n"
+           if !$scfg->{content}->{rootdir};
+
        PVE::Storage::foreach_volid($dl, sub {
            my ($volid, $sid, $volname) = @_;