]> git.proxmox.com Git - pve-container.git/commitdiff
migrate: improve target storage checks
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 11 Feb 2022 10:29:44 +0000 (11:29 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 11 Feb 2022 15:16:07 +0000 (16:16 +0100)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/API2/LXC.pm
src/PVE/LXC/Migrate.pm

index 37db8411d29ab7f4f89c4688891dcf3b944233bb..84712f79b505bbacee0afa7af7704534948f66d1 100644 (file)
@@ -1162,7 +1162,7 @@ __PACKAGE__->register_method({
        if (my $targetstorage = delete $param->{'target-storage'}) {
            my $storecfg = PVE::Storage::config();
            my $storagemap = eval { PVE::JSONSchema::parse_idmap($targetstorage, 'pve-storage-id') };
-           raise_param_exc({ targetstorage => "failed to parse storage map: $@" })
+           raise_param_exc({ 'target-storage' => "failed to parse storage map: $@" })
                if $@;
 
            $rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk'])
index c85a09c33f4c7c7b6cef6a62029a8c88f5287c54..1739c7809de8e0140344e9cca25f52dce4413ec6 100644 (file)
@@ -211,10 +211,10 @@ sub phase1 {
 
        # check if storage is available on target node
        my $targetsid = PVE::JSONSchema::map_id($self->{opts}->{storagemap}, $storeid);
-       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 'rootdir' is not available on storage '$storeid'\n"
-           if !$scfg->{content}->{rootdir};
+       die "content type 'rootdir' is not available on storage '$targetsid'\n"
+           if !$target_scfg->{content}->{rootdir};
 
        PVE::Storage::foreach_volid($dl, sub {
            my ($volid, $sid, $volname) = @_;