Ask Your Question
0

Is it possible to find hypervisor type of VM/instance belongs to?

asked 2014-06-08 09:52:54 -0500

manish gravatar image

While running nova show instance-id it list extended attribute like host name, host-id. etc. is there api to find out hypervisor type which instance belongs to. for ex: instance-00000007 spawned on vCenter or KVM.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-06-08 10:05:43 -0500

dbaxps gravatar image

updated 2014-06-08 11:53:20 -0500

I understand that it's not a direct answer regarding API call. However, code bellow
may be placed in 4-5 lines shell script

   [root@icehouse1 ~(keystone_admin)]# nova show UbuntuSRV01 | grep instance_name
       | OS-EXT-SRV-ATTR:instance_name        | instance-0000002f                                               |
   [root@icehouse1 ~(keystone_admin)]# nova show UbuntuSRV01 | grep hypervisor_hostname
       | OS-EXT-SRV-ATTR:hypervisor_hostname  | icehouse2.localdomain                                           |
  [root@icehouse1 ~(keystone_admin)]# nova hypervisor-show  icehouse2.localdomain | grep  hypervisor_type
     | hypervisor_type           | QEMU

[root@icehouse1 ~(keystone_admin)]# cat hyper.sh
#!/bin/bash -x
V=`nova show $1 | grep hypervisor_hostname | awk '{print $4}'`
W=`nova hypervisor-show $V |grep  hypervisor_type | awk '{print $4}'`
echo $W
[root@icehouse1 ~(keystone_admin)]# ./hyper.sh UbuntuSRV01
++ nova show UbuntuSRV01
++ awk '{print $4}'
++ grep hypervisor_hostname
+ V=icehouse2.localdomain
++ nova hypervisor-show icehouse2.localdomain
++ awk '{print $4}'
++ grep hypervisor_type
+ W=QEMU
+ echo QEMU
QEMU
edit flag offensive delete link more

Comments

Actually, instance_name is not needed for this query, but might be usefull to dig into details like:-

[root@icehouse1 ~(keystone_admin)]# ssh icehouse2.localdomain
Last login: Sun Jun  8 19:09:59 2014 from 192.168.1.127
[root@icehouse2 ~]# ps -ef | grep instance-0000002f
qemu      2799     1 10 09:04 ?        01:05:29 /usr/bin/qemu-system-x86_64 -machine accel=kvm -name instance-0000002f -S -machine pc-i440fx-1.6,accel=kvm,usb=off -cpu Penryn,+osxsave,+xsave,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 263f58ae-2ceb-4681-b61c-d3dd4745a853 -smbios type=1,manufacturer=Fedora Project,product=OpenStack Nova,version=2014.1-2.fc21,serial=6050001e-8c00-00ac-818a-90e6ba2d11eb,uuid=263f58ae-2ceb-4681-b61c-d3dd4745a853 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-0000002f.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy ...
(more)
dbaxps gravatar imagedbaxps ( 2014-06-08 10:30:05 -0500 )edit

Thanks for your input . Actually this i have also thought through but what i am looking for if there is any api call which i can use.

another issue if we use the above mentioned approach i would need admin priviledge else this extented attributes like OS-EXT-STS, OS-EXT-SRV-ATTR:hypervisor_hostname will come blank

manish gravatar imagemanish ( 2014-06-08 22:36:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-06-08 09:52:54 -0500

Seen: 1,201 times

Last updated: Jun 08 '14