[one-users] How to get VM info based on Host Name from ONE Server ?

Ruben S. Montero rubensm at dacya.ucm.es
Fri Jan 16 10:10:59 PST 2009


Hi,
	There is a no direct solution for this. A hostname is VM related data, and 
ONE tries to be OS agnostic, i.e. ONE does not have any clue about the OS you 
are running and how to get the hostname from it. Note that once the VM is 
running you can log in the VM and change its hostname. There are some efforts 
by the hypervisor community to provide an interface to inspect a running VM, 
so  you can get that kind of data.

There are some workarounds that may work for you, though:

* If you know the hostname beforehand, just include it in the VM template. 
Here you have to options: (i) use the NAME attribute to be equal to the VM 
hostname, then you can just use `onevm show <hostname>`; or (ii) add a new 
attribute with the value you want to add, i.e. HOSTNAME=myhost.com, then you 
can query the DB by this new attribute. Note that this last approach is 
generic and you can tag your VMs with any attribute as they are stored in the 
Template DB.

* If you are using the ONE network manager, or DHCP, you can query the DB by 
the NIC attribute (if you can transform a hostname to a MAC or IP address).

Cheers

Ruben

On Friday 16 January 2009 15:20:20 lalithamba.vishwanathaiah at wipro.com wrote:
> Hi,
>
> My requirement is  :
>      User is giving a hostname and based on the hostname, I need to show
> the VM Info.
>
> Currently in ONE implementation, one.vmget_info returns the information,
> but it does not give the hostname.
> =-=============================================
> VID            : 7
> UID            : 0
> STATE          : PENDING
> LCM STATE      : LCM_INIT
> DEPLOY ID      :
> MEMORY         : 0
> CPU            : 0
> LAST POLL      : 0
> START TIME     : 01/15 14:04:57
> STOP TIME      : 01/01 05:30:00
> NET TX         : 0
> NET RX         : 0
> ....: Template :....
>     CPU             : 0.5
>     DISK            :
> READONLY=no,SOURCE=/home/wipro/vm-image/disk0,TARGET=sda4 DISK            :
> SIZE=1024,TARGET=sdb,TYPE=swap
>     MEMORY          : 128
>     NAME            : nodevm
>     NIC             : BRIDGE=eth0",MAC=00:03:0D:AD:D4:76
>     OS              : INITRD=/boot/initrd-2.6.2
> 5.18-0.2.xen,KERNEL=/boot/vmlinuz-2.6.25.18-0.2-xen,ROOT=sda4
> =-=============================================
>
> Is there any other way to get the details ?
>
> Thanks and Regards,
> Lalithamba.
>
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>
> www.wipro.com

-- 
+---------------------------------------------------------------+
 Dr. Ruben Santiago Montero
 Associate Professor
 Distributed System Architecture Group (http://dsa-research.org)

 URL:    http://dsa-research.org/doku.php?id=people:ruben
 Weblog: http://blog.dsa-research.org/?author=7
             
 GridWay, http://www.gridway.org
 OpenNEbula, http://www.opennebula.org
+---------------------------------------------------------------+





More information about the Users mailing list