Bug 1393018 - Conflicting docs for python domain lookup
Summary: Conflicting docs for python domain lookup
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt-appdev-guide
Version: unspecified
Hardware: All
OS: All
unspecified
low
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-08 17:18 UTC by Landon
Modified: 2020-04-16 17:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-16 17:35:17 UTC


Attachments (Terms of Use)

Description Landon 2016-11-08 17:18:14 UTC
Description of problem:

It looks like there is some conflicting docs in pythons domain lookup documentation: 

http://libvirt.org/docs/libvirt-appdev-guide-python/en-US/html/libvirt_application_development_guide_using_python-Guest_Domains.html

vs

https://libvirt.org/python.html



Specifically, this part:

dom = conn.lookupByName(domainName)
if dom == None:
    print('Failed to get the domain object', file=sys.stderr)

vs

try:
    dom0 = conn.lookupByName("Domain-0")
except:
    print 'Failed to find the main domain'


On the version of python-libvirt that I'm using (1.2.2 on ubuntu 14.04) when conn.lookupByName cannot find the domain name, it raises a libvirt.libvirtError, with err.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN. This is also the case for lookupById() and lookupByUuid(). Assuming this wasn't behavior that was recently changed, the appdev docs should be updated to reflect this.

Comment 1 Daniel Berrangé 2020-04-16 17:35:17 UTC
Closing old bug since the appdev guide is no longer maintained.


Note You need to log in before you can comment on or make changes to this bug.