This works flawlessly on my testsetup. I find this information very
useful.

Reviewed-by: Daniel Herzig <d.her...@proxmox.com>

Daniel Kral <d.k...@proxmox.com> writes:

> Adds a syslog entry to log the process id that has been given to the
> QEMU VM process at start. This is helpful debugging information if the
> pid shows up at other places, like a kernel stack trace, while the VM
> has been running, but cannot be retrieved anymore (e.g. the pidfile has
> been deleted or only the syslog is available).
>
> The syslog has been put in the `PVE::QemuServer::vm_start_nolock`
> subroutine to make sure that the PID is logged not only when the VM has
> been started by the API endpoint `vm_start`, but also when the VM is
> started by a remote migration.
>
> Suggested-by: Hannes Dürr <h.du...@proxmox.com>
> Suggested-by: Friedrich Weber <f.we...@proxmox.com>
> Signed-off-by: Daniel Kral <d.k...@proxmox.com>
> ---
> Differences to v1:
>     - Fix commit message trailer order
>     - Uppercase PID in syslog message
>
>  PVE/QemuServer.pm | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index b26da505..ec370473 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -43,6 +43,7 @@ use PVE::ProcFSTools;
>  use PVE::PBSClient;
>  use PVE::RESTEnvironment qw(log_warn);
>  use PVE::RPCEnvironment;
> +use PVE::SafeSyslog;
>  use PVE::Storage;
>  use PVE::SysFSTools;
>  use PVE::Systemd;
> @@ -5971,6 +5972,8 @@ sub vm_start_nolock {
>      eval { PVE::QemuServer::PCI::reserve_pci_usage($pci_reserve_list, $vmid, 
> undef, $pid) };
>      warn $@ if $@;
>  
> +    syslog("info", "VM $vmid started with PID $pid.");
> +
>      if (defined(my $migrate = $res->{migrate})) {
>       if ($migrate->{proto} eq 'tcp') {
>           my $nodename = nodename();


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

Reply via email to