[one-users] retrieve info from OpenVZ host running libvirtd

knawnd at gmail.com knawnd at gmail.com
Fri Feb 18 08:27:12 PST 2011

Dear all,

Trying to implement IM driver for OpenVZ cluster nodes I faced with the 
following problem:

$ onehost list
   ID NAME                           CLUSTER  RVM   TCPU   FCPU   ACPU 
    2 <cluster_node1>         xen_x64           0       200      200 
     200       3.1G     128M    on
    3 <cluster_node2>         ovz_x32           0            0 
  0       100           0K          0K     err

Fri Feb 18 18:54:47 2011 [InM][D]: Host 3 successfully monitored.
Fri Feb 18 18:54:47 2011 [ONE][E]: syntax error, unexpected $end, 
expecting VARIABLE at line 2, columns 1:2
Fri Feb 18 18:54:47 2011 [InM][E]: Error parsing host information:

I added oneadmin user into /etc/sudoers file and commented out the line 
"Defaults    requiretty":
$ egrep "oneadmin|requiretty" /etc/sudoers
#Defaults    requiretty
oneadmin        ALL=(ALL)       NOPASSWD: ALL

(I couldn't figure out more secure and elegant way to get info from 
OpenVZ host having libvirt interface installed. Any suggestions on that?)

and did the following changes in ovz.rb file:
$ diff /usr/lib/one/remotes/im/ovz.d/ovz.rb 
< nodeinfo_text = `sudo virsh -c openvz:///system nodeinfo`
 > nodeinfo_text = `virsh -c qemu:///system nodeinfo`
< print_info("HYPERVISOR","ovz")
 > print_info("HYPERVISOR","kvm")

"sudo virsh -c openvz:///system nodeinfo" running under oneadmin user 
from front-end node gives the following output:
[oneadmin@<ONE_front-end>$ ssh <OVZ_cluster_node> sudo virsh -c 
openvz:///system nodeinfo
CPU model:           i686
CPU(s):              1
CPU frequency:       2793 MHz
CPU socket(s):       1
Core(s) per socket:  1
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         2056216 kB

I was hoping to apply the same solution as written in "KVM Driver Guide 
2.0" (http://opennebula.org/documentation:rel2.0:kvmg) since ONE uses 
the libvirt interface as well to interact with KVM hosts:
...The following steps are required in the cluster nodes to get the KVM 
driver running:
     *      The user with access to these remotes hosts on behalf of 
OpenNebula (typically <oneadmin>) has to pertain to the <libvirtd> and 
<kvm> groups in order to use the deaemon and be able to launch VMs.

but I can't following that way since there is no libvirt group and 
libvirtd is run under root (I had to build libvirt from tarball 
available at its home page since CentOS has a pretty old one in its 
repos without openvz support).

Any help on that is highly appreciated!

More information about the Users mailing list