public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server v6 2/4] api: status/current: add display property
Date: Tue, 8 Apr 2025 13:26:11 +0200	[thread overview]
Message-ID: <0704a6ce-0ed9-4bd8-a4e5-56b266df3572@proxmox.com> (raw)
In-Reply-To: <20250408103715.1081055-3-a.lauterer@proxmox.com>

Am 08.04.25 um 12:37 schrieb Aaron Lauterer:
> This new property returns the configured or default display for a VM.
> 
> Instead of a flat property, we use a nested 'type' object that contains
> the actual information. This way we can add other properties that belong
> to a VM's display in the future without much hassle, to have them all in
> one place.
> Candidates to be moved into the display property are for example the
> spice and clipboard property.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> Getting all the parameters for get_vga_properties added a bit of
> boilerplate. Should be get another external call site to it we could
> think about moving the boilerplate into get_vga_properties to handle
> missing parameters. But for now I would rather not change the
> get_vga_properties itself.

Yeah, that's not too nice. FWIW, machine versions 2.X will get dropped
with QEMU 10.0, so at least we'll not require the machine version
anymore then.

> @@ -3087,8 +3097,19 @@ __PACKAGE__->register_method({
>  
>  	$status->{ha} = PVE::HA::Config::get_service_status("vm:$param->{vmid}");
>  
> +	my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
> +	my $kvm_binary = PVE::QemuServer::Helpers::get_command_for_arch($arch);
> +	my $kvmver = PVE::QemuServer::Helpers::kvm_user_version($kvm_binary);
> +	my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, undef, $arch);
> +	my $machine_version = PVE::QemuServer::extract_version($machine_type, $kvmver);

Please use the PVE::QemuServer::Machine::extract_version() helper here.

> +	my $winversion = PVE::QemuServer::Helpers::windows_version($conf->{ostype});
> +	my ($default_display, undef) = PVE::QemuServer::get_vga_properties($conf, $arch, $machine_version, $winversion);

That's not necessarily the default display. It's only the default if
there is no $conf->{vga}. It /would/ already be the effectively
configured one, except...the helper re-maps 'qxl2', 'qxl3' and 'qxl4' to
'qxl' :/ And because of that re-mapping you'll still need the line below
after parsing.

(The qxl ones shouldn't have been separate types in hindsight, but
rather type=qxl,qxl-display-count=N, but too late for that).

I guess we do want a separate helper get_deafult_vga_type() for just
getting the default and use that here and within get_vga_properties().

> +
> +	$status->{display}->{type} = $default_display->{type};
>  	if ($conf->{vga}) {
>  	    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
> +	    $status->{display}->{type} = $vga->{type} if defined($vga->{type});
> +
>  	    my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
>  	    $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
>  	    $status->{spice} = 1 if $spice;



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-04-08 11:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 10:37 [pve-devel] [PATCH qemu-server, manager v6 0/4] fix #1926 autodetect xtermjs or novnc for VM console Aaron Lauterer
2025-04-08 10:37 ` [pve-devel] [PATCH qemu-server v6 1/4] QemuServer: make get_vga_properties and extract_version public Aaron Lauterer
2025-04-08 11:26   ` Fiona Ebner
2025-04-08 10:37 ` [pve-devel] [PATCH qemu-server v6 2/4] api: status/current: add display property Aaron Lauterer
2025-04-08 11:26   ` Fiona Ebner [this message]
2025-04-08 10:37 ` [pve-devel] [PATCH manager v6 3/4] fix #1926 ui: vm console: autodetect novnc or xtermjs Aaron Lauterer
2025-04-08 10:37 ` [pve-devel] [PATCH manager v6 4/4] ui: console: check on activate if display info for VMs is present Aaron Lauterer
2025-04-08 12:29 ` [pve-devel] [PATCH qemu-server, manager v6 0/4] fix #1926 autodetect xtermjs or novnc for VM console Aaron Lauterer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0704a6ce-0ed9-4bd8-a4e5-56b266df3572@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal