From eabe0da02d876a1a48c765d9849206889be2766a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 27 Jul 2012 11:59:42 +0200 Subject: [PATCH] bug fix: allow to set devices directly (-ide1 /dev/XYZ) --- Makefile | 2 +- PVE/API2/Qemu.pm | 28 ++++++++++++++++------------ changelog.Debian | 6 ++++++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index c1f52cf7..69dcb763 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RELEASE=2.1 VERSION=2.0 PACKAGE=qemu-server -PKGREL=45 +PKGREL=46 DESTDIR= PREFIX=/usr diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index dccfbcc0..a1d4ed25 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -85,21 +85,25 @@ my $create_disks = sub { delete $disk->{format}; # no longer needed $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk); } else { - my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid); - PVE::Storage::activate_volumes($storecfg, [ $volid ]) - if PVE::Storage::parse_volume_id ($volid, 1); - my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid); - my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, undef); + my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid); + + my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1); + my $foundvolid = undef; - PVE::Storage::foreach_volid($dl, sub { - my ($volumeid) = @_; - if($volumeid eq $volid) { - $foundvolid = 1; - return; - } - }); + if ($storeid) { + PVE::Storage::activate_volumes($storecfg, [ $volid ]); + my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, undef); + + PVE::Storage::foreach_volid($dl, sub { + my ($volumeid) = @_; + if($volumeid eq $volid) { + $foundvolid = 1; + return; + } + }); + } die "image '$path' does not exists\n" if (!(-f $path || -b $path || $foundvolid)); $res->{$ds} = $settings->{$ds}; diff --git a/changelog.Debian b/changelog.Debian index 1e9895a7..ce6130e9 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +qemu-server (2.0-46) unstable; urgency=low + + * bug fix: allow to set devices directly (-ide1 /dev/XYZ) + + -- Proxmox Support Team Fri, 27 Jul 2012 11:59:14 +0200 + qemu-server (2.0-45) unstable; urgency=low * migrate: only scan available storages