cat > /tmp/cd_diag.py <<'PYEOF'
import vsphere_datastore_files as dsf
from vsphere_vm_manager import find_vm_by_name
from pyVmomi import vim
VM = "dcn03srv043_EMPTYTEST"
vm = find_vm_by_name(VM)
print("VM:", vm.name, "| power:", vm.runtime.powerState)
host = vm.runtime.host
print("HOST:", host.name)
dsnames = [d.name for d in host.datastore]
print("HOST datastores:", dsnames)
print("ISO_DATASTORE =", dsf.ISO_DATASTORE, "| смонтирован на хосте VM:", dsf.ISO_DATASTORE in dsnames)
for d in vm.config.hardware.device:
if isinstance(d, vim.vm.device.VirtualCdrom):
b, c = d.backing, d.connectable
print("CDROM key=%s ctrlKey=%s backing=%s file=%r connected=%s startConnected=%s" % (
d.key, d.controllerKey, type(b).__name__, getattr(b,"fileName",None),
getattr(c,"connected",None), getattr(c,"startConnected",None)))
PYEOF