[libvirt-users] getting name or uuid of vm within guest OS

Hi, for tl;dr people: how we can get uuid or name of a vm within a guest os? description: We are trying to implement a guest-agent for Archipel* to let us run simple commands on guest os**. in archipel each vm has its own jid (jabber id), user will open a chat conversation to vm's jid and send messages like "!exec ls", then we check that user (jid) who sent !exec has permission to run commands on our guest. if he/she had permission we will send a message to jid of guest-agent with message "ls", guest-agent will run command then will send result to vm's jid and we tunnel result to user. now problem is that we don't know (in guest-agent) that what xmpp server we should connect to and what jid is trusted to recieve command from. xmpp server is running on hypervisor and trusted jid is {uuid-of-jvm}@hypervisor.com. right now we've used internal dhcp to set hostname of guest os to something like "uuid-of-jvm.hypervisor.com" using this switch (qemu): -net user,hostname=uuid-of-jvm.hypervisor.com it works but it's not best solution as it only works with qemu and we need a solution that works with other virtualization platforms that libvirt supports. * https://github.com/ArchipelProject/ ** yes, we know about vnc / ssh / ... but by implementing such thing we can add cool stuff in archipel like status of services that are running on guest os. -- regards, behrooz

On Wed, Jun 20, 2012 at 01:15:12PM +0430, Behrooz wrote:
Hi,
for tl;dr people: how we can get uuid or name of a vm within a guest os?
The name is not exposed, but you can see the guest UUID in the SMBIOS data. (see dmidecode command output) Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

thanks daniel, it solves having user part of jid (*uuid*@hypervisor.com), but do you have any idea for domain part (uuid@*hypervisor.com*)? On Wed, Jun 20, 2012 at 3:50 PM, Daniel P. Berrange <berrange@redhat.com>wrote:
On Wed, Jun 20, 2012 at 01:15:12PM +0430, Behrooz wrote:
Hi,
for tl;dr people: how we can get uuid or name of a vm within a guest os?
The name is not exposed, but you can see the guest UUID in the SMBIOS data. (see dmidecode command output)
Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/:| |: http://libvirt.org -o- http://virt-manager.org:| |: http://autobuild.org -o- http://search.cpan.org/~danberr/:| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc:|
-- regards, behrooz

On Thu, Jun 21, 2012 at 09:49:28AM +0430, Behrooz wrote:
thanks daniel,
it solves having user part of jid (*uuid*@hypervisor.com), but do you have any idea for domain part (uuid@*hypervisor.com*)?
Not really, but UUIDs are intended to be globally unique, so adding in 'hypervisor.com' doesn't improve uniqueness, and would in fact be potentially wrong since the guest can be migrated across hosts at any time without ever knowing Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Behrooz
-
Daniel P. Berrange