[libvirt-users] libvirtError: this function is not supported by the connection driver: virInterfaceDefineXML
by Sijo Jose
Hi,
Could anyone help I'm getting the following error when I tried to add a new
network interface.
DETAILS
Connection
---------------------------
import libvirt
conn = libvirt.open('qemu:///system')
Interface XML
----------------------
<interface type="bridge" name="br0">
<start mode="onboot"/>
<mtu size="1500"/>
<protocol family="ipv4">
<dhcp/>
</protocol>
<bridge stp="off" delay="0.01">
<interface type="ethernet" name="eth0">
<mac address="ab:bb:cc:dd:ee:ff"/>
</interface>
<interface type="ethernet" name="eth1"/>
</bridge>
</interface>
In [96]:
conn.interfaceDefineXML(interfacexml,0)
---------------------------------------------------------------------------libvirtError
Traceback (most recent call
last)/home/saju/<ipython-input-96-0536ffe3fa23> in <module>()----> 1
conn.interfaceDefineXML(br1xml,0)
/usr/lib/python2.7/dist-packages/libvirt.pyc in
interfaceDefineXML(self, xml, flags) 2750 libvirtd. """
2751 ret = libvirtmod.virInterfaceDefineXML(self._o, xml,
flags)-> 2752 if ret is None:raise
libvirtError('virInterfaceDefineXML() failed', conn=self) 2753
__tmp = virInterface(self, _obj=ret) 2754 return __tmp
libvirtError: this function is not supported by the connection driver:
virInterfaceDefineXML
Regards
Sijo Jose
10 years, 8 months
[libvirt-users] PCI Passthrough of 2 identical devices
by Thomas Jagoditsch
hi,
i have a small trouble with pci-passthrough.
i have a working configuration passing a tv card into the guest, all is fine and dandy.
as soon as i add my second identical card into the host i cant start the guest anymore, whether i add the second card to the guest or not. error message is identical in both cases.
message of virt-manager|virsh|libvirtd.log:
> libvirtError: internal error: Unable to reset PCI device 0000:03:00.0: internal error: Active 0000:03:01.0 devices on bus with 0000:03:00.0, not doing bus reset
the host is a plain kvm server, no services or apps whatsoever accessing the two devices.
the other guests (firewall and fileserver) do not use the cards either.
if i (soft) remove the 2nd card via
> echo -n 1 > /sys/bus/pci/devices/0000\:03\:01.0/remove
i can start the guest with the 1st card assigned.
thx for anyone looking into this.
wbr,tja..
PS:
host:
> root@father:~# lspci
> 00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
> 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
> 00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
> 00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
> 00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-V (rev 05)
> 00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)
> 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
> 00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d5)
> 00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)
> 00:1f.0 ISA bridge: Intel Corporation H87 Express LPC Controller (rev 05)
> 00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)
> 00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
> 02:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03)
> 03:00.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
> 03:01.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
> root@father:~# cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=13.10
> DISTRIB_CODENAME=saucy
> DISTRIB_DESCRIPTION="Ubuntu 13.10"
> root@father:~# uname -a
> Linux father 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> root@father:~# libvirtd --version
> libvirtd (libvirt) 1.1.1
guest:
> root@father:~# cat /etc/libvirt/qemu/tvBackend.xml
> <!--
> WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
> OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
> virsh edit tvBackend
> or other application using the libvirt API.
> -->
>
> <domain type='kvm'>
> <name>tvBackend</name>
> <uuid>f647bb10-7f9a-f94c-33b9-3d99e8e753e0</uuid>
> <memory unit='KiB'>1048576</memory>
> <currentMemory unit='KiB'>1048576</currentMemory>
> <vcpu placement='static'>2</vcpu>
> <os>
> <type arch='x86_64' machine='pc-i440fx-1.5'>hvm</type>
> <boot dev='hd'/>
> </os>
> <features>
> <acpi/>
> <apic/>
> <pae/>
> </features>
> <clock offset='utc'/>
> <on_poweroff>destroy</on_poweroff>
> <on_reboot>restart</on_reboot>
> <on_crash>restart</on_crash>
> <devices>
> <emulator>/usr/bin/kvm-spice</emulator>
> <disk type='file' device='disk'>
> <driver name='qemu' type='raw'/>
> <source file='/kvm/tvBackend.img'/>
> <target dev='vda' bus='virtio'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
> </disk>
> <disk type='block' device='cdrom'>
> <driver name='qemu' type='raw'/>
> <target dev='hdc' bus='ide'/>
> <readonly/>
> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
> </disk>
> <controller type='usb' index='0'>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
> </controller>
> <controller type='pci' index='0' model='pci-root'/>
> <controller type='ide' index='0'>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
> </controller>
> <interface type='bridge'>
> <mac address='52:54:00:10:26:ec'/>
> <source bridge='brlan'/>
> <model type='virtio'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
> </interface>
> <serial type='pty'>
> <target port='0'/>
> </serial>
> <console type='pty'>
> <target type='serial' port='0'/>
> </console>
> <input type='mouse' bus='ps2'/>
> <graphics type='vnc' port='-1' autoport='yes'/>
> <video>
> <model type='vga' vram='9216' heads='1'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
> </video>
> <hostdev mode='subsystem' type='pci' managed='yes'>
> <source>
> <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
> </source>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
> </hostdev>
> <memballoon model='virtio'>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
> </memballoon>
> </devices>
> </domain>
--
thomas jagoditsch - tjaSoft
softWareEntwicklung - netzWerkManagement
10 years, 8 months
[libvirt-users] Fail to install libvirt
by Du Jun
Hi all,
I am trying to install libvirt from source code(I have some version of
libvirt installed before and I intend to overwrite it), my workflow is
shown below,
#!/bin/sh
apt-get install gnutls-bin libgnutls-dev -y
apt-get install libxml++2.6-2 libxml++2.6-dev -y
apt-get install libdevmapper-dev -y
apt-get install libpciaccess-dev -y
apt-get install python-dev -y
apt-get install libnl-dev -y
if [ ! -f ./libvirt-1.1.1 ]; then
wget http://libvirt.org/sources/libvirt-1.1.1.tar.gz
fi
tar -xzvf ./libvirt-1.1.1.tar.gz
cd ./libvirt-1.1.1
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
make
make install
I have no trouble in configure, make, and make install. However, after make
installfinishing, when I type virsh --version, I get the following error
message:
virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_PRIVATE_1.1.1' not
found (required by virsh)
I wonder what's wrong with that? Please help, thanks!
--
Best Regards,
Frank
10 years, 8 months
[libvirt-users] error:libvirt can not be used with os services
by 铁甲流浪狗
hello,please help me,thanks.
i download libvirt1.1.3.4 tarball opensouce,and use following commands to build&compile it.
./configure
make
make install
ldconfig
And i check the system output,all sucessed,but when i execute "service libvirtd status",i receive an error.
openstack:/data/安装介质/libvirt-1.1.3.4 # libvirtd --version
libvirtd (libvirt) 1.1.3.4
openstack:/data/安装介质/libvirt-1.1.3.4 # libvirtd -d
openstack:/etc/rc.d # service libvirtd status
service: no such service libvirtd
10 years, 8 months
[libvirt-users] Questions on using bridge for KVM on ubuntu 13.10
by Peng Yu
Hi,
I have being try to connect a virtual machine to the outside through a
bridge on the host.
The following shows that I have a bridge. And I'm able to start a guest.
pengy@rigel:~$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.c81f66e29049 no em4
br1 8000.c81f66e29045 no bond0
virbr0 8000.000000000000 yes
pengy@rigel:/mnt/nfs/pengy/kvm$ virsh create saiph_installed.xml
Domain saiph created from saiph_installed.xml
pengy@rigel:/mnt/nfs/pengy/kvm$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.c81f66e29049 no em4
vnet0
br1 8000.c81f66e29045 no bond0
virbr0 8000.000000000000 yes
I assigned the static ip address (given my our network administrator)
to the guest. But I am not able to connect anywhere outside from the
guest (175.91.244.74). Do you know what might cause the problem? How
to connect the outside network from the guest? Thanks.
pengy@rigel:/mnt/nfs/pengy/kvm$ ssh 175.91.244.74
pengy(a)175.91.244.74's password:
Welcome to Ubuntu 13.10 (GNU/Linux 3.11.0-12-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Tue Mar 11 14:04:07 CDT 2014
System load: 0.0 Processes: 76
Usage of /: 78.0% of 999MB Users logged in: 0
Memory usage: 1% IP address for eth0: 175.91.244.74
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
0 packages can be updated.
0 updates are security updates.
Last login: Tue Mar 11 14:04:07 2014
pengy@saiph:~$ ping www.google.com
^C
pengy@saiph:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:aa:00:f0:51
inet addr:175.91.244.74 Bcast:175.91.247.255 Mask:255.255.248.0
inet6 addr: fe80::5054:aaff:fe00:f051/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6720 errors:0 dropped:24 overruns:0 frame:0
TX packets:213 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:513702 (513.7 KB) TX bytes:20976 (20.9 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
BTW, I'm albe to follow some of the instructions at
http://wiki.libvirt.org/page/Networking#Debian.2FUbuntu_Bridging
But it is not clear to what the followings are for.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
*** Sample rc.local file ***
/sbin/sysctl -p /etc/sysctl.conf
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS
--clamp-mss-to-pmtu
exit 0
To verify that the changes have taken affect, please run
tail /proc/sys/net/bridge/*
iptables -L FORWARD
--
Regards,
Peng
10 years, 8 months
[libvirt-users] kernel panic when using root from virtfs
by Vasiliy Tolstov
I have strange kernel panic
Kernel 3.13.3 vanilla
root is mounted via 9p virtfs (readonly).
virsh --version
1.2.1
qemu --version
QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
systemd version 210
Domain config:
<domain type='kvm'>
<name>build</name>
<uuid>328891df-b3c3-aee9-eb5d-00007e7934f7</uuid>
<memory unit='MiB'>512</memory>
<currentMemory unit='MiB'>512</currentMemory>
<vcpu placement='static'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<boot dev='hd'/>
<kernel>/boot/vmlinuz-3.13.3</kernel>
<initrd>/boot/initrd-3.13.3</initrd>
<cmdline>ro root=virtfs:root console=tty0 console=ttyS0,115200n8 </cmdline>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<filesystem type='mount' accessmode='squash'>
<driver type='path' wrpolicy='immediate'/>
<source dir='/home/vtolstov/devel/vtolstov/lb/fs/x86_64'/>
<target dir='root'/>
<readonly/>
</filesystem>
<filesystem type='mount' accessmode='squash'>
<driver type='path' wrpolicy='immediate'/>
<source dir='/home/vtolstov/devel/vtolstov/lb/fs/var/log'/>
<target dir='var/log'/>
</filesystem>
<filesystem type='mount' accessmode='squash'>
<driver type='path' wrpolicy='immediate'/>
<source dir='/home/vtolstov/devel/vtolstov/lb/fs/var/cache/paludis'/>
<target dir='var/cache/paludis'/>
</filesystem>
<filesystem type='mount' accessmode='squash'>
<driver type='path' wrpolicy='immediate'/>
<source dir='/home/vtolstov/devel/vtolstov/lb/fs/var/db/paludis'/>
<target dir='var/db/paludis'/>
</filesystem>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci0'/>
</controller>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
</controller>
<interface type='network'>
<mac address='52:54:00:00:02:4c'/>
<source network='mighost'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/8'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/8'>
<source path='/dev/pts/8'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/build.agent'/>
<target type='virtio' name='org.mighost.agent.0'/>
<alias name='channel1'/>
<address type='virtio-serial' controller='0' bus='0' port='2'/>
</channel>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5905' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='vga' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
</memballoon>
</devices>
<seclabel type='none'/>
</domain>
Sometimes i get error like:
[ OK ] Reached target Initrd File Systems.
Starting dracut mount hook...
[ 14.326081] FDC 0 is a S82078B
[ 14.644148] PANIC: double fault, error_code: 0x0
[ 14.640174] PANIC: double fault, error_code: 0x0
[ 14.640174] CPU: 0 PID: 130 Comm: systemd-udevd Not tainted 3.13.3 #2
[ 14.640174] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 14.640174] task: ffff88001faf0000 ti: ffff88001faee000 task.ti:
ffff88001faee000
[ 14.640174] RIP: 0010:[<ffffffff81109df8>] [<ffffffff81109df8>]
file_read_actor+0x58/0x160
[ 14.640174] RSP: 0018:ffff88001faefd60 EFLAGS: 00010206
[ 14.640174] RAX: 0000000000000000 RBX: ffff88001faefe10 RCX: 000000000000100f
[ 14.640174] RDX: 0000000000000000 RSI: ffffea000070ebc0 RDI: 00007f94d60b3037
[ 14.640174] RBP: ffff88001faefd90 R08: 0000000000000002 R09: ffffea000070ebdc
[ 14.640174] R10: 0000000000000023 R11: 0000000000000000 R12: 0000000000001000
[ 14.640174] R13: 000000000001f000 R14: ffff88001f9d5e00 R15: 0000000000001000
[ 14.640174] FS: 00007f94d60dc7c0(0000) GS:ffff88001f400000(0000)
knlGS:0000000000000000
[ 14.640174] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 14.640174] CR2: 0000000000000000 CR3: 000000001fad9000 CR4: 00000000000006f0
[ 14.640174] Stack:
[ 14.640174] ffff88001faefd70 ffff88001e025280 0000000000000021
0000000000001000
[ 14.640174] ffff88001f9d5e00 ffffea000070ebc0 ffff88001faefe58
ffffffff8110a1ca
[ 14.640174] ffff88001f9d5e10 ffff88001faefe90 ffff88001faefea0
0000000000000000
[ 14.640174] Call Trace:
[ 14.640174] [<ffffffff8110a1ca>] generic_file_aio_read+0x2ca/0x700
[ 14.640174] [<ffffffff811a11f6>] blkdev_aio_read+0x46/0x70
[ 14.640174] [<ffffffff8116c355>] do_sync_read+0x55/0x90
[ 14.640174] [<ffffffff8116c9e0>] vfs_read+0x90/0x160
[ 14.640174] [<ffffffff8116d4e4>] SyS_read+0x44/0xa0
[ 14.640174] [<ffffffff816ab07d>] system_call_fastpath+0x1a/0x1f
[ 14.640174] Code: 38 31 c0 66 66 90 c6 01 00 66 66 90 85 c0 0f 85
bf 00 00 00 49 63 fc 48 8d 7c 39 ff 48 31 f9 48 f7 c1 00 f0 ff ff 74
11 66 66 90 <c6> 07 00 66 66 90 85 c0 0f 85 c6 00 00 00 65 ff 04 25 e0
c7 00
[ 14.640174] Kernel panic - not syncing: Machine halted.
[ 14.644148] CPU: 1 PID: 126 Comm: systemd-udevd Not tainted 3.13.3 #2
[ 14.644148] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 14.644148] task: ffff88001fa42f80 ti: ffff88001fa84000 task.ti:
ffff88001fa84000
[ 14.644148] RIP: 0010:[<ffffffff81109df8>] [<ffffffff81109df8>]
file_read_actor+0x58/0x160
[ 14.644148] RSP: 0018:ffff88001fa85d60 EFLAGS: 00010206
[ 14.644148] RAX: 0000000000000000 RBX: ffff88001fa85e10 RCX: 000000000000100f
[ 14.644148] RDX: 0000000000000000 RSI: ffffea0000708340 RDI: 00007f94d60cb037
[ 14.644148] RBP: ffff88001fa85d90 R08: 0000000000000002 R09: ffffea000070835c
[ 14.644148] R10: 000000000000003b R11: 0000000000000001 R12: 0000000000001000
[ 14.644148] R13: 0000000000007000 R14: ffff88001f9d3900 R15: 0000000000001000
[ 14.640174] Shutting down cpus with NMI
[ 14.644148] FS: 00007f94d60dc7c0(0000) GS:ffff88001f500000(0000)
knlGS:0000000000000000
[ 14.644148] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 14.644148] CR2: 0000000000000000 CR3: 000000001fa67000 CR4: 00000000000006e0
[ 14.644148] Stack:
[ 14.644148] ffff88001fa85d70 ffff88001e2522c0 0000000000000039
0000000000001000
[ 14.644148] ffff88001f9d3900 ffffea0000708340 ffff88001fa85e58
ffffffff8110a1ca
[ 14.644148] ffff88001f9d3910 ffff88001fa85e90 ffff88001fa85ea0
0000000000000000
[ 14.644148] Call Trace:
[ 14.644148] [<ffffffff8110a1ca>] generic_file_aio_read+0x2ca/0x700
[ 14.644148] [<ffffffff811a11f6>] blkdev_aio_read+0x46/0x70
[ 14.644148] [<ffffffff8116c355>] do_sync_read+0x55/0x90
[ 14.644148] [<ffffffff8116c9e0>] vfs_read+0x90/0x160
[ 14.644148] [<ffffffff8116d4e4>] SyS_read+0x44/0xa0
[ 14.644148] [<ffffffff816ab07d>] system_call_fastpath+0x1a/0x1f
[ 14.644148] Code: 38 31 c0 66 66 90 c6 01 00 66 66 90 85 c0 0f 85
bf 00 00 00 49 63 fc 48 8d 7c 39 ff 48 31 f9 48 f7 c1 00 f0 ff ff 74
11 66 66 90 <c6> 07 00 66 66 90 85 c0 0f 85 c6 00 00 00 65 ff 04 25 e0
c7 00
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
jabber: vase(a)selfip.ru
10 years, 8 months
Re: [libvirt-users] cgroup for VM - does it work properly?
by Martin Pavlásek
On Thu 06 Mar 2014 20:16:45 CET, Martin Pavlásek wrote:
> On 06/03/14 10:35, Daniel P. Berrange wrote:
>> On Thu, Mar 06, 2014 at 12:32:28AM +0100, Martin Pavlásek wrote:
>>> Hi
>>>
>>> I tried to restrict usage of some running VM by cpu.shares (i.e. set to
>>> 10 from original 1024) on loaded system and it seem doesn't work as I
>>> expected... all running processes has same CPU usage (by htop) :-/
>>> Does anyone has same experience?
>> The cpu.shares variable doesn't provide absolute restriction on
>> CPU usage, rather it is doing relative prioritization.
>>
>> eg if you have 2 cgroups that are at the same level in the hierarchy
>> and you give one shares=512 and one shared=1024, then the latter VM
>> will get twice the CPU scheduler time of the former. If the latter
>> VM is completely idle though, the former VM will not be capped in any
>> way.
>>
>> If you want absolute caps then you need to use period/quota settings.
>> Also you want todo this via the virsh schedinfo command, not accessing
>> cgroups directly.
>>
>> Regards,
>> Daniel
> Thanks Daniel for reply, nice example!
> In my case I've got quite weird results
>
> guest: dd if=/dev/zero of=/dev/null for simulating heavy load
> host: dd if=... same as guest (to make host also loaded)
>
> host: htop for watching CPU usage (host has only one core), qemu (one
> VM, two threads) + dd (host) = 99% usage that is correct, as expected
> host: virsh schedinfo --set cpu_shares=10 <domain-ID>
> ...but whole load is still distributed equally - still ~30% for each.
>
> All processes are under itself default cgroup, so / for host dd and each
> VM in their own (something like /machine/<domain-name>). I didn't change
> any cgroup directly in this case.
> After that qemu processes should shoconsume significantly less cpu than
> others, isn't it (change "relative priority" from 1024 to 10)?
> Limiting by period or quota works, but I would be really happy to use
> just cpu.shares - I don't want to write own process scheduler, weights
> of cpu sharing is sufficient for me.
>
> Do you have idea why this behaviour happen?
> Regards
>
I just find out what was wrong... :-) cpu.shares is applied only to
process in same cgroup, so all common processes belong to / (cgroup
root), all VMs under /machine/. So dd running on host belongs to /, but
when I set cpu.shares of any VM, it wouldn't apply as I expected,
because these processes are exists in different cgroups.
PS: I'm sorry Danied for answer only to you, I've mismatched Reply and
Reply to all...
--
--
Martin Pavlásek <mpavlase(a)redhat.com>
OpenStack QA Associate/Red Hat Czech/BRQ
irc: mpavlase
10 years, 8 months
[libvirt-users] Fwd: How to get guest's cpu and mem usage with Java APIs
by Enrico De Maio
I would like to know how much memory and cpu virtual machine are using so
yes guest's perspective. I'm building a web app that has to alert the user
when the vm is going to be stressed and I would like to do this in terms of
mem and cpu usage.
Thanks in advance for your support,
Enrico De Maio
On Mon, Mar 10, 2014 at 7:16 PM, Eric Blake <eblake(a)redhat.com> wrote:
> On 03/10/2014 04:54 AM, Enrico De Maio wrote:
> > Hi everybody,
> >
> > I'm using libvirt java api bindings for my thesis. I would like to know
> if
> > there is a way to obtain live information about cpu and mem usage of a
> > domain.
>
> Are you asking the question from the host's perspective (how much
> resources has the host given to the guest) or from the guest's
> perspective (how much is the guest actively using, even if the host has
> given it more)? Libvirt already provides several API calls. such as the
> ones used by 'virsh cpu-stats' and 'virsh dommemstat'; you may have to
> do some code reading to figure out what C calls the virsh code made in
> order to find the same API under the Java bindings.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
10 years, 8 months