On Wed, Feb 27, 2013 at 03:26:24PM +0100, Michal Privoznik wrote: > On 27.02.2013 12:20, Daniel Veillard wrote: > > I have just tagged git and pushed the tarball. The rpms for F17 > > are at the usual place too: > > ftp://libvirt.org/libvirt/ > > > > I gave a try to the set of rpms and this seems to work fine for > > relatively simple tests. > > Please give it more testing and let's keep change to git to > > bug fixes to minimize risks for 1.0.3. > > If everything goes well I will push 1.0.3 on Friday, > > > > thanks ! > > > > Daniel > > > > Maybe we want to postpone the release a bit; I was trying to find out how drop of qemu driver lock speeds up parallel startup of multiple domains, however - it is not working. > > I've created small test program - test4.c and run it against current HEAD. It takes arguments - domain names - which it spawns a separate thread per each domain and repeatedly starts and destroys domains. See code for more. > > Then, I've created 20 copies of diskless domain (attached as well): test1..test20 and run my test4 program over them: > > ./test4 $(for ((i=1; i<21; i++)); do echo -n "test$i "; done) > > I had to tweak max_client_requests=20 to really run those 20 requests in parallel. > > However, what I am getting instead of nice measuring of speedup is: > > [9722] Starting test1 (round 20) ...[9725] Starting test4 (round 20) ...[9724] Starting test3 (round 20) ...[9723] Starting test2 (round 20) ...[9726] Starting test5 (round 20) ...[9727] Starting test6 (round 20) ...[9728] Starting test7 (round 20) ...[9729] Starting test8 (round 20) ...[9730] Starting test9 (round 20) ...[9731] Starting test10 (round 20) ...[9732] Starting test11 (round 20) ...[9733] Starting test12 (round 20) ...[9734] Starting test13 (round 20) ...[9735] Starting test14 (round 20) ...[9736] Starting test15 (round 20) ...[9737] Starting test16 (round 20) ...[9738] Starting test17 (round 20) ...[9741] Starting test20 (round 20) ...[9739] Starting test18 (round 20) ...[9740] Starting test19 (round 20) ...libvir: error : An error occurred, but the cause is unknown > Unable to start domain test12libvir: error : An error occurred, but the cause is unknown > Unable to start domain test14libvir: error : An error occurred, but the cause is unknown > Unable to start domain test7libvir: error : An error occurred, but the cause is unknown > Unable to start domain test1libvir: QEMU Driver error : Requested operation is not valid: domain is not running > Unable to destroy domain test12[9733] Destroying test12 ...[9728] Destroying test7 ...[9735] Destroying test14 ...[9733] Starting test12 (round 19) ...libvir: QEMU Driver error : Requested operation is not valid: domain is not running > Unable to destroy domain test7[9728] Starting test7 (round 19) ...libvir: QEMU Driver error : Requested operation is not valid: domain is not running > Unable to destroy domain test14[9735] Starting test14 (round 19) ...libvir: error : An error occurred, but the cause is unknown > Unable to start domain test18libvir: QEMU Driver error : Requested operation is not valid: domain is not running > Unable to destroy domain test1[9722] Destroying test1 ...[9722] Starting test1 (round 19) ...libvir: error : An error occurred, but the cause is unknown > Unable to start domain test8libvir: error : An error occurred, but the cause is unknown > Unable to start domain test15[9725] Done I have my own parallel start/destroy test case that I ran during development of the threading code to test it. It caught quite a few bugs, and I had it run 8 threads for approximately 80,000 start/stops in total. I'm not seeing any errors running it with current GIT though. I've also tested your demo program with 8 threads / VMs, and it succeeeded without any problems. Appending my demo program - you don't need to do any setup to run it, it will auto-create the storage & use transient guests 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 :|
#define _GNU_SOURCE #include <libvirt/libvirt.h> #include <libvirt/virterror.h> #include <stdio.h> #include <pthread.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include <sys/syscall.h> #define NUM_THREADS 8 #define MAX_VMS 1000 const char *XML = "<domain type='kvm'>" " <name>vm%06d</name>" " <memory unit='KiB'>220160</memory>" " <currentMemory unit='KiB'>60000</currentMemory>" " <vcpu placement='static'>1</vcpu>" " <os>" " <type arch='x86_64'>hvm</type>" " <boot dev='hd'/>" " </os>" " <features>" " <acpi/>" " </features>" " <devices>" " <emulator>/bin/qemu-kvm</emulator>" " <disk type='file' device='disk'>" " <driver name='qemu' type='qcow2'/>" " <source file='/home/berrange/VirtualMachines/vm%06d.qcow'/>" " <target dev='vda' bus='virtio'/>" " <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>" " <shareable/>" " </disk>" " <console type='pty'>" " <target type='serial' port='0'/>" " </console>" " <input type='mouse' bus='ps2'/>" " <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>" " </devices>" "</domain>"; static pid_t gettid(void) { return syscall(SYS_gettid); } static void *one_thread(void *arg) { int i; virConnectPtr conn = arg; virConnectRef(conn); char *cmd; if (asprintf(&cmd, "qemu-img create -f qcow2 /home/berrange/VirtualMachines/vm%06d.qcow 1G", gettid()) < 0) abort(); if (system(cmd) != 0) abort(); char *xml; if (asprintf(&xml, XML, gettid(), gettid()) < 0) abort(); for (i = 0 ; i < MAX_VMS ; i++) { fprintf(stderr, "%d: %d of %d \n", gettid(), i, MAX_VMS); virDomainPtr dom = virDomainCreateXML(conn, xml, VIR_DOMAIN_START_AUTODESTROY); virDomainDestroy(dom); } free(xml); free(cmd); virConnectClose(conn); return NULL; } int main(int argc, char **argv) { virConnectPtr conn; int ret = -1; pthread_t threads[NUM_THREADS]; int i; if (!(conn = virConnectOpen("qemu:///session"))) goto error; for (i = 0 ; i < NUM_THREADS ; i++) { if (pthread_create(&threads[i], NULL, one_thread, conn) < 0) goto error; } for (i = 0 ; i < NUM_THREADS ; i++) { if (pthread_join(threads[i], NULL) < 0) goto error; } ret = 0; error: if (ret != 0) { virErrorPtr err = virGetLastError(); fprintf(stderr, "error: %s\n", err ? err->message : "<unknown>"); } if (conn) virConnectClose(conn); exit(ret); }
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list