public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] resume: error out if VM is a template
@ 2025-02-18 11:03 Fabian Grünbichler
  2025-02-18 13:39 ` Fiona Ebner
  2025-02-18 14:03 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2025-02-18 11:03 UTC (permalink / raw)
  To: pve-devel

template VMs might be started in prelaunch state when creating a backup, but
they must never be actually started fully, to avoid modifying their disks.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 PVE/QemuServer.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c1fbd468..b23b79e1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6403,6 +6403,9 @@ sub vm_resume {
 	    $conf = PVE::QemuConfig->load_config($vmid);
 	}
 
+	die "VM $vmid is a template and cannot be resumed!\n"
+	    if PVE::QemuConfig->is_template($conf);
+
 	if ($res->{status}) {
 	    return if $res->{status} eq 'running'; # job done, go home
 	    $resume_cmd = 'system_wakeup' if $res->{status} eq 'suspended';
-- 
2.39.5



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH qemu-server] resume: error out if VM is a template
  2025-02-18 11:03 [pve-devel] [PATCH qemu-server] resume: error out if VM is a template Fabian Grünbichler
@ 2025-02-18 13:39 ` Fiona Ebner
  2025-02-18 14:03 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2025-02-18 13:39 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

Am 18.02.25 um 12:03 schrieb Fabian Grünbichler:
> template VMs might be started in prelaunch state when creating a backup, but
> they must never be actually started fully, to avoid modifying their disks.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  PVE/QemuServer.pm | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index c1fbd468..b23b79e1 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6403,6 +6403,9 @@ sub vm_resume {
>  	    $conf = PVE::QemuConfig->load_config($vmid);
>  	}
>  
> +	die "VM $vmid is a template and cannot be resumed!\n"
> +	    if PVE::QemuConfig->is_template($conf);
> +
>  	if ($res->{status}) {
>  	    return if $res->{status} eq 'running'; # job done, go home
>  	    $resume_cmd = 'system_wakeup' if $res->{status} eq 'suspended';

IMHO, it'd be slightly more natural to make this check before issuing
the "query-status" QMP call. Mostly pre-existing, because the config
loading is already done in between the QMP call and using its result.

Either way:
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] resume: error out if VM is a template
  2025-02-18 11:03 [pve-devel] [PATCH qemu-server] resume: error out if VM is a template Fabian Grünbichler
  2025-02-18 13:39 ` Fiona Ebner
@ 2025-02-18 14:03 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2025-02-18 14:03 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

Am 18.02.25 um 12:03 schrieb Fabian Grünbichler:
> template VMs might be started in prelaunch state when creating a backup, but
> they must never be actually started fully, to avoid modifying their disks.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  PVE/QemuServer.pm | 3 +++
>  1 file changed, 3 insertions(+)
> 
>

applied, with Fiona's R-b, thanks!


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-18 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18 11:03 [pve-devel] [PATCH qemu-server] resume: error out if VM is a template Fabian Grünbichler
2025-02-18 13:39 ` Fiona Ebner
2025-02-18 14:03 ` [pve-devel] applied: " Thomas Lamprecht

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