[libvirt] list vsock cids allocated to VMs?

Other than dumping and parsing the config for all running VMs, is there a way to get the current map of vsock cids allocated to their VM domains? Thanks, Brian

On Tue, Jan 29, 2019 at 10:07:16AM -0600, Brian Kroth wrote:
Other than dumping and parsing the config for all running VMs, is there a way to get the current map of vsock cids allocated to their VM domains?
What you describe is the only supported approach from libvirt's POV. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

OK, I was expecting it to maintain a list internally (at least for the things it knows about) so that the auto property in the domxml can work nicely, but I suppose it would still need to fallback to letting the kernel reject an already taken cid number anyways (eg: due to a manually executed qemu outside of libvirt), so either way the list would not be authoritative. Thanks, Brian On Wed, Jan 30, 2019, 08:36 Daniel P. Berrangé <berrange@redhat.com> wrote:
On Tue, Jan 29, 2019 at 10:07:16AM -0600, Brian Kroth wrote:
Other than dumping and parsing the config for all running VMs, is there a way to get the current map of vsock cids allocated to their VM domains?
What you describe is the only supported approach from libvirt's POV.
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Wed, Jan 30, 2019 at 11:25:25AM -0600, Brian Kroth wrote:
OK, I was expecting it to maintain a list internally (at least for the things it knows about) so that the auto property in the domxml can work nicely, but I suppose it would still need to fallback to letting the kernel reject an already taken cid number anyways (eg: due to a manually executed qemu outside of libvirt), so either way the list would not be authoritative.
No libvirt doesn't keep any list. When allocating one automatically it just iterates over IDs, trying to acquire exclusive access to one from the kernel until it succeeds. IOW the kernel has the authoritative list Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Brian Kroth
-
Daniel P. Berrangé