dougiteixeira / proxmoxve

Proxmox VE Custom Integration Home Assistant
Apache License 2.0
357 stars 35 forks source link

VM Shutdown Automation breaks ProxMox Login - proxy detected vanished client connection #295

Closed mikeb93 closed 4 months ago

mikeb93 commented 4 months ago

Checklist

Describe the issue you are experiencing

I have an automation that shuts down or starts up some VMs depending on the state of my Synology NAS. The starting automation works fine, but shutting down automation breaks proxmox somehow.

The shutdown automation does not finis and Proxmox becomes unavailable for login. I have to restart pvedaemon or in worst case restart the pve node to be able to logon to the WebUI again. The Integration disconnects as well until i restart the service.

In the proxmox journal i can see the following logs start to appear when the issue happens:

May 15 09:58:15 pve pveproxy[795007]: proxy detected vanished client connection
May 15 09:58:15 pve pvedaemon[798886]: proxmox-backup-client failed: Error: http request timed out
May 15 09:58:15 pve pvedaemon[798887]: proxmox-backup-client failed: Error: http request timed out
May 15 09:58:15 pve pvedaemon[798888]: proxmox-backup-client failed: Error: http request timed out
May 15 09:58:45 pve pveproxy[792515]: proxy detected vanished client connection
May 15 09:58:45 pve pveproxy[792515]: proxy detected vanished client connection
May 15 09:58:45 pve pveproxy[795007]: proxy detected vanished client connection
May 15 09:58:45 pve pveproxy[795007]: proxy detected vanished client connection

I suspect this is rather a Proxmox issue than an issue with this integration?

In which version of Home Assistant Core do you have the problem?

2024.5.3

What version of Proxmox VE Custom Integration has the issue?

3.4.1

What version of Proxmox VE do you have the problem?

8.2.2

Diagnostics information

home-assistant_proxmoxve_2024-05-15T07-59-19.060Z.log

Additional information

The automation in HA:

alias: PVE Start/Stop VMs
description: Start / Stop VMs according to NAS Volume Status
trigger:
  - platform: state
    entity_id:
      - sensor.dewgasv0006_volume_2_status
    from: null
    to: null
    for:
      hours: 0
      minutes: 0
      seconds: 15
    enabled: true
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: sensor.dewgasv0006_volume_2_status
        state: unavailable
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - condition: state
        entity_id: sensor.dewgasv0006_volume_2_status
        state: normal
        for:
          hours: 0
          minutes: 0
          seconds: 0
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.dewgasv0006_volume_2_status
            state: unavailable
        sequence:
          - service: shell_command.pve_disable_shares
            data: {}
            alias: Disable Shares on PVE Host
          - alias: Shutdown srvemby01
            if:
              - type: is_running
                condition: device
                device_id: ef12c107b4aedea46b292bd5619e96f7
                entity_id: ab9ff7f279c2d631ab5a7b7432693ad0
                domain: binary_sensor
            then:
              - device_id: ef12c107b4aedea46b292bd5619e96f7
                domain: button
                entity_id: d15f06a1c74400e27bb264ce135e4b5e
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvemby01 shut down!
                  message: Emby Server was shut down!
            enabled: true
          - alias: Shutdown srvjfin01
            if:
              - type: is_running
                condition: device
                device_id: 7dcffd22835f101883a63d5af6c29b53
                entity_id: 377363a473418bc4e39d1aa137c89b25
                domain: binary_sensor
            then:
              - device_id: 7dcffd22835f101883a63d5af6c29b53
                domain: button
                entity_id: 7e0ddd12ee9095fe8dd30bb89967bf92
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvjfin01 shut down!
                  message: Jellyfin Server was shut down!
            enabled: true
          - alias: Shutdown srvpngx01
            if:
              - type: is_running
                condition: device
                device_id: 9b9c79afe27d097578f965ba81296c38
                entity_id: f483fa4d3fe778c2327396e2a205c288
                domain: binary_sensor
            then:
              - device_id: 9b9c79afe27d097578f965ba81296c38
                domain: button
                entity_id: f4f3a4f03622bdb2b8a88a3050686129
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvpngx01 shut down!
                  message: Paperless Server was shut down!
            enabled: true
          - alias: Shutdown srvnc01
            if:
              - type: is_running
                condition: device
                device_id: ddbd079a96b7218b9f531a1e2a70a95c
                entity_id: 6b73105b750139d19dbd67669ed9bd86
                domain: binary_sensor
            then:
              - device_id: ddbd079a96b7218b9f531a1e2a70a95c
                domain: button
                entity_id: f9c553cfa550d52ecae4e851617711cd
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvnc01 shut down!
                  message: Nextcloud Server was shut down!
            enabled: true
          - alias: Shutdown srvpbs01
            if:
              - type: is_running
                condition: device
                device_id: 15274ea46bd192e33c4a87fd4bace970
                entity_id: 225486b8008749049fc8d9ae58470b52
                domain: binary_sensor
            then:
              - device_id: 15274ea46bd192e33c4a87fd4bace970
                domain: button
                entity_id: a86d24241cb4d03b08b39837d0d67a4f
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvpbs01 shut down!
                  message: Backup Server was shut down!
            enabled: false
        alias: Volume 2 not available - Shutdown VMs
      - conditions:
          - condition: state
            entity_id: sensor.dewgasv0006_volume_2_status
            state: normal
        sequence:
          - service: shell_command.pve_enable_shares
            data: {}
            alias: Enable Shares on PVE Host
          - alias: Start srvemby01
            if:
              - type: is_not_running
                condition: device
                device_id: ef12c107b4aedea46b292bd5619e96f7
                entity_id: ab9ff7f279c2d631ab5a7b7432693ad0
                domain: binary_sensor
            then:
              - device_id: ef12c107b4aedea46b292bd5619e96f7
                domain: button
                entity_id: 650c4c3f38e94943f3c1af9fa6770c2d
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvemby01 started!
                  message: Emby Server was started!
            enabled: true
          - alias: Start srvjfin01
            if:
              - type: is_not_running
                condition: device
                device_id: 7dcffd22835f101883a63d5af6c29b53
                entity_id: 377363a473418bc4e39d1aa137c89b25
                domain: binary_sensor
            then:
              - device_id: 7dcffd22835f101883a63d5af6c29b53
                domain: button
                entity_id: 6bf063480ed85f0fd513ca2fc30e148b
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvjfin01 started!
                  message: Jellyfin Server was started!
            enabled: true
          - alias: Start srvpngx01
            if:
              - type: is_not_running
                condition: device
                device_id: 9b9c79afe27d097578f965ba81296c38
                entity_id: f483fa4d3fe778c2327396e2a205c288
                domain: binary_sensor
            then:
              - device_id: 9b9c79afe27d097578f965ba81296c38
                domain: button
                entity_id: da2302feb6d24eb6cb73177d671ba28c
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvpngx01 started!
                  message: Paperless Server was started!
            enabled: true
          - alias: Start srvnc01
            if:
              - type: is_not_running
                condition: device
                device_id: ddbd079a96b7218b9f531a1e2a70a95c
                entity_id: 6b73105b750139d19dbd67669ed9bd86
                domain: binary_sensor
            then:
              - device_id: ddbd079a96b7218b9f531a1e2a70a95c
                domain: button
                entity_id: fc624474ca2088e877adc21caa5b94d1
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvnc01 started!
                  message: Nextcloud Server was started!
            enabled: true
          - alias: Start srvpbs01
            if:
              - type: is_not_running
                condition: device
                device_id: 15274ea46bd192e33c4a87fd4bace970
                entity_id: 225486b8008749049fc8d9ae58470b52
                domain: binary_sensor
            then:
              - device_id: 15274ea46bd192e33c4a87fd4bace970
                domain: button
                entity_id: 5270f7bd9577f91aa21f3aa200f2ccd4
                type: press
              - service: notify.mobile_app_pnxq791hdx
                metadata: {}
                data:
                  title: srvpbs01 started!
                  message: Backup Server was started!
            enabled: true
        alias: Volume 2 Normal - Start VMs
mode: single
dougiteixeira commented 4 months ago

I don't see how this is an integration problem. In fact, I think the problem may be how you are using the integration.

As your automation YAML doesn't show the IDs of the entities involved, I can't even help you. I suggest you review your automation...

Just one question that comes to mind: are you not sending the host node shutdown command? Because if it does, that's what will happen.