[pve-devel] [PATCH qemu-server 1/2] add support for nvme emulation

Stefan Reiter s.reiter at proxmox.com
Wed May 13 18:32:58 CEST 2020


Gave both patches a spin and they work fine on first glance.

We should probably assign a fixed PCI bus/addr to the NVMe devices 
though (same as we do for SCSI and AHCI hardware with print_pci_addr 
somewhere in the depths of config_to_command).

On 5/13/20 5:36 PM, Oguz Bektas wrote:
> now we can add nvme drives;
> 
> nvme0: local-lvm:vm-103-disk-0,size=32G
> 
> max number is 8
> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>   PVE/QemuServer.pm       | 20 +++++++++++++++++---
>   PVE/QemuServer/Drive.pm | 21 +++++++++++++++++++++
>   2 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index dcf05df..441d209 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -406,7 +406,7 @@ EODESC
>   	optional => 1,
>   	type => 'string', format => 'pve-qm-bootdisk',
>   	description => "Enable booting from specified disk.",
> -	pattern => '(ide|sata|scsi|virtio)\d+',
> +	pattern => '(ide|sata|scsi|virtio|nvme)\d+',
>       },
>       smp => {
>   	optional => 1,
> @@ -1424,7 +1424,11 @@ sub print_drivedevice_full {
>   	    $device .= ",rotation_rate=1";
>   	}
>   	$device .= ",wwn=$drive->{wwn}" if $drive->{wwn};
> -
> +    } elsif ($drive->{interface} eq 'nvme') {
> +	my $maxdev = $PVE::QemuServer::Drive::MAX_NVME_DISKS;

$maxdev is not used anywhere?

> +	my $path = $drive->{file};
> +	$drive->{serial} = "$drive->{interface}$drive->{index}"; # serial is mandatory for nvme
> +	$device = "nvme,drive=drive-$drive->{interface}$drive->{index}";
>       } elsif ($drive->{interface} eq 'ide' || $drive->{interface} eq 'sata') {
>   	my $maxdev = ($drive->{interface} eq 'sata') ? $PVE::QemuServer::Drive::MAX_SATA_DISKS : 2;
>   	my $controller = int($drive->{index} / $maxdev);
 >
 > [...]




More information about the pve-devel mailing list