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 etc. Unfortunately, I caught this after freeze. Michal
#define _GNU_SOURCE #include <sys/syscall.h> #include <sys/types.h> #include <libvirt/libvirt.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> virDomainPtr *doms = NULL; int doms_size = 0; int rep = 20; int quit = 0; void * eventLoop(void *opaque) { while (!quit) { if (virEventRunDefaultImpl() < 0) fprintf(stderr, "unable to run eventloop"); } return NULL; } void * thread(void *opaque) { int i = (int) opaque; int repLocal = rep; virDomainPtr dom = doms[i]; const char *domname = virDomainGetName(dom); pid_t tid = syscall(SYS_gettid); for (; repLocal; repLocal--) { printf("[%lu] Starting %s (round %d) ...", (unsigned long) tid, domname, repLocal); fflush(stdout); if (virDomainCreate(dom) < 0) { fprintf(stderr, "Unable to start domain %s", domname); } else { printf("[%lu] Done\n", (unsigned long) tid); } //sleep(20); sleep(1); printf("[%lu] Destroying %s ...", (unsigned long) tid, domname); if (virDomainDestroy(dom) < 0) { fprintf(stderr, "Unable to destroy domain %s", domname); } else { printf("[%lu] Done\n", (unsigned long) tid); } } cleanup: return NULL; } int main(int argc, char *argv[]) { virConnectPtr conn = virConnectOpen("qemu:///system"); pthread_t *thr = NULL; pthread_t eventLoopTh; int i; if (!conn) return EXIT_FAILURE; virEventRegisterDefaultImpl(); i = 1; while (argv[i]) { virDomainPtr dom = virDomainLookupByName(conn, argv[i]); if (!dom) { fprintf(stderr, "no such domain %s\n", argv[i]); return -1; } if (!(doms = realloc(doms, (doms_size + 1) * sizeof(virDomainPtr)))) { perror("unable to alloc mem"); return -1; } doms[doms_size] = dom; doms_size++; i++; } if (i == 1) { fprintf(stderr, "Usage: %s <list of domains>\n", argv[0]); return -1; } if (pthread_create(&eventLoopTh, NULL, eventLoop, NULL) < 0) { perror("unable to create eventloop thread"); return -1; } if (!(thr = malloc(doms_size * sizeof(pthread_t)))) { perror("unable to alloc mem"); return -1; } for (i = 0; i < doms_size; i++) { if (pthread_create(&(thr[i]), NULL, thread, i) < 0) { perror("unable to create thread"); return -1; } } for (i = 0; i < doms_size; i++) { if (pthread_join(thr[i], NULL) < 0) { perror("unable to join thread"); return -1; } virDomainFree(doms[i]); } quit = 1; virEventAddTimeout(0, NULL, NULL, NULL); if (pthread_join(eventLoopTh, NULL) < 0) { perror("unable to join eventloop thread"); return -1; } virConnectClose(conn); return 0; }
<domain type='kvm'> <name>test20</name> <memory unit='MiB'>128</memory> <vcpu placement='static'>1</vcpu> <os> <type arch='x86_64' machine='pc'>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/qemu-kvm</emulator> <interface type='direct'> <mac address='52:54:00:44:da:04'/> <source dev='eth0' mode='vepa'/> <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> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </memballoon> </devices> </domain>
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list