[...]we'd need to know what XML string
you are passing to attach-device
<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
<device>
<disk device="cdrom" type="file">
<source file="/tmp/foo.iso"/>
<target dev="hdc"/>
<readonly/>
</disk>
</device>
If I run it without the first line, I get an "unexptected error".
and you might also want to run things
through valgrind to see if we really are smashing the heap in your
particular case.
I'm new to valgrind so hopefully this output is helpfull for you:
==2735== Memcheck, a memory error detector
==2735== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2735== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==2735== Command: virsh
==2735==
==2735== Conditional jump or move depends on uninitialised value(s)
==2735== at 0x5E8D27B: __GI___strcasecmp_l (strcmp.S:243)
==2735== by 0x5E2CE2C: __gconv_open (gconv_open.c:70)
==2735== by 0x5E39EB6: _nl_find_msg (dcigettext.c:990)
==2735== by 0x5E3A673: __dcigettext (dcigettext.c:654)
==2735== by 0x42FA32: main (virsh.c:19291)
==2735==
==2735== Use of uninitialised value of size 8
==2735== at 0x5E8F3B4: __GI___strcasecmp_l (strcmp.S:2257)
==2735== by 0x5E2CE2C: __gconv_open (gconv_open.c:70)
==2735== by 0x5E39EB6: _nl_find_msg (dcigettext.c:990)
==2735== by 0x5E3A673: __dcigettext (dcigettext.c:654)
==2735== by 0x42FA32: main (virsh.c:19291)
==2735==
==2735== Use of uninitialised value of size 8
==2735== at 0x5E8F3B8: __GI___strcasecmp_l (strcmp.S:2258)
==2735== by 0x5E2CE2C: __gconv_open (gconv_open.c:70)
==2735== by 0x5E39EB6: _nl_find_msg (dcigettext.c:990)
==2735== by 0x5E3A673: __dcigettext (dcigettext.c:654)
==2735== by 0x42FA32: main (virsh.c:19291)
==2735==
[...]
virsh # attach-device dos /tmp/bla.xml
Fehler: Fehler beim Anhängen des Geräts von /tmp/bla.xml
Fehler: zu wenig Arbeitsspeicher
[...]
==2735==
==2735== HEAP SUMMARY:
==2735== in use at exit: 191,210 bytes in 1,495 blocks
==2735== total heap usage: 3,907 allocs, 2,412 frees, 1,390,037 bytes allocated
==2735==
==2735== LEAK SUMMARY:
==2735== definitely lost: 60 bytes in 1 blocks
==2735== indirectly lost: 240 bytes in 10 blocks
==2735== possibly lost: 701 bytes in 26 blocks
==2735== still reachable: 190,209 bytes in 1,458 blocks
==2735== suppressed: 0 bytes in 0 blocks
[...]
==2735== ERROR SUMMARY: 6 errors from 3 contexts (suppressed: 73 from 7)
Also I used gdb to see where the virAlloc() which fails is called:
Breakpoint 1, virAlloc (ptrptr=0x7fffffffd960, size=776) at util/memory.c:93
93 {
(gdb) bt
#0 virAlloc (ptrptr=0x7fffffffd960, size=776) at util/memory.c:93
#1 0x00007ffff7b37d73 in vboxDomainAttachDeviceImpl (dom=0x6bcc80,
xml=0x6c8f50 "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"no\"?>\n<device>\n<disk device=\"cdrom\"
type=\"file\">\n<source file=\"/tmp/foo.iso\"/>\n<target
dev=\"hdc\"/>\n<readonly/>\n</disk>\n</device>\n",
mediaChangeOnly=<optimized out>) at vbox/vbox_tmpl.c:5339
#2 0x00007ffff7a5dc10 in virDomainAttachDevice (domain=0x6bcc80,
xml=0x6c8f50 "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"no\"?>\n<device>\n<disk device=\"cdrom\"
type=\"file\">\n<source file=\"/tmp/foo.iso\"/>\n<target
dev=\"hdc\"/>\n<readonly/>\n</disk>\n</device>\n") at
libvirt.c:9172
#3 0x000000000041aea5 in cmdAttachDevice (ctl=0x7fffffffdd20, cmd=0x6c8c50) at
virsh.c:13144
#4 0x00000000004118e5 in vshCommandRun (ctl=0x7fffffffdd20, cmd=0x6c8c50) at
virsh.c:17710
#5 0x000000000042f9a8 in main (argc=<optimized out>, argv=<optimized out>) at
virsh.c:19315
(gdb) n
101 *(void **)ptrptr = calloc(1, size);
(gdb) n
103 return -1;
I'm using the current version from git (5452e88).
Hope the informations are useful this time.
Thanks in advance !
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro!
https://freundschaftswerbung.gmx.de