Bug#773286: qemu-kvm: attemt to attach block device fails Bus 'pci.0' does not support hotplugging

2014-12-16 Thread John Hughes
Well, it looks like the command has half worked -- lsof shows me that 
kvm has opened the block device I tried to add.


Now how to make it give it up?

# lsof /dev/md/cedric\:new
COMMAND   PID USER   FD   TYPE DEVICE  SIZE/OFFNODE NAME
kvm 28159 libvirt-qemu   28u   BLK  9,124 0x3a3797b 4608551 
/dev/md/../md124



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#773286: qemu-kvm: attemt to attach block device fails Bus 'pci.0' does not support hotplugging

2014-12-16 Thread John Hughes
Package: qemu-kvm
Version: 1.1.2+dfsg-6+deb7u6
Severity: normal

Dear Maintainer,

   * What led up to the situation?

Tried to add a new disk to a running kvm guest

   * What exactly did you do (or not do) that was effective (or
 ineffective)?

Using the virsh attach-device command I tried to add a new disk

   * What was the outcome of this action?

# virsh attach-device cedric.CalvaEDI.COM zz.xml 
error: Failed to attach device from zz.xml
error: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' 
does not support hotplugging

   * What outcome did you expect instead?

Happiness.

The running vm looks like:

/usr/bin/kvm -S -M pc-1.1 -enable-kvm -m 8192 -smp 
1,sockets=1,cores=1,threads=1 -name cedric.CalvaEDI.COM -uuid 
99cfca83-cf28-ce9b-86a4-947debc202b5 -nographic -no-user-config -nodefaults 
-chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/cedric.CalvaEDI.COM.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown 
-no-acpi -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/dev/disk/by-id/md-name-cedric:root,if=none,id=drive-virtio-disk0,format=raw,cache=none
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
 -drive 
file=/dev/disk/by-id/md-name-belgic:archive,if=none,id=drive-virtio-disk1,format=raw
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1
 -drive 
file=/dev/disk/by-id/md-name-belgic:backups,if=none,id=drive-virtio-disk2,format=raw
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,id=vir!
 tio-disk2 -netdev tap,fd=20,id=hostnet0,vhost=on,vhostfd=21 -device 
virtio-net-pci,netdev=hostnet0,id=net0,mac=00:16:3e:65:2d:8e,bus=pci.0,addr=0x3 
-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7

Or, in libvirt xml format:


  cedric.CalvaEDI.COM
  99cfca83-cf28-ce9b-86a4-947debc202b5
  8388608
  4194304
  1
  
hvm

  
  
  destroy
  restart
  restart
  
/usr/bin/kvm

  
  
  
  
  


  
  
  
  
  


  
  
  
  
  


  
  


  
  
  
  
  
  


  
  
  


  
  
  


  
  

  
  


The device I tried to add looks like:


  
  
  


The error in libvirtd.log is:
2014-12-16 13:22:50.831+: 5305: error : qemuMonitorJSONCheckError:342 : 
internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does 
not support hotplugging
2014-12-16 13:22:50.832+: 5305: warning : qemuDomainAttachPciDiskDevice:255 
: qemuMonitorAddDevice failed on 
file=/dev/disk/by-id/md-name-cedric:new,if=none,id=drive-virtio-disk3,format=raw,cache=none
 
(virtio-blk-pci,scsi=off,bus=pci.0,addr=0xb,drive=drive-virtio-disk3,id=virtio-disk3)

>From strace it seems that the commands that are being sent to kvm are:

5302  write(21, 
"{\"execute\":\"drive_add\",\"arguments\":{\"pci_addr\":\"dummy\",\"opts\":\"file=/dev/disk/by-id/md-name-cedric:new,if=none,id=drive-virtio-disk3,format=raw,cache=none\"},\"id\":\"libvirt-31\"}\r\n",
 177) = 177

which gets

5302  read(21, "{\"id\": \"libvirt-31\", \"error\": {\"class\": 
\"CommandNotFound\", \"desc\": \"The command drive_add has not been found\", 
\"data\": {\"name\": \"drive_add\"}}}\r\n", 1023) = 144

So it tries

5302  write(21, 
"{\"execute\":\"human-monitor-command\",\"arguments\":{\"command-line\":\"drive_add
 dummy 
file=/dev/disk/by-id/md-name-cedric:new,if=none,id=drive-virtio-disk3,format=raw,cache=none\"},\"id\":\"libvirt-32\"}\r\n",
 194) = 194

reply: 

5302  read(21, "{\"return\": \"Duplicate ID 'drive-virtio-disk3' for 
drive\\r\\n\", \"id\": \"libvirt-32\"}\r\n", 1023) = 83

Then:

5302  write(21, 
"{\"execute\":\"device_add\",\"arguments\":{\"driver\":\"virtio-blk-pci\",\"scsi\":\"off\",\"bus\":\"pci.0\",\"addr\":\"0xd\",\"drive\":\"drive-virtio-disk3\",\"id\":\"virtio-disk3\"},\"id\":\"libvirt-33\"}\r\n",
 173) = 173

which gets:

5302  read(21, "{\"id\": \"libvirt-33\", \"error\": {\"class\": 
\"BusNoHotplug\", \"desc\": \"Bus 'pci.0' does not support hotplugging\", 
\"data\": {\"bus\": \"pci.0\"}}}\r\n", 1023) = 136

Game over.

-- Package-specific info:


/proc/cpuinfo:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 15
model name  : Intel(R) Xeon(R) CPU3050  @ 2.13GHz
stepping: 2
microcode   : 0x51
cpu MHz : 2133.000
cache size  : 2048 KB
physical id : 0
siblings: 2
core id : 0
cpu cores   : 2
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 10
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi