mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-04 16:38:16 +00:00
api: create disks: prohibit format option mismatch for managed volume
Since commit "print drive commandline: improve format detection" such mismatches will lead to being unable to start the VM, so catch the issue early. Suggested-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
9c5e02e5dd
commit
7dede85815
@ -29,7 +29,7 @@ use PVE::QemuConfig;
|
||||
use PVE::QemuServer;
|
||||
use PVE::QemuServer::Cloudinit;
|
||||
use PVE::QemuServer::CPUConfig;
|
||||
use PVE::QemuServer::Drive;
|
||||
use PVE::QemuServer::Drive qw(checked_parse_volname);
|
||||
use PVE::QemuServer::Helpers;
|
||||
use PVE::QemuServer::ImportDisk;
|
||||
use PVE::QemuServer::Monitor qw(mon_cmd);
|
||||
@ -568,10 +568,17 @@ my sub create_disks : prototype($$$$$$$$$$$) {
|
||||
} else {
|
||||
PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
|
||||
if ($storeid) {
|
||||
my ($vtype) = PVE::Storage::parse_volname($storecfg, $volid);
|
||||
my ($vtype, $volume_format) = (checked_parse_volname($storecfg, $volid))[0,6];
|
||||
|
||||
die "cannot use volume $volid - content type needs to be 'images' or 'iso'"
|
||||
if $vtype ne 'images' && $vtype ne 'iso';
|
||||
|
||||
# TODO PVE 9 - consider disallowing setting an explicit format for managed volumes.
|
||||
if ($disk->{format} && $disk->{format} ne $volume_format) {
|
||||
die "drive '$ds' - volume '$volid' - 'format=$disk->{format}' option different"
|
||||
." from storage format '$volume_format'\n";
|
||||
}
|
||||
|
||||
if (PVE::QemuServer::Drive::drive_is_cloudinit($disk)) {
|
||||
if (
|
||||
my $ci_key = PVE::QemuConfig->has_cloudinit($conf, $ds)
|
||||
|
Loading…
Reference in New Issue
Block a user