[libvirt-users] Cannot obtain CPU freq during vbox machine creation

Michal Privoznik mprivozn at redhat.com
Fri Jun 6 09:31:26 UTC 2014


On 05.06.2014 23:00, Tomasz Kowal wrote:
> Dear libvirt experts,
> 
> I can not instantiate even a simple machine when using the 'vbox' hypervisor:
> 
> s14% virt-install --connect=vbox:///session --virt-type vbox --name vtest --memory 500
> ERROR    cannot obtain CPU freq: No such file or directory
> 
> s14% virsh -c vbox:///session
> błąd: cannot obtain CPU freq: No such file or directory
> (1)
> 
> How to fix this error? The VirtualBox driver seems to be installed:
> 
> s14% virsh -V
> Narzędzie wiersza poleceń virsh biblioteki libvirt 1.2.5
> Proszę zobaczyć stronę WWW pod adresem http://libvirt.org/
> 
> Compiled with support for:
>   Hypervisors: QEMU/KVM UML VMWare PHYP VirtualBox ESX Test
>   Networking: Remote Bridging
>   Storage: Dir SCSI
>   Miscellaneous: Daemon Secrets Debug Readline Modular
> 
> s14% uname -a
> FreeBSD s14 9.3-PRERELEASE FreeBSD 9.3-PRERELEASE #0: Fri May 16 06:45:56 CEST 2      

This is interesting. We have a code for getting this info on FreeBSD, but for some reason it's not working on your system:

src/nodeinfo.c=1041=int nodeGetInfo(virNodeInfoPtr nodeinfo)
--
src/nodeinfo.c-1083-    unsigned long cpu_freq;
src/nodeinfo.c-1084-    size_t cpu_freq_len = sizeof(cpu_freq);
src/nodeinfo.c-1085-
src/nodeinfo.c-1086-# ifdef __FreeBSD__
src/nodeinfo.c-1087-    if (sysctlbyname("dev.cpu.0.freq", &cpu_freq, &cpu_freq_len, NULL, 0) < 0) {
src/nodeinfo.c:1088:        virReportSystemError(errno, "%s", _("cannot obtain CPU freq"));
src/nodeinfo.c-1089-        return -1;
src/nodeinfo.c-1090-    }
src/nodeinfo.c-1091-
src/nodeinfo.c-1092-    nodeinfo->mhz = cpu_freq;
src/nodeinfo.c-1093-# else
src/nodeinfo.c-1094-    if (sysctlbyname("hw.cpufrequency", &cpu_freq, &cpu_freq_len, NULL, 0) < 0) {
src/nodeinfo.c:1095:        virReportSystemError(errno, "%s", _("cannot obtain CPU freq"));
src/nodeinfo.c-1096-        return -1;
src/nodeinfo.c-1097-    }
src/nodeinfo.c-1098-
src/nodeinfo.c-1099-    nodeinfo->mhz = cpu_freq / 1000000;
src/nodeinfo.c-1100-# endif

I guess the sysctlbyname() call on te line 1087 failed, but I'm not sure why. Maybe the name is version dependent?

Michal




More information about the libvirt-users mailing list