[libvirt-users] host to VM serial device configuration

Igor Serebryany igor47 at moomers.org
Tue Jan 18 10:13:26 UTC 2011


Hey John, 

	If I understand correctly, you are trying to get access to the
	character device after you've created the domain. The exact device
	is auto-assigned when the VM is created, but you can get the correct
	device from the domain XML after the domain is running.
	
	I use 'type=pty' in my domain definition XML. I then extract the
	device that was assigned to the domain using the following bit of
	python:

	import xml.etree.cElementTree as etree
	xml = etree.fromstring(myDomainObject.XMLDesc(0))
	tty = xml.find('devices').find('console').attrib['tty']

	Hope this helps!

--Igor




On Fri, Jan 14, 2011 at 02:35:31PM -0500, John Paul Walters wrote:
> 
> On Jan 14, 2011, at 9:44 AM, Daniel P. Berrange wrote:
> 
> >On Sat, Jan 15, 2011 at 01:09:07AM +1100, Justin Clift wrote:
> >>On 14/01/2011, at 9:39 PM, Daniel P. Berrange wrote:
> >>>On Fri, Jan 14, 2011 at 11:50:01AM +0800, Osier Yang wrote:
> >>>>于 2011年01月12日 23:11, John Paul Walters 写道:
> >>>>>Hi,
> >>>>>
> >>>>>I'm trying to get a virtual serial device up and running
> >>>>>between my host
> >>>>>and virtual machine with a device name on the host. I'm
> >>>>>using libvirt
> >>>>>0.8.3 and qemu 0.13.0. The challenge that I'm running into
> >>>>>is that I'm
> >>>>>able to get a serial device, but I cannot fix it to a pre-
> >>>>>defined device
> >>>>>name. For example, I'm using the following in my VM's xml file:
> >>>>>
> >>>>><serial type='pty'>
> >>>>><source path='/dev/pts/19' />
> >>>>><target port='0' />
> >>>>></serial>
> >>>>>
> >>>>>As I said this works, but it doesn't set the host side to
> >>>>>/dev/pts/19.
> >>>>>Is there any way to do this?
> >>>>
> >>>>I could reproduce it, trying to find out why.
> >>>
> >>>When using type='type', the source path is an output only
> >>>attribute. You can't control it yourself, it is autoassigned
> >>>by the kernel as it sees fit.
> >>
> >>Any idea if it's the kind of thing whose name could be selected
> >>or changed
> >>using udev rules?
> >
> >No, these aren't normal devices. This is a magic filesystem
> >which creates entries on the fly.
> 
> Thanks for the replies.  I'm not necessarily stuck on type='pty'.  I
> just need to be able to pin the device name or a pipe name to
> something known on the host side.  Along those lines, I've tried
> using type='pipe' like so:
> 
> <serial type='pipe'>
> 	<source path='/tmp/mypipe' />
> 	<target port='1' />
> </serial>
> 
> I've created the /tmp/mypipe.in and /tmp/mypipe.out using mkfifo per
> the qemu directions.  But I'm not sure what this is supposed to look
> like on the VM-side.  I notice that I have a ttyS1 in the VM, which
> I believe is connected to the pipe on the host side, but do I use
> this as a serial device or as a named pipe?
> 
> regards,
> JP
> 
> 
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110118/5b52c2f1/attachment.sig>


More information about the libvirt-users mailing list