18 lines
980 B
Python
18 lines
980 B
Python
import os, paramiko
|
|
host="192.168.0.104"; user="root"; pw=os.environ["XEN_PW"]
|
|
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host, username=user, password=pw, timeout=20,
|
|
disabled_algorithms={'pubkeys': ['rsa-sha2-256','rsa-sha2-512']},
|
|
look_for_keys=False, allow_agent=False)
|
|
def run(cmd):
|
|
i,o,e=c.exec_command(cmd,timeout=120); return (o.read().decode(errors="replace")+e.read().decode(errors="replace")).strip()
|
|
g_vdi="828ea0ff-04c7-4f7c-9e4d-baa9e15d72bd" # G: = "2003 Disk 2" xvdb
|
|
print("=== snapshotting G: VDI for consistent export ===")
|
|
snap=run(f'xe vdi-snapshot uuid={g_vdi}')
|
|
print("snapshot VDI uuid:", snap)
|
|
print("=== snapshot details ===")
|
|
print(run(f"xe vdi-param-list uuid={snap} | grep -iE 'uuid \\(|name-label|virtual-size|is-a-snapshot|sr-name-label'"))
|
|
print("=== dom0 free space (confirm we must stream, not stage locally) ===")
|
|
print(run("df -h / /var/tmp 2>/dev/null | head"))
|
|
c.close()
|