optional => 1,
description => 'Recognised network interfaces as `net$id` => { ...params } object.',
},
- 'ignored-volumes' => {
- type => 'object',
- additionalProperties => 1,
- optional => 1,
- description => 'Volumes that are explicitly ignored, like e.g., CDROM drives on ESXi.',
- },
'warnings' => {
type => 'array',
description => 'List of known issues that can affect the import of a guest.'
type => "object",
additionalProperties => 1,
properties => {
- message => {
+ 'type' => {
+ description => 'What this warning is about.',
+ enum => [
+ 'cdrom-image-ignored',
+ 'nvme-unsupported',
+ 'ovmf-with-lsi-unsupported',
+ 'serial-port-socket-only',
+ ],
+ type => 'string',
+ },
+ 'key' => {
+ description => 'Related subject (config) key of warning.',
+ optional => 1,
+ type => 'string',
+ },
+ 'value' => {
+ description => 'Related subject (config) value of warning.',
+ optional => 1,
type => 'string',
},
},
my $create_disks = {};
my $create_net = {};
my $warnings = [];
- my $ignored_volumes = {};
+ # NOTE: all types must be added to the return schema of the import-metadata API endpoint
my $warn = sub {
- push @$warnings, { message => $_[0] };
+ my ($type, %properties) = @_;
+ push @$warnings, { type => $type, %properties };
};
my ($cores, $sockets) = $self->cpu_info();
# We currently do not pass cdroms through via the esxi storage.
# Users should adapt import these from the storages directly/manually.
$create_args->{"${bus}${count}"} = "none,media=cdrom";
- $ignored_volumes->{"${bus}${count}"} = "$storeid:$path";
+ # CD-ROM image will not get imported
+ $warn->('cdrom-image-ignored', key => "${bus}${count}", value => "$storeid:$path");
} else {
$create_disks->{"${bus}${count}"} = "$storeid:$path";
}
};
$self->for_each_disk($add_disk);
if (@nvmes) {
- $warn->("PVE currently does not support NVMe guest disks, they are converted to SCSI");
for my $nvme (@nvmes) {
my ($slot, $file, $devtype, $kind) = @$nvme;
- $add_disk->('nvme', $slot, $file, $devtype, $kind, 1);
+ $warn->('nvme-unsupported', key => "nvme${slot}", value => "$file");
+ $add_disk->('scsi', $slot, $file, $devtype, $kind, 1);
}
}
} else {
$scsihw = 'virtio-scsi-single';
}
- $warn->("OVMF is built without LSI drivers, scsi hardware was set to $scsihw");
+ # OVMF is built without LSI drivers, scsi hardware was set to $scsihw
+ $warn->('ovmf-with-lsi-unsupported', key => 'scsihw', value => "$scsihw");
}
}
$create_args->{scsihw} = $scsihw;
$self->for_each_serial(sub {
my ($id, $serial) = @_;
# currently we only support 'socket' type serials anyway
- $warn->("serial ports are currently all mapped to sockets") if $serid == 0;
+ $warn->('serial-port-socket-only', key => "serial$serid");
$create_args->{"serial$serid"} = 'socket';
++$serid;
});
'create-args' => $create_args,
disks => $create_disks,
net => $create_net,
- 'ignored-volumes' => $ignored_volumes,
warnings => $warnings,
};
}