fix(images): idempotent download (skip if file exists) + real failure reason
Retrying a template build failed at download because the qcow2 from a prior attempt already existed and download-url refuses to overwrite. Now skip the download when the volume already exists (volume_exists), and surface the PVE task-log tail on download failure instead of a generic message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -119,6 +119,17 @@ class StorageMixin:
|
||||
logger.error(f"Ошибка загрузки {url} на {node}:{storage}: {e}")
|
||||
raise
|
||||
|
||||
def volume_exists(self, node: str, storage: str, volid: str) -> bool:
|
||||
"""Проверить, есть ли уже том volid в хранилище (для идемпотентной загрузки)."""
|
||||
if not self.proxmox:
|
||||
return False
|
||||
try:
|
||||
items = self.proxmox.nodes(node).storage(storage).content.get()
|
||||
return any(it.get('volid') == volid for it in (items or []))
|
||||
except Exception as e:
|
||||
logger.debug(f"volume_exists check failed {storage}/{volid}: {e}")
|
||||
return False
|
||||
|
||||
def get_download_target_storages(self, node: str, content: str) -> List[Dict]:
|
||||
"""
|
||||
Получить активные хранилища ноды, поддерживающие указанный тип контента
|
||||
|
||||
Reference in New Issue
Block a user