Bug 1651457

Summary: Fail to start an VM with empty CDROMs
Product: [Fedora] Fedora Reporter: Han Han <hhan>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: agedosier, amit, berrange, cfergeau, clalancette, crobinso, dwmw2, dyuan, itamar, jforbes, juzhang, laine, libvirt-maint, pbonzini, pkrempa, rjones, veillard, virt-maint, xuzhang
Target Milestone: ---Keywords: Regression, TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1651458 (view as bug list) Environment:
Last Closed: 2019-03-20 23:12:25 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:
Bug Depends On:    
Bug Blocks: 1651458    

Description Han Han 2018-11-20 07:01:47 UTC
Description of problem:
As subject

Version-Release number of selected component (if applicable):
qemu-3.0.0 or after

How reproducible:
100%

Steps to Reproduce:
1. Start an VM as following
# qemu-kvm -drive if=none,id=drive-ide0-0-0,readonly=on,cache=none -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,write-cache=on
qemu-kvm: -drive if=none,id=drive-ide0-0-0,readonly=on,cache=none: Must specify either driver or file


Actual results:
As above

Expected results:
# qemu-kvm -drive if=none,id=drive-ide0-0-0,readonly=on,cache=none -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,write-cache=on
VNC server running on ::1:5900

Additional info:
This will block libvirt tests: vm start in with empty cdrom. Please fix it asap.

It works on qemu-2.12.

It can be reproduced on scsi and sata bus, too.
# qemu-kvm -drive if=none,id=drive-scsi0-0-0-0,readonly=on,cache=none -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,write-cache=on
Unable to init server: Could not connect: Connection refused
qemu-system-x86_64: -drive if=none,id=drive-scsi0-0-0-0,readonly=on,cache=none: Must specify either driver or file

# qemu-kvm -drive if=none,id=drive-sata0-0-0,media=cdrom,readonly=on,cache=none -device ide-cd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0,write-cache=on
Unable to init server: Could not connect: Connection refused
qemu-system-x86_64: -drive if=none,id=drive-sata0-0-0,media=cdrom,readonly=on,cache=none: Must specify either driver or file

Comment 1 Cole Robinson 2018-12-12 17:30:59 UTC
I can reproduce with qemu 3.0 and libvirt 4.7 in f29 as well.
There's a closed RHEL qemu-kvm bug, not sure what the fix was: https://bugzilla.redhat.com/show_bug.cgi?id=1342999
But there's still an open libvirt bug for it: https://bugzilla.redhat.com/show_bug.cgi?id=1377321

I think the current state is that libvirt shouldn't be passing those options in the empty cdrom case. pkrempa is that correct?

Comment 2 Peter Krempa 2019-01-21 16:13:36 UTC
Fixed upstream:

commit f80eae8c2ae0c62ecaa550ab6353cf871bb17d4e (HEAD -> master, origin/master, origin/HEAD)
Author: Peter Krempa <pkrempa>
Date:   Tue Jan 15 17:28:21 2019 +0100

    qemu: command: Don't format image properties for empty -drive
    
    If a -drive has no image, using image properties makes qemu whine that
    they should not be used.
    
    This patch stops formating cache/readonly/... for empty drives
    for the pre-blockdev syntax. Unfortunately those parameters can't be
    added later when inserting media, but on the other hand qemu will start
    with an empty drive.
    
    Since we already were able to start a VM with such config previously due
    to qemu ignoring them I've opted just to skip formatting them.
    Additionally with -blockdev support it will work as expected as the
    image properties will be formatted when adding the image itself which is
    not possible without it.

Comment 3 Cole Robinson 2019-03-20 23:12:25 UTC
This is in rawhide libvirt nowadays