]> git.proxmox.com Git - qemu-server.git/commitdiff
Fix #1361: create disk: stricter parsing of storage:size
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 24 Apr 2017 09:12:29 +0000 (11:12 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 10 May 2017 08:31:25 +0000 (10:31 +0200)
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'.

PVE/API2/Qemu.pm

index 5051727a3d934efd5ff39326358e485050aeb052..43a5e4a503ba9a784259b492a1cd7dea1847b16e 100644 (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);