def _list_instance_domains(self, only_running=True, only_guests=True):
    'Get a list of libvirt.Domain objects for nova instances\n\n        :param only_running: True to only return running instances\n        :param only_guests: True to filter out any host domain (eg Dom-0)\n\n        Query libvirt to a get a list of all libvirt.Domain objects\n        that correspond to nova instances. If the only_running parameter\n        is true this list will only include active domains, otherwise\n        inactive domains will be included too. If the only_guests parameter\n        is true the list will have any "host" domain (aka Xen Domain-0)\n        filtered out.\n\n        :returns: list of libvirt.Domain objects\n        '
    if (not self._skip_list_all_domains):
        try:
            alldoms = self._list_instance_domains_fast(only_running)
        except (libvirt.libvirtError, AttributeError) as ex:
            LOG.info(_LI('Unable to use bulk domain list APIs, falling back to slow code path: %(ex)s'), {'ex': ex})
            self._skip_list_all_domains = True
    if self._skip_list_all_domains:
        alldoms = self._list_instance_domains_slow(only_running)
    doms = []
    for dom in alldoms:
        if (only_guests and (dom.ID() == 0)):
            continue
        doms.append(dom)
    return doms
Get a list of libvirt.Domain objects for nova instances

:param only_running: True to only return running instances
:param only_guests: True to filter out any host domain (eg Dom-0)

Query libvirt to a get a list of all libvirt.Domain objects
that correspond to nova instances. If the only_running parameter
is true this list will only include active domains, otherwise
inactive domains will be included too. If the only_guests parameter
is true the list will have any "host" domain (aka Xen Domain-0)
filtered out.

:returns: list of libvirt.Domain objects
def _list_instance_domains(self, only_running=True, only_guests=True):
    'Get a list of libvirt.Domain objects for nova instances\n\n        :param only_running: True to only return running instances\n        :param only_guests: True to filter out any host domain (eg Dom-0)\n\n        Query libvirt to a get a list of all libvirt.Domain objects\n        that correspond to nova instances. If the only_running parameter\n        is true this list will only include active domains, otherwise\n        inactive domains will be included too. If the only_guests parameter\n        is true the list will have any "host" domain (aka Xen Domain-0)\n        filtered out.\n\n        :returns: list of libvirt.Domain objects\n        '
    if (not self._skip_list_all_domains):
        try:
            alldoms = self._list_instance_domains_fast(only_running)
        except (libvirt.libvirtError, AttributeError) as ex:
            LOG.info(_LI('Unable to use bulk domain list APIs, falling back to slow code path: %(ex)s'), {'ex': ex})
            self._skip_list_all_domains = True
    if self._skip_list_all_domains:
        alldoms = self._list_instance_domains_slow(only_running)
    doms = []
    for dom in alldoms:
        if (only_guests and (dom.ID() == 0)):
            continue
        doms.append(dom)
    return doms