[pve-devel] applied: [PATCH qemu-server] Fix 2097 allow to set and pass wwn parameter for ide, sata and scsi disks

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 26 07:58:21 CET 2019


On 2/25/19 5:30 PM, Christian Ebner wrote:
> This allows to set the wwn parameter for ide, sata and scsi disks in the VM
> config and passes it to the qemu command on execution.
> 

Thanks, but missing about why you did not add it to %drivedesc_base, I can tell
that VirtIO-Block does not support it, but it would be a nice info to have in
the commit message, makes it easier and quicker to review and maybe others
cannot tell at the first glance ;-) Anyway, applied with slightly enhanced
commit message, thanks!


> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
>  PVE/QemuServer.pm | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 6dc68a4..2d3bf58 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -1052,6 +1052,16 @@ my %ssd_fmt = (
>      },
>  );
>  
> +my %wwn_fmt = (
> +    wwn => {
> +	type => 'string',
> +	pattern => qr/^(0x)[0-9a-fA-F]{16}/,
> +	format_description => 'wwn',
> +	description => "The drive's worldwide name, encoded as 16 bytes hex string, prefixed by '0x'.",
> +	optional => 1,
> +    },
> +);
> +
>  my $add_throttle_desc = sub {
>      my ($key, $type, $what, $unit, $longunit, $minimum) = @_;
>      my $d = {
> @@ -1100,6 +1110,7 @@ my $ide_fmt = {
>      %drivedesc_base,
>      %model_fmt,
>      %ssd_fmt,
> +    %wwn_fmt,
>  };
>  PVE::JSONSchema::register_format("pve-qm-ide", $ide_fmt);
>  
> @@ -1116,6 +1127,7 @@ my $scsi_fmt = {
>      %queues_fmt,
>      %scsiblock_fmt,
>      %ssd_fmt,
> +    %wwn_fmt,
>  };
>  my $scsidesc = {
>      optional => 1,
> @@ -1127,6 +1139,7 @@ PVE::JSONSchema::register_standard_option("pve-qm-scsi", $scsidesc);
>  my $sata_fmt = {
>      %drivedesc_base,
>      %ssd_fmt,
> +    %wwn_fmt,
>  };
>  my $satadesc = {
>      optional => 1,
> @@ -1153,6 +1166,7 @@ my $alldrive_fmt = {
>      %queues_fmt,
>      %scsiblock_fmt,
>      %ssd_fmt,
> +    %wwn_fmt,
>  };
>  
>  my $efidisk_fmt = {
> @@ -1784,6 +1798,7 @@ sub print_drivedevice_full {
>  	if ($drive->{ssd} && ($devicetype eq 'block' || $devicetype eq 'hd')) {
>  	    $device .= ",rotation_rate=1";
>  	}
> +	$device .= ",wwn=$drive->{wwn}" if $drive->{wwn};
>  
>      } elsif ($drive->{interface} eq 'ide' || $drive->{interface} eq 'sata') {
>  	my $maxdev = ($drive->{interface} eq 'sata') ? $MAX_SATA_DISKS : 2;
> @@ -1808,6 +1823,7 @@ sub print_drivedevice_full {
>  		$device .= ",rotation_rate=1";
>  	    }
>  	}
> +	$device .= ",wwn=$drive->{wwn}" if $drive->{wwn};
>      } elsif ($drive->{interface} eq 'usb') {
>  	die "implement me";
>  	#  -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
> 




More information about the pve-devel mailing list