libvirt python console

Michal Privoznik mprivozn at redhat.com
Tue Apr 14 12:41:53 UTC 2020


On 4/12/20 7:18 PM, PunkGeek wrote:
> Hello,
> I see this example about VM console serial, Which I could connect to the 
> guest VM successfully.
> however, I could not understand how to send commands to the guest VM?
> https://github.com/libvirt/libvirt-python/blob/master/examples/consolecallback.py
> Best regards

The example is basically what 'virsh console' does. This simply opens 
serial console to virtual machine. But then you need to enable agetty 
for the serial console. In systemd distributions it's sufficient to 
append 'console=ttyS0' to kernel cmd line and systemd should do the rest 
automagically.

Michal




More information about the libvir-list mailing list