sorry I just realized that virConnectListAllNodeDevices() returns devices of host machine.

virDomainGetXMLDesc() returns full xml of the requested domain. But with this the only way to extract channel devices is to parse the entire xml document. Is there any other way like iterating devices of a domain ?

Thank You.

On Fri, Mar 27, 2015 at 12:51 PM, Neel Basu <neel.basu.z@gmail.com> wrote:
Hello,
I've added a Channel Device through virt-manager GUI. virsh dumpxml shows the device as.

<channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/ubuntusaucy.marx'/>
      <target type='virtio' name='marx'/>
      <alias name='channel2'/>
      <address type='virtio-serial' controller='0' bus='0' port='3'/>
    </channel>

I am expecting virConnectListAllNodeDevices to have the device in its output. But I don't see it there. Is it the right function to call ?

virNodeDevicePtr* devices;
int dev_count = virConnectListAllNodeDevices(conn, &devices, 0);
std::cout << "Devices: " << dev_count << std::endl;
for(virNodeDevicePtr* device = devices; device < devices+dev_count; ++device){
      std::cout << virNodeDeviceGetName(*device) << std::endl;
}

returns 66 devices but once I loop through devices I don't get any corresponding name for the channel device.

Tried using 

virConnectListAllNodeDevices(conn, &devices, VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS);

returns 0 devices.

Thanks.