Bug 880097

Summary: qemu-kvm fail to re-used the configuration of virtual devices saved with writeconfig
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, bsarathy, chayang, dyasny, juzhang, mazhang, michen, mkenneth, mst, qzhang, sluo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-26 10:26:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
dumps the virtual machine devices configuration to dump.cfg file via 'writeconfig'. none

Description Sibiao Luo 2012-11-26 09:13:34 UTC
Description of problem:
Dumps the current virtual machine devices configuration to a text file via writeconfig, but the qemu-kvm fail to read it from a file which was previously either saved with 'writeconfig'. 
btw, if i add '-net none' to the 'readconfig' command line, it can boot up successfully.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-344.el6.x86_64
qemu-kvm-0.12.1.2-2.337.el6.x86_64
guest info:
windows_2012_x64

How reproducible:
100%

Steps to Reproduce:
1.Dumps the current virtual machine devices configuration to a text file via writeconfig.
# /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu Opteron_G2 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -usb -device usb-tablet,id=input0 -name sluo_operation -uuid 4829519d-1ac7-4cbd-babb-0267f47d2087 -rtc base=localtime,clock=host,driftfix=slew -drive file=/home/windows_2012_sluo_x64.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=2C:41:38:B6:40:11,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -drive file=/home/my-data-disk.raw,if=none,id=data-disk,format=raw,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,bus=pci.0,addr=0x6,drive=data-disk,id=sluo-disk -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -vnc :1 -boot menu=on -writeconfig /home/dump.cfg
2.read the configuration dump of virtual devices.
# /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu Opteron_G2 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -usb -name sluo_operation -uuid 4829519d-1ac7-4cbd-babb-0267f47d2087 -vnc :1 -boot menu=on -readconfig /home/dump.cfg
  
Actual results:
after step 1, it can dump the virtual devices successfully, i will attach the dump file later.
Note: I did not see any about the [cpudef] in the dump file in the rhel6.4, but i remember that the rhel6.3GA can do it successfully, please help me check it.
after step 2, it will fail to boot up and prompt as following,
qemu-kvm:/home/dump.txt:22: PCI: devfn 24 not available for virtio-blk-pci, in use by rtl8139
qemu-kvm:/home/dump.txt:22: Device 'virtio-blk-pci' could not be initialized

Expected results:
qemu can read the virtual devices configuration saved with 'writeconfig' instead of entering the devices configuration options on the command line each time you want to run a virtual machine.

Additional info:

Comment 1 Sibiao Luo 2012-11-26 09:17:12 UTC
Created attachment 651824 [details]
dumps the virtual machine devices configuration to dump.cfg file via 'writeconfig'.

Comment 5 Michael S. Tsirkin 2012-11-26 10:26:21 UTC
help text is explicit:
-net none       use it alone to have zero network devices. If no -net option
                is provided, the default is '-net nic -net user'

so without -net none you have requested the default nic (rtl8139)
which conflicts with the configuration you are trying to read in.

Comment 6 Sibiao Luo 2012-11-27 01:41:57 UTC
(In reply to comment #5)
> help text is explicit:
> -net none       use it alone to have zero network devices. If no -net option
>                 is provided, the default is '-net nic -net user'
> 
> so without -net none you have requested the default nic (rtl8139)
> which conflicts with the configuration you are trying to read in.

ok, thanks for your checking. mst, how about the [cpudef] in the dump file ? I did not see any about the [cpudef] in the dump file in the rhel6.4, but i remember that the rhel6.3GA can do it successfully, please help me check it.

Comment 7 Sibiao Luo 2012-11-27 01:51:08 UTC
(In reply to comment #5)
> help text is explicit:
> -net none       use it alone to have zero network devices. If no -net option
>                 is provided, the default is '-net nic -net user'
> 
> so without -net none you have requested the default nic (rtl8139)
> which conflicts with the configuration you are trying to read in.

btw, why it fail to prompt that relate to the 'PCI: devfn 24 not available for virtio-blk-pci' and ''virtio-blk-pci' could not be initialized'? doest the prompt have no any problem ? 

qemu-kvm:/home/dump.txt:22: PCI: devfn 24 not available for virtio-blk-pci, in use by rtl8139
qemu-kvm:/home/dump.txt:22: Device 'virtio-blk-pci' could not be initialized

Comment 8 Sibiao Luo 2012-11-27 02:25:07 UTC
(In reply to comment #7)
> btw, why it fail to prompt that relate to the 'PCI: devfn 24 not available
> for virtio-blk-pci' and ''virtio-blk-pci' could not be initialized'? doest
> the prompt have no any problem ? 
> 
> qemu-kvm:/home/dump.txt:22: PCI: devfn 24 not available for virtio-blk-pci,
> in use by rtl8139
> qemu-kvm:/home/dump.txt:22: Device 'virtio-blk-pci' could not be initialized

hmm...the rtl8139 was added by default to the addr = 0x3, so it was conflicts with the 'virtio-blk-pci' which i assigned the addr=0x3. 

I have tried two scenarios:
- boot a guest without network device and assign the addr for each pci device(system addr=0x3, balloon addr=0x4, data disk addr=0x5), it fail to boot.

# /usr/libexec/qemu-kvm -M rhel6.3.0 -enable-kvm -m 4096 -smp 4,sockets=2,cores=2,threads=1 -usb -device usb-tablet,id=input0 -name image_streaming -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -drive file=/mnt/windows_7_ultimate_sp1_x64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 -drive file=/mnt/small-data-disk.qcow2,if=none,id=data-disk,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=data-disk,id=sluo-disk -monitor stdio 
do_spice_init: starting 0.10.1
spice_server_add_interface: SPICE_INTERFACE_MIGRATION
spice_server_add_interface: SPICE_INTERFACE_KEYBOARD
spice_server_add_interface: SPICE_INTERFACE_MOUSE
spice_server_add_interface: SPICE_INTERFACE_QXL
red_worker_main: begin
display_channel_create: create display channel
cursor_channel_create: create cursor channel
qemu-kvm: -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1: PCI: devfn 24 not available for virtio-blk-pci, in use by rtl8139
qemu-kvm: -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1: Device 'virtio-blk-pci' could not be initialized

- boot a guest without network device and assign the addr for each pci device(system addr=0x4, balloon addr=0x5, data disk addr=0x6), it can boot successfully, and check that the rtl8139 was added to the addr=0x3.

# /usr/libexec/qemu-kvm -M rhel6.3.0 -enable-kvm -m 4096 -smp 4,sockets=2,cores=2,threads=1 -usb -device usb-tablet,id=input0 -name image_streaming -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -drive file=/mnt/windows_7_ultimate_sp1_x64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -drive file=/mnt/small-data-disk.qcow2,if=none,id=data-disk,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,bus=pci.0,addr=0x6,drive=data-disk,id=sluo-disk -monitor stdio