[libvirt] libvirt slow responding after restart of service
by Anton Gorlov
after service libvirtd restarted has go slow responding
(virsh,virt-install and some other tools)
lsof /var/run/libvirt/libvirt-sock-ro and attach strace to this $PID
always show
futex(0x7d1f84, FUTEX_WAIT_PRIVATE, 3, NULL) = -1 EAGAIN (Resource
temporarily unavailable)
futex(0x7d1f84, FUTEX_WAIT_PRIVATE, 5, NULL <detached ...>
in starce of any threds (strace -p $PID -ff -o /opt/virtdebug.log)
gdb show only
(gdb) bt
#0 0x00007f938c1e3703 in __poll (fds=<value optimized out>, nfds=<value
optimized out>, timeout=<value optimized out>)
at ../sysdeps/unix/sysv/linux/poll.c:87
#1 0x00000000004fadd0 in virEventPollRunOnce () at util/event_poll.c:620
#2 0x00000000004f99e5 in virEventRunDefaultImpl () at util/event.c:247
#3 0x00007f938c9e76dd in virNetServerRun (srv=0x7d1e30) at
rpc/virnetserver.c:736
#4 0x0000000000423f2c in main (argc=<value optimized out>, argv=<value
optimized out>) at libvirtd.c:1609
LIBVIRT_DEFAULT_URI=qemu:///system time virsh -r list
ID Имя Статус
----------------------------------------------------
1 debian6.0 работает
0.00user 0.00system 0:28.29elapsed 0%CPU (0avgtext+0avgdata
21520maxresident)k
0inputs+0outputs (0major+1809minor)pagefaults 0swaps
and with LIBVIRT_DEBUG=1
LIBVIRT_DEBUG=1 LIBVIRT_DEFAULT_URI=qemu:///system time virsh -r list
2012-04-14 21:21:45.185+0000: 21338: info : libvirt version: 0.9.11,
package: alt3M60P1
2012-04-14 21:21:45.185+0000: 21338: debug : virInitialize:414 :
register drivers
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb22e8e0 name=Test
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering Test as driver 0
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNetworkDriver:592 : registering Test as network driver 0
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterInterfaceDriver:625 : registering Test as interface driver 0
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterStorageDriver:658 : registering Test as storage driver 0
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterDeviceMonitor:691 : registering Test as device driver 0
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterSecretDriver:724
: registering Test as secret driver 0
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNWFilterDriver:757 : registering Test as network filter driver 0
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb22fe20 name=Xen
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering Xen as driver 1
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb230de0 name=OPENVZ
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering OPENVZ as driver 2
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb231300 name=VMWARE
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering VMWARE as driver 3
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb2306c0 name=PHYP
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering PHYP as driver 4
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterStorageDriver:658 : registering PHYP as storage driver 1
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterInterfaceDriver:625 : registering PHYP as interface driver 1
2012-04-14 21:21:45.185+0000: 21338: debug : vboxRegister:137 :
VBoxCGlueInit failed, using dummy driver
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb231820 name=VBOX
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering VBOX as driver 5
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNetworkDriver:592 : registering VBOX as network driver 1
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterStorageDriver:658 : registering VBOX as storage driver 2
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb234800 name=ESX
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering ESX as driver 6
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterInterfaceDriver:625 : registering ESX as interface driver 2
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNetworkDriver:592 : registering ESX as network driver 2
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterStorageDriver:658 : registering ESX as storage driver 3
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterDeviceMonitor:691 : registering ESX as device driver 1
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterSecretDriver:724
: registering ESX as secret driver 1
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNWFilterDriver:757 : registering ESX as network filter driver 1
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:775 :
driver=0x7f16fb22f1c0 name=remote
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterDriver:799 :
registering remote as driver 7
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNetworkDriver:592 : registering remote as network driver 3
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterInterfaceDriver:625 : registering remote as interface driver 3
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterStorageDriver:658 : registering remote as storage driver 4
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterDeviceMonitor:691 : registering remote as device driver 2
2012-04-14 21:21:45.185+0000: 21338: debug : virRegisterSecretDriver:724
: registering remote as secret driver 2
2012-04-14 21:21:45.185+0000: 21338: debug :
virRegisterNWFilterDriver:757 : registering remote as network filter
driver 2
2012-04-14 21:21:45.185+0000: 21338: debug :
virEventRegisterDefaultImpl:204 : registering default event implementation
2012-04-14 21:21:45.185+0000: 21338: debug : virEventPollAddHandle:116 :
Used 0 handle slots, adding at least 10 more
2012-04-14 21:21:45.185+0000: 21338: debug :
virEventPollInterruptLocked:702 : Skip interrupt, 0 0
2012-04-14 21:21:45.185+0000: 21338: debug : virEventPollAddHandle:141 :
EVENT_POLL_ADD_HANDLE: watch=1 fd=4 events=1 cb=0x7f16fad71670 op
2012-04-14 21:21:45.185+0000: 21338: debug : virEventRegisterImpl:177 :
addHandle=0x7f16fad72260 updateHandle=0x7f16fad72130
removeHandle=imeout=0x7f16fad71c50 updateTimeout=0x7f16fad71e20
removeTimeout=0x7f16fad71f50
2012-04-14 21:21:45.185+0000: 21338: debug : virConnectOpenAuth:1455 :
name=(null), auth=0x7f16fb22e860, flags=1
2012-04-14 21:21:45.186+0000: 21339: debug : virEventRunDefaultImpl:244
: running default event implementation
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:542 : Found 0 out of 0 timeout slots used,
releasing 0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=0 w=1, f=4 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:325 : Calculate expiry of 0 timers
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:351 : Timeout at 0 due in -1 ms
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:619 :
EVENT_POLL_RUN: nhandles=1 timeout=-1
2012-04-14 21:21:45.186+0000: 21338: debug :
virConnectGetDefaultURI:1105 : Using LIBVIRT_DEFAULT_URI 'qemu:///system'
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1182 : name
"qemu:///system" to URI components:
scheme qemu
server (null)
user (null)
port 0
path /system
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 0 (Test) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 0
Test returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 1 (Xen) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 1 Xen
returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 2 (OPENVZ) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 2
OPENVZ returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 3 (VMWARE) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 3
VMWARE returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 4 (PHYP) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 4
PHYP returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 5 (VBOX) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 5
VBOX returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 6 (ESX) ...
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1232 : driver 6 ESX
returned DECLINED
2012-04-14 21:21:45.186+0000: 21338: debug : do_open:1226 : trying
driver 7 (remote) ...
2012-04-14 21:21:45.186+0000: 21338: debug : doRemoteOpen:542 :
proceeding with name = qemu:///system
2012-04-14 21:21:45.186+0000: 21338: debug : doRemoteOpen:552 :
Connecting with transport 1
2012-04-14 21:21:45.186+0000: 21338: debug : doRemoteOpen:599 :
Proceeding with sockname /var/run/libvirt/libvirt-sock-ro
2012-04-14 21:21:45.186+0000: 21338: debug : virNetSocketNew:119 :
localAddr=0x7fff75e552a0 remoteAddr=0x7fff75e55210 fd=6 errfd
2012-04-14 21:21:45.186+0000: 21338: debug : virNetSocketNew:179 :
RPC_SOCKET_NEW: sock=0x680f90 refs=1 fd=6 errfd=-1 pid=0
localAddr=127.=127.0.0.1;0
2012-04-14 21:21:45.186+0000: 21338: debug : virNetSocketRef:709 :
RPC_SOCKET_REF: sock=0x680f90 refs=2
2012-04-14 21:21:45.186+0000: 21338: debug :
virEventPollInterruptLocked:706 : Interrupting
2012-04-14 21:21:45.186+0000: 21338: debug : virEventPollAddHandle:141 :
EVENT_POLL_ADD_HANDLE: watch=2 fd=6 events=1 cb=0x7f16fae700b0
op7f16fae707f0
2012-04-14 21:21:45.186+0000: 21338: debug : virKeepAliveNew:244 :
client=0x7f16fb283010, interval=-1, count=0
2012-04-14 21:21:45.186+0000: 21338: debug : virEventPollAddTimeout:225
: Used 0 timeout slots, adding at least 10 more
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:630 :
Poll got 1 event(s)
2012-04-14 21:21:45.186+0000: 21338: debug :
virEventPollInterruptLocked:706 : Interrupting
2012-04-14 21:21:45.186+0000: 21338: debug : virEventPollAddTimeout:248
: EVENT_POLL_ADD_TIMEOUT: timer=1 frequency=-1 cb=0x7f16fae6c180
ox7f16fae6c3a0
2012-04-14 21:21:45.186+0000: 21338: debug : virKeepAliveNew:277 :
RPC_KEEPALIVE_NEW: ka=0x680870 client=0x7f16fb283010 refs=2
2012-04-14 21:21:45.186+0000: 21338: debug : virNetClientNew:324 :
RPC_CLIENT_NEW: client=0x7f16fb283010 refs=3 sock=0x680f9
2012-04-14 21:21:45.186+0000: 21338: debug : doRemoteOpen:684 : Trying
authentication
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchTimeouts:415 : Dispatch 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:460 : Dispatch 1
2012-04-14 21:21:45.186+0000: 21338: debug : virNetMessageNew:48 :
msg=0x7f16f43fb010 tracked=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:474 : i=0 w=1
2012-04-14 21:21:45.186+0000: 21338: debug :
virNetMessageEncodePayload:351 : Encode length as 28
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:488 : EVENT_POLL_DISPATCH_HANDLE: watch=1
events=1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventRunDefaultImpl:244
: running default event implementation
2012-04-14 21:21:45.186+0000: 21338: debug :
virNetClientSendInternal:1675 : RPC_CLIENT_MSG_TX_QUEUE:
client=0x7f16fb283010 len=28 prog=53=66 type=0 status=0 serial=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=0 w=1, f=4 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=1 w=2, f=6 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:325 : Calculate expiry of 1 timers
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:351 : Timeout at 0 due in -1 ms
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:619 :
EVENT_POLL_RUN: nhandles=2 timeout=-1
2012-04-14 21:21:45.186+0000: 21338: debug : virNetClientIO:1533 :
Outgoing message prog=536903814 version=1 serial=0 proc=66 type=0 lengt
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:630 :
Poll got 1 event(s)
2012-04-14 21:21:45.186+0000: 21338: debug : virNetClientIO:1591 : We
have the buck 0x6822d0 0x6822d0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchTimeouts:415 : Dispatch 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:460 : Dispatch 2
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:474 : i=0 w=1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:488 : EVENT_POLL_DISPATCH_HANDLE: watch=1
events=1
2012-04-14 21:21:45.186+0000: 21338: debug :
virEventPollUpdateHandle:151 : EVENT_POLL_UPDATE_HANDLE: watch=2 events=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:474 : i=1 w=2
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventRunDefaultImpl:244
: running default event implementation
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=0 w=1, f=4 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=1 w=2, f=6 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:325 : Calculate expiry of 1 timers
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:351 : Timeout at 0 due in -1 ms
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:619 :
EVENT_POLL_RUN: nhandles=2 timeout=-1
2012-04-14 21:21:45.186+0000: 21338: debug :
virEventPollInterruptLocked:706 : Interrupting
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:630 :
Poll got 1 event(s)
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchTimeouts:415 : Dispatch 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:460 : Dispatch 2
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:474 : i=0 w=1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollDispatchHandles:488 : EVENT_POLL_DISPATCH_HANDLE: watch=1
events=1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventRunDefaultImpl:244
: running default event implementation
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupTimeouts:506 : Cleanup 1
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCleanupHandles:554 : Cleanup 2
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=0 w=1, f=4 e=1 d=0
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollMakePollFDs:383
: Prepare n=1 w=2, f=6 e=0 d=0
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:325 : Calculate expiry of 1 timers
2012-04-14 21:21:45.186+0000: 21339: debug :
virEventPollCalculateTimeout:351 : Timeout at 0 due in -1 ms
2012-04-14 21:21:45.186+0000: 21339: debug : virEventPollRunOnce:619 :
EVENT_POLL_RUN: nhandles=1 timeout=-1
uname -a
Linux f37.local 3.3.1-std-def-alt1 #1 SMP Tue Apr 10 13:27:26 UTC 2012
x86_64 GNU/Linux
libvirtd --version
libvirtd (libvirt) 0.9.11
13 years
[libvirt] [PATCH V9 0/6] Add DHCP snooping support to nwfilter
by Stefan Berger
This series of patches adds DHCP snooping support to libvirt's
nwfilter subsystem.
DHCP snooping detects DHCP leases obtained by a VM and automatically
adjusts the network traffic filters to reflect the IP addresses
with which a VM may send its traffic, thus for example preventing
IP address spoofing.
Once leases on IP addresses expire or if a VM gives up on a
lease on an IP address, the filters are also adjusted.
All leases are persisted and automatically applied upon a VM's restart.
Leases are associated with the tuple of VM-UUID and interface MAC
address.
The following interface XML activates and uses the DHCP snooping:
<interface type='bridge'>
<source bridge='virbr0'/>
<filterref filter='clean-traffic'>
<parameter name='ip_learning' value='dhcp'/>
</filterref>
</interface>
Regards,
David and Stefan
13 years
Re: [libvirt] Start of freeze for libvirt-0.9.11 and availability of rc1
by Philipp Hahn
Hello Guido,
Am Freitag 13 April 2012 15:10:49 schrieb Guido Günther:
> könntest Du das als richtigen Patch schicken, dann apply ich das.
[Guido asks me to send a full patch, so he can apply it.]
Sure, see the attached patch.
Sincerely
Philipp
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH be open. fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
13 years
[libvirt] [PATCH] blockjob: add virsh blockjob --wait
by Eric Blake
I'm tired of shell-scripting to wait for completion of a block pull,
when virsh can be taught to do the same. I couldn't quite reuse
vshWatchJob, as this is not a case of a long-running command where
a second thread must be used to probe job status (at least, not unless
I make virsh start doing blocking waits for an event to fire), but it
served as inspiration for my simpler single-threaded loop. There is
up to a half-second delay between sending SIGINT and the job being
aborted, but I didn't think it worth the complexity of a second thread
and use of poll() just to minimize that delay.
* tools/virsh.c (cmdBlockPull): Add new options to wait for
completion.
(blockJobImpl): Add argument.
(cmdBlockJob): Adjust caller.
* tools/virsh.pod (blockjob): Document new mode.
---
tools/virsh.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++-----
tools/virsh.pod | 11 ++++-
2 files changed, 119 insertions(+), 14 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 8ef57e0..c54add9 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -7274,11 +7274,11 @@ repoll:
if (pollfd.revents & POLLIN &&
saferead(pipe_fd, &retchar, sizeof(retchar)) > 0 &&
retchar == '0') {
- if (verbose) {
- /* print [100 %] */
- print_job_progress(label, 0, 1);
- }
- break;
+ if (verbose) {
+ /* print [100 %] */
+ print_job_progress(label, 0, 1);
+ }
+ break;
}
goto cleanup;
}
@@ -7295,8 +7295,9 @@ repoll:
}
GETTIMEOFDAY(&curr);
- if ( timeout && ((int)(curr.tv_sec - start.tv_sec) * 1000 + \
- (int)(curr.tv_usec - start.tv_usec) / 1000) > timeout * 1000 ) {
+ if (timeout && (((int)(curr.tv_sec - start.tv_sec) * 1000 +
+ (int)(curr.tv_usec - start.tv_usec) / 1000) >
+ timeout * 1000)) {
/* suspend the domain when migration timeouts. */
vshDebug(ctl, VSH_ERR_DEBUG, "%s timeout", label);
if (timeout_func)
@@ -7519,7 +7520,8 @@ typedef enum {
static int
blockJobImpl(vshControl *ctl, const vshCmd *cmd,
- virDomainBlockJobInfoPtr info, int mode)
+ virDomainBlockJobInfoPtr info, int mode,
+ virDomainPtr *pdom)
{
virDomainPtr dom = NULL;
const char *name, *path;
@@ -7560,7 +7562,9 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
}
cleanup:
- if (dom)
+ if (pdom && ret == 0)
+ *pdom = dom;
+ else if (dom)
virDomainFree(dom);
return ret;
}
@@ -7580,15 +7584,109 @@ static const vshCmdOptDef opts_block_pull[] = {
{"bandwidth", VSH_OT_DATA, VSH_OFLAG_NONE, N_("Bandwidth limit in MB/s")},
{"base", VSH_OT_DATA, VSH_OFLAG_NONE,
N_("path of backing file in chain for a partial pull")},
+ {"wait", VSH_OT_BOOL, 0, N_("wait for job to finish")},
+ {"verbose", VSH_OT_BOOL, 0, N_("with --wait, display the progress")},
+ {"timeout", VSH_OT_INT, VSH_OFLAG_NONE,
+ N_("with --wait, abort if pull exceeds timeout (in seconds)")},
{NULL, 0, 0, NULL}
};
static bool
cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
{
- if (blockJobImpl(ctl, cmd, NULL, VSH_CMD_BLOCK_JOB_PULL) != 0)
+ virDomainPtr dom = NULL;
+ bool ret = false;
+ bool blocking = vshCommandOptBool(cmd, "wait");
+ bool verbose = vshCommandOptBool(cmd, "verbose");
+ int timeout = 0;
+ struct sigaction sig_action;
+ struct sigaction old_sig_action;
+ sigset_t sigmask;
+ struct timeval start;
+ struct timeval curr;
+ const char *path = NULL;
+ bool quit = false;
+
+ if (blocking) {
+ if (vshCommandOptInt(cmd, "timeout", &timeout) > 0) {
+ if (timeout < 1) {
+ vshError(ctl, "%s", _("migrate: Invalid timeout"));
+ return false;
+ }
+
+ /* Ensure that we can multiply by 1000 without overflowing. */
+ if (timeout > INT_MAX / 1000) {
+ vshError(ctl, "%s", _("migrate: Timeout is too big"));
+ return false;
+ }
+ }
+ if (vshCommandOptString(cmd, "path", &path) < 0)
+ return false;
+
+ sigemptyset(&sigmask);
+ sigaddset(&sigmask, SIGINT);
+
+ intCaught = 0;
+ sig_action.sa_sigaction = vshCatchInt;
+ sigemptyset(&sig_action.sa_mask);
+ sigaction(SIGINT, &sig_action, &old_sig_action);
+
+ GETTIMEOFDAY(&start);
+ } else if (verbose || vshCommandOptBool(cmd, "timeout")) {
+ vshError(ctl, "%s", _("blocking control options require --wait"));
return false;
- return true;
+ }
+
+ if (blockJobImpl(ctl, cmd, NULL, VSH_CMD_BLOCK_JOB_PULL,
+ blocking ? &dom : NULL) != 0)
+ goto cleanup;
+
+ while (blocking) {
+ virDomainBlockJobInfo info;
+ int result = virDomainGetBlockJobInfo(dom, path, &info, 0);
+
+ if (result < 0) {
+ vshError(ctl, _("failed to query job for disk %s"), path);
+ goto cleanup;
+ }
+ if (result == 0)
+ break;
+
+ if (verbose)
+ print_job_progress(_("Block Pull"), info.end - info.cur, info.end);
+
+ GETTIMEOFDAY(&curr);
+ if (intCaught || (timeout &&
+ (((int)(curr.tv_sec - start.tv_sec) * 1000 +
+ (int)(curr.tv_usec - start.tv_usec) / 1000) >
+ timeout * 1000))) {
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ intCaught ? "interrupted" : "timeout");
+ intCaught = 0;
+ timeout = 0;
+ quit = true;
+ if (virDomainBlockJobAbort(dom, path, 0) < 0) {
+ vshError(ctl, _("failed to abort job for disk %s"), path);
+ goto cleanup;
+ }
+ }
+
+ usleep(500 * 1000);
+ }
+
+ if (verbose && !quit) {
+ /* printf [100 %] */
+ print_job_progress(_("Block Pull"), 0, 1);
+ }
+ vshPrint(ctl, "\n%s\n", quit ? _("Pull aborted") : _("Pull complete"));
+
+ ret = true;
+cleanup:
+ if (dom)
+ virDomainFree(dom);
+ if (blocking)
+ sigaction(SIGINT, &old_sig_action, NULL);
+ return ret;
}
/*
@@ -7639,7 +7737,7 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
else
mode = VSH_CMD_BLOCK_JOB_INFO;
- ret = blockJobImpl(ctl, cmd, &info, mode);
+ ret = blockJobImpl(ctl, cmd, &info, mode, NULL);
if (ret < 0)
return false;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 5f3d9b1..fbc34f1 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -640,6 +640,7 @@ address of virtual interface (such as I<detach-interface> or
I<domif-setlink>) will accept the MAC address printed by this command.
=item B<blockpull> I<domain> I<path> [I<bandwidth>] [I<base>]
+[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>]]
Populate a disk from its backing image chain. By default, this command
flattens the entire chain; but if I<base> is specified, containing the
@@ -647,8 +648,14 @@ name of one of the backing files in the chain, then that file becomes
the new backing file and only the intermediate portion of the chain is
pulled. Once all requested data from the backing image chain has been
pulled, the disk no longer depends on that portion of the backing chain.
-It pulls data for the entire disk in the background, the process of the
-operation can be checked with B<blockjob>.
+
+By default, this command returns as soon as possible, and data for
+the entire disk is pulled in the background; the process of the
+operation can be checked with B<blockjob>. However, if I<--wait> is
+specified, then this command will block until the operation completes,
+or cancel the operation if the optional I<timeout> in seconds elapses
+or SIGINT is sent (usually with C<Ctrl-C>). Using I<--verbose> along
+with I<--wait> will produce periodic status updates.
I<path> specifies fully-qualified path of the disk; it corresponds
to a unique target name (<target dev='name'/>) or source file (<source
--
1.7.7.6
13 years
[libvirt] ANNOUNCE: Release of libvirt-sandbox version 0.0.3
by Daniel P. Berrange
I pleased to announce the a new public release of libvirt-sandbox,
version 0.0.3, is now available for download
ftp://libvirt.org/libvirt/sandbox/
The packages are GPG signed with
Key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF (4096R)
The libvirt-sandbox package provides an API layer on top of libvirt-gobject
which facilitates the cration of application sandboxes using virtualization
technology. An application sandbox is a virtual machine or container that
runs a single application binary, directly from the host OS filesystem.
In other words there is no separate guest operating system install to build
or manager.
At this point in time libvirt-sandbox can create sandboxes using either LXC
or KVM, and should in theory be extendable to any libvirt driver. The first
release is able to run simple command line based programs. This release has
focused on making the sandbox infrastructure more reliable and expanding
the functionality available. Dan Walsh has also contributed a new tool called
virt-sandbox-service which facilitates the creation of sandboxes for running
system services like apache.
- Ensure root/config filesystems are readonly in KVM
- Add support for mounting host disk images in guests
- Add support for binding guest filesystems to new locations
- Add support for an optional interactive shell for debugging
or administrative purposes
- Add a virt-sandbox-service script for preparing sandboxes
for system services, integrating with systemd
- Misc compiler warning fixes
- Replace invocation of insmod with direct syscalls
- Refactor API to separate interactive sandbox functionality
from base class & service sandbox functionality
- Rewrite host/guest I/O handling to separate stdout from
stderr correctly, improve reliability of startup/shutdown
handshakes and propagate exit status back to host
- Exec away the first hypervisor specific init process,
so generic init process get PID 1
- Turn on reboot-on-panic in KVM to ensure guest exists on
fatal problems
Some examples
$ virt-sandbox -c qemu:///session /bin/date
Thu Jan 12 22:30:03 GMT 2012
$ virt-sandbox -c qemu:///session /bin/cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 2
model name : QEMU Virtual CPU version 1.0
stepping : 3
cpu MHz : 2793.084
cache size : 4096 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good nopl
+pni cx16 hypervisor lahf_lm
bogomips : 5586.16
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
$ virt-sandbox -c lxc:/// /bin/sh
sh-4.2$ ps -axuwf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
berrange 1 0.0 0.1 167680 4688 pts/0 S+ 22:31 0:00 libvirt-sandbox-init-common
berrange 47 0.0 0.0 13852 1608 pts/1 Ss 22:31 0:00 \_ /bin/sh
berrange 48 0.0 0.0 13124 996 pts/1 R+ 22:31 0:00 \_ ps -axuwf
Feedback / patches / etc should be directed to the main libvirt
development mailing list.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
13 years, 1 month
[libvirt] [libvirt-glib] Getter/setter for disk source's startupPolicy attribute
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gconfig/libvirt-gconfig-domain-disk.c | 26 +++++++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-disk.h | 9 ++++++++
libvirt-gconfig/libvirt-gconfig.sym | 5 +++-
libvirt-gconfig/tests/test-domain-create.c | 2 +
4 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
index 5d0acb5..a29ea47 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
@@ -127,6 +127,18 @@ void gvir_config_domain_disk_set_snapshot_type(GVirConfigDomainDisk *disk,
type, NULL);
}
+void gvir_config_domain_disk_set_startup_policy(GVirConfigDomainDisk *disk,
+ GVirConfigDomainDiskStartupPolicy policy)
+{
+ const char *str;
+
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk));
+ str = gvir_config_genum_get_nick(GVIR_CONFIG_TYPE_DOMAIN_DISK_STARTUP_POLICY, policy);
+ g_return_if_fail(str != NULL);
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(disk),
+ "source", "startupPolicy", str);
+}
+
void gvir_config_domain_disk_set_source(GVirConfigDomainDisk *disk,
const char *source)
{
@@ -235,6 +247,19 @@ gvir_config_domain_disk_get_snapshot_type(GVirConfigDomainDisk *disk)
GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_NO);
}
+GVirConfigDomainDiskStartupPolicy
+gvir_config_domain_disk_get_startup_policy(GVirConfigDomainDisk *disk)
+{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk),
+ GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY);
+
+ return gvir_config_object_get_attribute_genum
+ (GVIR_CONFIG_OBJECT(disk),
+ "source", "startupPolicy",
+ GVIR_CONFIG_TYPE_DOMAIN_DISK_STARTUP_POLICY,
+ GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY);
+}
+
const char *
gvir_config_domain_disk_get_source(GVirConfigDomainDisk *disk)
{
@@ -291,6 +316,7 @@ gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk)
GVIR_CONFIG_TYPE_DOMAIN_DISK_CACHE_TYPE,
GVIR_CONFIG_DOMAIN_DISK_CACHE_DEFAULT);
}
+
GVirConfigDomainDiskBus
gvir_config_domain_disk_get_target_bus(GVirConfigDomainDisk *disk)
{
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
index 916421d..7e85d75 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
@@ -95,6 +95,12 @@ typedef enum {
GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_EXTERNAL
} GVirConfigDomainDiskSnapshotType;
+typedef enum {
+ GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY,
+ GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_REQUISITE,
+ GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_OPTIONAL
+} GVirConfigDomainDiskStartupPolicy;
+
GType gvir_config_domain_disk_get_type(void);
GVirConfigDomainDisk *gvir_config_domain_disk_new(void);
@@ -107,6 +113,8 @@ void gvir_config_domain_disk_set_guest_device_type(GVirConfigDomainDisk *disk,
GVirConfigDomainDiskGuestDeviceType type);
void gvir_config_domain_disk_set_snapshot_type(GVirConfigDomainDisk *disk,
GVirConfigDomainDiskSnapshotType type);
+void gvir_config_domain_disk_set_startup_policy(GVirConfigDomainDisk *disk,
+ GVirConfigDomainDiskStartupPolicy policy);
void gvir_config_domain_disk_set_source(GVirConfigDomainDisk *disk,
const char *source);
void gvir_config_domain_disk_set_driver_cache(GVirConfigDomainDisk *disk,
@@ -123,6 +131,7 @@ void gvir_config_domain_disk_set_target_dev(GVirConfigDomainDisk *disk,
GVirConfigDomainDiskType gvir_config_domain_disk_get_disk_type(GVirConfigDomainDisk *disk);
GVirConfigDomainDiskGuestDeviceType gvir_config_domain_disk_get_guest_device_type(GVirConfigDomainDisk *disk);
GVirConfigDomainDiskSnapshotType gvir_config_domain_disk_get_snapshot_type(GVirConfigDomainDisk *disk);
+GVirConfigDomainDiskStartupPolicy gvir_config_domain_disk_get_startup_policy(GVirConfigDomainDisk *disk);
const char *gvir_config_domain_disk_get_source(GVirConfigDomainDisk *disk);
GVirConfigDomainDiskCacheType gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk);
const char *gvir_config_domain_disk_get_driver_name(GVirConfigDomainDisk *disk);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 2378a3c..8dac83a 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -1,4 +1,4 @@
-LIBVIRT_GCONFIG_0.0.7 {
+LIBVIRT_GCONFIG_0.0.8 {
global:
gvir_config_init_check;
gvir_config_init;
@@ -76,6 +76,7 @@ LIBVIRT_GCONFIG_0.0.7 {
gvir_config_domain_disk_cache_type_get_type;
gvir_config_domain_disk_guest_device_type_get_type;
gvir_config_domain_disk_snapshot_type_get_type;
+ gvir_config_domain_disk_startup_policy_get_type;
gvir_config_domain_disk_type_get_type;
gvir_config_domain_disk_new;
gvir_config_domain_disk_new_from_xml;
@@ -91,6 +92,8 @@ LIBVIRT_GCONFIG_0.0.7 {
gvir_config_domain_disk_set_snapshot_type;
gvir_config_domain_disk_get_source;
gvir_config_domain_disk_set_source;
+ gvir_config_domain_disk_get_startup_policy;
+ gvir_config_domain_disk_set_startup_policy;
gvir_config_domain_disk_get_target_bus;
gvir_config_domain_disk_set_target_bus;
gvir_config_domain_disk_get_target_dev;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 4ee33aa..3d7efdc 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -106,6 +106,7 @@ int main(int argc, char **argv)
gvir_config_domain_disk_set_type(disk, GVIR_CONFIG_DOMAIN_DISK_FILE);
gvir_config_domain_disk_set_guest_device_type(disk, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK);
gvir_config_domain_disk_set_source(disk, "/tmp/foo/bar");
+ gvir_config_domain_disk_set_startup_policy (disk, GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_REQUISITE);
gvir_config_domain_disk_set_driver_name(disk, "foo");
gvir_config_domain_disk_set_driver_type(disk, "bar");
gvir_config_domain_disk_set_driver_name(disk, "qemu");
@@ -117,6 +118,7 @@ int main(int argc, char **argv)
g_assert(gvir_config_domain_disk_get_disk_type(disk) == GVIR_CONFIG_DOMAIN_DISK_FILE);
g_assert(gvir_config_domain_disk_get_guest_device_type(disk) == GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK);
+ g_assert(gvir_config_domain_disk_get_startup_policy (disk) == GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_REQUISITE);
g_str_const_check(gvir_config_domain_disk_get_source(disk), "/tmp/foo/bar");
g_assert(gvir_config_domain_disk_get_driver_cache(disk) == GVIR_CONFIG_DOMAIN_DISK_CACHE_NONE);
g_str_const_check(gvir_config_domain_disk_get_driver_name(disk), "qemu");
--
1.7.7.6
13 years, 1 month
[libvirt] [test-API PATCH 1/2] casecfgcheck: ignore flags defined in testcase flag
by Guannan Ren
When flag defined in testcase config file like as follows
the casecfgcheck still trys to use flag 'clean' or 'sleep' as
the key to get required_params, optional_params variables.
so it reports 'KeyError' becuase no testcases named 'clean'
or 'sleep' in case_params data format. The patch ignore
the check for these flags.
domain:start
guestname
fedora16
clean
domain:shutdown
guestname
fedora16
sleep 6
domain:destroy
guestname
fedora16
---
casecfgcheck.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/casecfgcheck.py b/casecfgcheck.py
index a88eb74..40d7c6e 100644
--- a/casecfgcheck.py
+++ b/casecfgcheck.py
@@ -33,14 +33,18 @@ class CaseCfgCheck(object):
error_flag = 0
passed_testcase = []
for testcase in self.activity:
- case_number += 1
if testcase in passed_testcase:
continue
testcase_name = testcase.keys()[0]
- actual_params = testcase.values()[0]
+ if testcase_name == 'clean' or \
+ testcase_name == 'sleep':
+ continue
+ actual_params = testcase.values()[0]
required_params, optional_params = self.case_params[testcase_name]
+
+ case_number += 1
ret = self._check_params(required_params, optional_params, actual_params)
if ret:
error_flag = 1
--
1.7.7.5
13 years, 1 month
[libvirt] [test-API PATCH] repo: Add test for console input and output operations
by Peter Krempa
This test checks if the console input and output work as desired. The
test takes as an argument a filename, whose contents are sent to the
console. The optional parameter 'expect' can be set to a filename that
should contain expected output from the guest and is compared with the
actual output. The optional parameter 'output' can be set to a filename
where the test script saves the output of the host (useful for initial
test setup).
This test requires that the guest machine runs code that handles input and
output on the serial console (programs such as agetty or something like that).
---
repos/domain/console_io.py | 123 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 123 insertions(+), 0 deletions(-)
create mode 100644 repos/domain/console_io.py
diff --git a/repos/domain/console_io.py b/repos/domain/console_io.py
new file mode 100644
index 0000000..98fd5b6
--- /dev/null
+++ b/repos/domain/console_io.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+# test console interactions
+# This test sends contents of file 'input' to the guest's console
+# and reads from the console the reply and compares it to 'expect' or
+# writes the output to file 'output'
+
+import libvirt
+import signal
+import os
+
+from libvirt import libvirtError
+from exception import TestError
+
+required_params = ('guestname',)
+optional_params = ('device', 'timeout', 'input', 'output', 'expect',)
+
+def alarm_handler(signum, frame):
+ raise TestError("Timed out while waiting for console")
+
+def console_io(params):
+ """Attach to console"""
+ logger = params['logger']
+ guest = params['guestname']
+ device = params.get('device', 'serial0')
+ infile = params.get('input', None)
+ outfile = params.get('output', None)
+ expect = params.get('expect', None)
+ timeout = params.get('timeout', 5)
+
+ uri = params['uri']
+
+ #store the old signal handler
+ oldhandler = signal.getsignal(signal.SIGALRM)
+
+ try:
+ logger.info("Connecting to hypervisor: '%s'" % uri)
+ conn = libvirt.open(uri)
+ dom = conn.lookupByName(guest)
+ if not dom.isActive():
+ raise TestError("Guest '%s' not active" % guest)
+
+ logger.info("Creating stream object")
+ stream = conn.newStream(0)
+
+ logger.info("Open a new console connection")
+ dom.openConsole(device, stream, libvirt.VIR_DOMAIN_CONSOLE_FORCE)
+
+ if infile != None:
+ try:
+ f = open(infile, 'r')
+ instr = f.read()
+ f.close()
+ except e:
+ raise TestError("Can't read input file '%s': %s" % (infile, str(e)))
+
+ logger.info("Sending %d bytes of contents of file '%s' to console '%s'" % (len(instr), infile, device))
+ stream.send(instr)
+
+ if expect != None or outfile != None:
+ logger.info("Recieving data from console device. Timeout %d seconds." % timeout)
+
+ # register a new signal handler
+ logger.info("Registering custom SIGALRM handler")
+ signal.signal(signal.SIGALRM, alarm_handler)
+ signal.alarm(timeout)
+
+ reply = ""
+ try:
+ while True:
+ recv = stream.recv(1024)
+ reply += recv
+ except TestError:
+ pass
+
+ logger.info("Recieved %d bytes." % len(reply))
+
+ if outfile != None:
+ try:
+ f = open(outfile, 'w')
+ f.write(reply)
+ f.close()
+ except e:
+ raise TestError("Can't write output to file '%s': %s" % (outfile, str(e)))
+
+ if expect != None:
+ try:
+ f = open(expect, 'r')
+ expectstr = f.read()
+ f.close()
+ except Exception, e:
+ raise TestError("Can't read expected output file '%s': '%s'" % (expect, str(e)))
+
+ if reply.startswith(expectstr):
+ logger.info("Recieved expected output from the host")
+ else:
+ raise TestError("Reply from the guest doesn't match with expected reply")
+
+ except libvirtError, e:
+ logger.error("Libvirt call failed: " + str(e))
+ ret = 1
+
+ except TestError, e:
+ logger.error("Test failed: " + str(e))
+ ret = 1
+
+ else:
+ logger.info("All tests succeeded")
+ ret = 0
+
+ finally:
+ logger.info("Restoring signal handler")
+ signal.signal(signal.SIGALRM, oldhandler)
+ logger.info("Closing hypervisor connection")
+ try:
+ stream.abort()
+ except:
+ pass
+ conn.close()
+
+ logger.info("Done")
+
+ return ret
+
--
1.7.3.4
13 years, 1 month
[libvirt] [test-API PATCH 0/4]Add feature to check case file before running
by Guannan Ren
The set of patches add a new feature to examine testcase config file
before running it. The framework will do the job on behalf of testcase,
so test writer will release from the work.
Usage:
In testcase, it only needs to define two global tuple variables
required_params are the mandatory options to the testcase
optional_params are the optional options
...
required_params = ('networkname', 'autostart')
optional_params = ('optparams1', 'optparas2')
def testcase(params):
...
Checking results:
on success, it will run these testcases defined in testcase config file
on error-detected, error as follows
Unknown parameter 'whoami'
the No.2 : domain:testb
Parameter autostart is required
the No.5 : domain:testa
The idea and part of code in patches is from Osier:)
13 years, 1 month
[libvirt] Start of freeze for libvirt-0.9.11 and availability of rc1
by Daniel Veillard
As scheduled, we are entering the freeze for 0.9.11.
I think most API additions are now commited to git upstream (please
raise your voice quickly if you see something missing !)
I have made a release candidate 1 tarball (and associated rpms) at
ftp://libvirt.org/libvirt/libvirt-0.9.11-rc1.tar.gz
and the git tree is tagged.
I think I will make an release candidate 2 tarball on Wednesday, and
I'm hoping for a final release on Friday, or maybe Monday if there are
issues found.
Please give it a try ! Stability and portability feedback are really
welcome as we didn't had a release in Feb and the risk of having
something messed up is slightly higher than usual !
thanks in advance,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 1 month