improve error message whern cdrom is on local storage

This commit is contained in:
Dietmar Maurer 2011-09-12 12:22:02 +02:00
parent 9b20b0601a
commit 86b8fbeeee

View File

@ -286,6 +286,7 @@ sub sync_disks {
eval { eval {
my $volhash = {}; my $volhash = {};
my $cdromhash = {};
# get list from PVE::Storage (for unused volumes) # get list from PVE::Storage (for unused volumes)
my $dl = PVE::Storage::vdisk_list($storecfg, undef, $vmid); my $dl = PVE::Storage::vdisk_list($storecfg, undef, $vmid);
@ -313,6 +314,7 @@ sub sync_disks {
if (PVE::QemuServer::drive_is_cdrom($drive)) { if (PVE::QemuServer::drive_is_cdrom($drive)) {
die "cant migrate local cdrom drive\n" if $volid eq 'cdrom'; die "cant migrate local cdrom drive\n" if $volid eq 'cdrom';
return if $volid eq 'none'; return if $volid eq 'none';
$cdromhash->{$volid} = 1;
} }
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid); my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
@ -321,11 +323,13 @@ sub sync_disks {
return if $scfg->{shared}; return if $scfg->{shared};
die "can't migrate local cdrom '$volid'\n" if $cdromhash->{$volid};
$sharedvm = 0; $sharedvm = 0;
my ($path, $owner) = PVE::Storage::path($storecfg, $volid); my ($path, $owner) = PVE::Storage::path($storecfg, $volid);
die "can't migrate volume '$volid' - owned by other VM (owner = VM $owner)\n" die "can't migrate volume '$volid' - owned by other VM (owner = VM $owner)\n"
if !$owner || ($owner != $vmid); if !$owner || ($owner != $vmid);
$volhash->{$volid} = 1; $volhash->{$volid} = 1;