mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 17:30:20 +00:00
add comments and rename volhash
This commit is contained in:
parent
4abdd867df
commit
dabf24736c
@ -218,13 +218,15 @@ sub sync_disks {
|
|||||||
|
|
||||||
my $conf = $self->{vmconf};
|
my $conf = $self->{vmconf};
|
||||||
|
|
||||||
|
# local volumes which have been copied
|
||||||
$self->{volumes} = [];
|
$self->{volumes} = [];
|
||||||
|
|
||||||
my $res = [];
|
my $res = [];
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
|
|
||||||
my $volhash = {};
|
# found local volumes and their origin
|
||||||
|
my $local_volumes = {};
|
||||||
|
|
||||||
my $sharedvm = 1;
|
my $sharedvm = 1;
|
||||||
|
|
||||||
@ -246,7 +248,7 @@ sub sync_disks {
|
|||||||
PVE::Storage::foreach_volid($dl, sub {
|
PVE::Storage::foreach_volid($dl, sub {
|
||||||
my ($volid, $sid, $volname) = @_;
|
my ($volid, $sid, $volname) = @_;
|
||||||
|
|
||||||
$volhash->{$volid} = 'storage';
|
$local_volumes->{$volid} = 'storage';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +274,7 @@ sub sync_disks {
|
|||||||
|
|
||||||
$sharedvm = 0;
|
$sharedvm = 0;
|
||||||
|
|
||||||
$volhash->{$volid} = defined($snapname) ? 'snapshot' : 'config';
|
$local_volumes->{$volid} = defined($snapname) ? 'snapshot' : 'config';
|
||||||
|
|
||||||
die "can't migrate local cdrom '$volid'\n" if $is_cdrom;
|
die "can't migrate local cdrom '$volid'\n" if $is_cdrom;
|
||||||
|
|
||||||
@ -309,12 +311,12 @@ sub sync_disks {
|
|||||||
}
|
}
|
||||||
PVE::QemuServer::foreach_drive($conf, $test_drive);
|
PVE::QemuServer::foreach_drive($conf, $test_drive);
|
||||||
|
|
||||||
foreach my $vol (sort keys %$volhash) {
|
foreach my $vol (sort keys %$local_volumes) {
|
||||||
if ($volhash->{$vol} eq 'storage') {
|
if ($local_volumes->{$vol} eq 'storage') {
|
||||||
$self->log('info', "found local disk '$vol' (via storage)\n");
|
$self->log('info', "found local disk '$vol' (via storage)\n");
|
||||||
} elsif ($volhash->{$vol} eq 'config') {
|
} elsif ($local_volumes->{$vol} eq 'config') {
|
||||||
$self->log('info', "found local disk '$vol' (in current VM config)\n");
|
$self->log('info', "found local disk '$vol' (in current VM config)\n");
|
||||||
} elsif ($volhash->{$vol} eq 'snapshot') {
|
} elsif ($local_volumes->{$vol} eq 'snapshot') {
|
||||||
$self->log('info', "found local disk '$vol' (referenced by snapshot(s))\n");
|
$self->log('info', "found local disk '$vol' (referenced by snapshot(s))\n");
|
||||||
} else {
|
} else {
|
||||||
$self->log('info', "found local disk '$vol'\n");
|
$self->log('info', "found local disk '$vol'\n");
|
||||||
@ -326,7 +328,7 @@ sub sync_disks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# additional checks for local storage
|
# additional checks for local storage
|
||||||
foreach my $volid (keys %$volhash) {
|
foreach my $volid (keys %$local_volumes) {
|
||||||
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
|
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
|
||||||
my $scfg = PVE::Storage::storage_config($self->{storecfg}, $sid);
|
my $scfg = PVE::Storage::storage_config($self->{storecfg}, $sid);
|
||||||
|
|
||||||
@ -342,7 +344,7 @@ sub sync_disks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $volid (keys %$volhash) {
|
foreach my $volid (keys %$local_volumes) {
|
||||||
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
|
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
|
||||||
push @{$self->{volumes}}, $volid;
|
push @{$self->{volumes}}, $volid;
|
||||||
PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{nodeip}, $sid);
|
PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{nodeip}, $sid);
|
||||||
|
Loading…
Reference in New Issue
Block a user