grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a ce×igã @s|z ddlZWnfeyrZzNz ddlZWn4ey\ZzdeeƒvrHe‚WYdZ[n dZ[00WYdZ[n dZ[00ddlZddlmZm Z m Z m Z m Z ej ejeeeee eefedœdd„Zej eddœdd „Zdej ejee ej ejeeeeejgdfejeed œd d „Zgdfejee eeee e fd œdd„Zdd„Zdd„Zdd„ZdZdZdZdZdZdZdZdZdZ dS)éNzNo module named)ÚAnyÚCallableÚDictÚListÚIO)ÚconnÚdomÚeventÚsecondsÚmicrosÚdetailsÚcbDataÚreturnc Cs2|d}|d}||tj||d�|||||ƒdS)zBDispatches events to python user qemu monitor event callbacks ÚcbÚopaque©Z_objr)ÚlibvirtÚ virDomain) rrr r r r r rr©rú2/usr/lib64/python3.9/site-packages/libvirt_qemu.pyÚ!_dispatchQemuMonitorEventCallbacksr)rÚ callbackIDrcCsDz,t |j|¡}|dkr"t d¡‚|j|=Wnty>Yn0dS)ztRemoves a qemu monitor event callback. De-registering for a callback will disable delivery of this event typeéÿÿÿÿz3virConnectDomainQemuMonitorEventDeregister() failedN)Úlibvirtmod_qemuZ*virConnectDomainQemuMonitorEventDeregisterÚ_orÚ libvirtErrorÚqemuMonitorEventCallbackIDÚAttributeError)rrÚretrrrÚqemuMonitorEventDeregister's   r)rrr rrÚflagsrcCspt|dƒsi|_|||dœ}|dur:t |jd|||¡}nt |j|j|||¡}|dkrbt d¡‚||j|<|S)zpAdds a qemu monitor event callback. Registering for a monitor callback will enable delivery of the eventsr)rrrNrz1virConnectDomainQemuMonitorEventRegister() failed)ÚhasattrrrZ(virConnectDomainQemuMonitorEventRegisterrrr)rrr rrr r rrrrÚqemuMonitorEventRegister3s    r")ÚdomainÚcmdÚfilesr rcCs(t |j|||¡}|dur$t d¡‚|S)atThis API is QEMU specific, so it will only work with hypervisor connections to the QEMU driver with local connections using the unix socket. Send an arbitrary monitor command @cmd with file descriptors @files to domain through the QEMU monitor and optionally return a list of files in the returned tuple. There are several requirements to safely and successfully use this API: - A @cmd that queries state without making any modifications is safe - A @cmd that alters state that is also tracked by libvirt is unsafe, and may cause libvirtd to crash - A @cmd that alters state not tracked by the current version of libvirt is possible as a means to test new qemu features before they have support in libvirt, but no guarantees are made to safety If VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP is set, the command is considered to be a human monitor command and libvirt will automatically convert it into QMP if needed. In that case the @result will also be converted back from QMP. Returns a tuple consisting of the string output from @cmd and a list of files respectively.Nz-virDomainQemuMonitorCommandWithFiles() failed)rZ$virDomainQemuMonitorCommandWithFilesrrr)r#r$r%r rrrrÚqemuMonitorCommandWithFilesBs r&cCs(t |j|||¡}|dur$t d¡‚|S)z%Send a Guest Agent command to domain Nz"virDomainQemuAgentCommand() failed)rZvirDomainQemuAgentCommandrrr)r#r$Útimeoutr rrrrÚqemuAgentCommandhs r(cCs4t |j||¡}|dur"t d¡‚tj||d�}|S)aThis API is QEMU specific, so it will only work with hypervisor connections to the QEMU driver. This API will attach to an externally launched QEMU process identified by @pid. There are several requirements to successfully attach to an external QEMU process: - It must have been started with a monitor socket using the UNIX domain socket protocol. - No device hotplug/unplug, or other configuration changes can have been made via the monitor since it started. - The '-name' and '-uuid' arguments should have been set (not mandatory, but strongly recommended) To date, the only platforms we know of where pid_t is larger than unsigned int (64-bit Windows) also lack UNIX sockets, so the choice of @pid_value as an unsigned int should not present any difficulties. If successful, then the guest will appear in the list of running domains for this connection, and other APIs should operate normally (provided the above requirements were honored). NzvirDomainQemuAttach() failedr)rZvirDomainQemuAttachrrrr)rZ pid_valuer rZ__tmprrrÚ qemuAttachos  r)cCs&t |j||¡}|dur"t d¡‚|S)zASend an arbitrary monitor command through qemu monitor of domain Nz$virDomainQemuMonitorCommand() failed)rZvirDomainQemuMonitorCommandrrr)r#r$r rrrrÚqemuMonitorCommand‹s r*éééþÿÿÿré<)r)!rÚ ImportErrorZlib_eZcygvirtmod_qemuZcyg_eÚstrrÚtypingrrrrrZ virConnectrÚintrrZ_Tr"r&r(r)r*Z4VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEXZ5VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASEZ#VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCKZ!VIR_DOMAIN_QEMU_AGENT_COMMAND_MINZ%VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULTZ$VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAITZ&VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWNZ'VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAULTZ#VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMPrrrrÚ s2   0(  >*&