|
|
@@ -547,11 +547,17 @@ async def list_snapshots(vm_name: str):
|
|
|
# Try to get creation time from snapshot info
|
|
|
created_time = 0
|
|
|
try:
|
|
|
- # getInfo returns: (type, hypervisor, creationTime, state_flags, dom_name, parent)
|
|
|
- snap_info = snapshot.getInfo()
|
|
|
- if snap_info and len(snap_info) >= 3:
|
|
|
- created_time = snap_info[2] # creationTime is at index 2
|
|
|
- except:
|
|
|
+ # Get snapshot XML description using getXMLDesc()
|
|
|
+ snap_xml = snapshot.getXMLDesc()
|
|
|
+
|
|
|
+ # Parse XML to get creationTime
|
|
|
+ root = ET.fromstring(snap_xml)
|
|
|
+ creation_elem = root.find('.//creationTime')
|
|
|
+ if creation_elem is not None and creation_elem.text:
|
|
|
+ created_time = int(creation_elem.text)
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ print(f"[SNAPSHOT] Error obteniendo creationTime: {str(e)}")
|
|
|
created_time = 0
|
|
|
|
|
|
snapshots.append({
|