]> git.proxmox.com Git - pve-container.git/commitdiff
migration: avoid variable declared in conditional statement
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 14:42:18 +0000 (16:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 14:42:18 +0000 (16:42 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC/Migrate.pm

index 35455e16fcfd273fb59b8f08df5dd023c3a248ef..ccf5157b4aae69a2624eef8456df83e8c74e9f57 100644 (file)
@@ -55,9 +55,7 @@ sub prepare {
     PVE::LXC::Config->foreach_volume_full($conf, { include_unused => 1 }, sub {
        my ($ms, $mountpoint) = @_;
 
-       my $volid = $mountpoint->{volume};
        my $type = $mountpoint->{type};
-
        # skip dev/bind mps when shared
        if ($type ne 'volume') {
            if ($mountpoint->{shared}) {
@@ -67,7 +65,9 @@ sub prepare {
            }
        }
 
-       my ($storage, $volname) = PVE::Storage::parse_volume_id($volid, 1) if $volid;
+       my $volid = $mountpoint->{volume} or die "missing volume for mount point '$ms'\n";
+
+       my ($storage, $volname) = PVE::Storage::parse_volume_id($volid, 1);
        die "can't determine assigned storage for mount point '$ms'\n" if !$storage;
 
        # check if storage is available on both nodes