hi, when creating a domain using libvirt python api, how would i tell libvirt to use a unique serial port number for domains? in the?libvirt.virConnect.defineXML(conn,domainxml) call when i create the domainxml object, i need to ensure that the part below has a unique # for target port <serial type='pty'> ? <target port='0'/> </serial> <console type='pty'> ? <target type='serial' port='0'/> </console> currently the domains running on hypervisors have target port numbers such as 1,2,3 and so on. thanks
* John Wayne schrieb:> hi, > > when creating a domain using libvirt python api, how would i tell libvirt to use a unique serial port number for domains? > in the?libvirt.virConnect.defineXML(conn,domainxml) call when i create the domainxml object, i need to ensure that the part below has a unique # for target port > > <serial type='pty'> > ? <target port='0'/> > </serial> > <console type='pty'> > ? <target type='serial' port='0'/> > </console>try: <serial type="dev"> <source path="/dev/ttyS0"/> <target port="0"/> </serial> /dev/ttyS0 of host is connected to port 0 (linux: /dev/ttyS0) of guest. try: <serial type="dev"> <source path="/dev/ttyUSB0"/> <target port="1"/> </serial> /dev/ttyUSB0 (usb -> serial adapter) is connected to port 1 (linux: /dev/ttyS1) of guest. I works like this on a server of one of my customers. Don't forget to restart libvirt-bin after changing xml file: /etc/init.d/libvirt-bin stop -> start , then start your guest. bye Ekkard
david at dit.upm.es
2012-May-10 16:56 UTC
[libvirt-users] serial console (another problem)
Hi, I also have some problems related to serial consoles. When I try to create a virtual machine (virsh create test.xml) with a serial port connected to a unix socket in the host by using: <serial type="unix"> <source mode="bind" path="/tmp/.vnx/simple_ubuntu/ubuntu_socket"/> <target port="1"/> </serial> (see the complete XML below) I get this error: error: Failed to create domain from test.xml error: internal error Process exited while reading console log output: char device redirected to /dev/pts/3 bind(unix:/tmp/.vnx/simple_ubuntu/ubuntu_socket): Permission denied chardev: opening backend "socket" failed: Permission denied (I've executed libvirt in debug mode, but I've not seen any relevant traces related to the problem) This problem arises only when I try over an Ubuntu system with libvirt installed as a package. When I try it over the same system with libvirt manually installed, it works. Latest tests have been made over a Ubuntu 12.04 system with apparmor disabled using libvirt 0.9.8 as package or manually compiled with standard configure options. But, I also made tests with other Ubuntu and libvirt versions and the result is similar. Any idea about how to solve the problem or a workaround will be highly appretiated. Best regards, David Fern?ndez Universidad Polit?cnica de Madrid Virtual Networks over linuX (VNX) http://www.dit.upm.es/vnx --------------------------------------------------------------------- test.xml file: <?xml version="1.0" encoding="UTF-8"?> <domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0"> <name>Ubuntu</name> <memory>524288</memory> <vcpu>1</vcpu> <os> <type arch="i686" machine="pc">hvm</type> <boot dev='hd'/> </os> <features> <pae/> <acpi/> <apic/> </features> <clock sync="localtime"/> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <source file='/usr/share/vnx/filesystems/rootfs_ubuntu'/> <target dev='hda'/> <driver name="qemu" type="qcow2"/> </disk> <serial type="unix"> <source mode="bind" path="/tmp/.vnx/simple_ubuntu/ubuntu_socket"/> <target port="1"/> </serial> <graphics type='vnc'/> </devices> </domain>