5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-02-15 05:57:39 +03:00

Fix #1361: create disk: stricter parsing of storage:size

This fixes paths such as
/dev/disk/by-id/some-ID:0.5
being interpreted as a request to create a 0.5G-sized disk
in the storage named '/dev/disk/by-id/some-ID'.
This commit is contained in:
Wolfgang Bumiller 2017-04-24 11:12:29 +02:00 committed by Fabian Grünbichler
parent 3aa44d3b57
commit 175b51fdb5

View File

@ -128,7 +128,7 @@ my $create_disks = sub {
if (!$volid || $volid eq 'none' || $volid eq 'cdrom') {
delete $disk->{size};
$res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
} elsif ($volid =~ m/^(([^:\s]+):)?(\d+(\.\d+)?)$/) {
} elsif ($volid =~ m!^(([^/:\s]+):)?(\d+(\.\d+)?)$!) {
my ($storeid, $size) = ($2 || $default_storage, $3);
die "no storage ID specified (and no default storage)\n" if !$storeid;
my $defformat = PVE::Storage::storage_default_format($storecfg, $storeid);