
[snip]
I was thinking of something like: domain.get_attribute("vncdisplay")
Because it's a shame to have to use virsh as a wrapper (or XML file parsing) and re-do all the work that was done to get to the domain object when all your really want is just an attribute..
You can already do that very simply in python using lxml
from lxml import etree tree = etree.parse(domain.XMLDesc()) r = tree.xpath('/domain/devices/graphics[@type='vnc']/@port')
Hmmm, cant seem to get that to work: libvirt_server_util.py", line 159, in detect_session_vncdisplay tree = etree.parse(domain.XMLDesc(0)) File "lxml.etree.pyx", line 2692, in lxml.etree.parse (src/lxml/lxml.etree.c:49594) File "parser.pxi", line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71364) File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:71647) File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:70742) File "parser.pxi", line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:67740) File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824) File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745) File "parser.pxi", line 563, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64060) IOError: Error reading file '<domain type='qemu' id='1'> <name>Test</name> <uuid>bd4aa2fa-a086-e8b2-8bc5-1de3fc591958</uuid> ... </domain> ': failed to load external entity "<domain type='qemu' id='1'> <name>Test</name> ... </domain> "