feat(servers): distinguish rejected credentials from unreachable nodes
An offline server used to report a single "Failed to connect" state, but "the node does not answer" and "the node answered 401" are fixed in completely different ways — the first is power or network, the second is a stale token, which is what happens when a node joins a cluster and its user.cfg and priv/token.cfg are replaced by the cluster ones. - add ProxmoxClient.check_connection() returning (ok, error_kind, error); token auth surfaces 401 as ResourceException rather than AuthenticationError, since proxmoxer validates the token on first use - store the reason in proxmox_servers.last_error_kind (migration 40) and expose it through the server response - surface an auth_error state in the UI with a hint explaining the usual cause Storage listings now also report per-node availability: the cluster config declares a storage for the whole cluster but says nothing about whether it actually came up on a given node, so a missing volume group or pool stayed invisible. Availability comes from a single /cluster/resources call.
This commit is contained in:
@@ -1562,6 +1562,14 @@ def migrate_appstore_default_credentials(conn):
|
||||
logger.info("✓ App Store catalog_apps.default_credentials column added")
|
||||
|
||||
|
||||
def migrate_server_error_kind(conn):
|
||||
"""Add last_error_kind column to proxmox_servers ('auth' | 'connection')."""
|
||||
if not table_exists(conn, 'proxmox_servers'):
|
||||
return
|
||||
if add_column_if_not_exists(conn, 'proxmox_servers', 'last_error_kind', 'VARCHAR(20)'):
|
||||
logger.info("✓ proxmox_servers.last_error_kind column added")
|
||||
|
||||
|
||||
def migrate_script_repo_metadata_format(conn):
|
||||
"""Add metadata_format column to script_git_repos (header-comment | community-scripts-ct)."""
|
||||
if not table_exists(conn, 'script_git_repos'):
|
||||
@@ -2015,6 +2023,14 @@ def run_all_migrations(engine, db_session=None):
|
||||
logger.warning(f"App Store default_credentials migration: {e}")
|
||||
conn.rollback()
|
||||
|
||||
# Migration 40: proxmox_servers.last_error_kind ('auth' | 'connection')
|
||||
try:
|
||||
migrate_server_error_kind(conn)
|
||||
conn.commit()
|
||||
except Exception as e:
|
||||
logger.warning(f"Server last_error_kind migration: {e}")
|
||||
conn.rollback()
|
||||
|
||||
logger.info("=" * 50)
|
||||
logger.info("✓ All migrations completed successfully")
|
||||
logger.info("=" * 50)
|
||||
|
||||
Reference in New Issue
Block a user