Bug 1443434

Summary: when starting a guest with "dir" type disk/floppy,the error info is not accurate
Product: Red Hat Enterprise Linux 7 Reporter: lijuan men <lmen>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Jing Qi <jinqi>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.4CC: dyuan, hahn, rbalakri, xuzhang
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.7.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 10:42:33 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:

Description lijuan men 2017-04-19 09:16:43 UTC
Description of problem:

As "http://libvirt.org/formatdomain.html" said:
"disk
  The disk element is the main container for describing disks and supports the following attributes:
     type
        Valid values are "file", "block", ****"dir" ****(since 0.7.5), "network" (since 0.8.7), or "volume" (since 1.0.5) and refer to the underlying source for the disk. Since 0.0.3 "


I think it means libvirt supports "dir" type disk/floppy/cdrom

But I tried to start a guest with "dir" type disk/floppy( using the format in https://bugzilla.redhat.com/show_bug.cgi?id=525074#c5),failed. And the error information is strange:
"internal error: unsupported disk driver type for 'raw'"

So I am not sure,

Does libvirt really support "dir" type disk/floppy/cdrom?

1)If it supports,
  a)when starting the guest, it should not output error information
  b)in libvirt.org,it is best to list more detailed information about it,such as,whether it support "dir" type disk/floppy/cdrom? how to use it(give a example)?

2)If it doesn't support,
a) the error information is not accurate
b) libvirt.org needs to be updated

Version-Release number of selected component (if applicable):
libvirt-3.2.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1.start a guest with the following xml:
<disk type='dir' device='floppy'>
      <source dir='/tmp/test'/>
      <target dev='fda' bus='fdc'/>
      <readonly/>
    </disk>

[root@lmen1 ~]# virsh start test
error: Failed to start domain test
error: internal error: unsupported disk driver type for 'raw'

2.start a guest with the following xml:
 <disk type='dir' device='disk'>
      <driver name='qemu'/>
      <source dir='/tmp/test'/>
      <target dev='sda' bus='scsi'/>
    </disk>


[root@lmen1 ~]# virsh start test
error: Failed to start domain test
error: internal error: unsupported disk driver type for 'raw'


Actual results:
the error information is not accurate

Expected results:


Additional info:

Comment 2 Philipp Hahn 2017-06-29 12:11:13 UTC
Try specifying the type: <driver name='qemu' type='fat'/>:

The error message is from src/qemu/qemu_command.c:
 1534         /* for now the DIR based storage is handled by the magic FAT format */
 1535         if (actualType == VIR_STORAGE_TYPE_DIR) {
 1536             if (disk->src->format > 0 &&
 1537                 disk->src->format != VIR_STORAGE_FILE_FAT) {
 1538                 virReportError(VIR_ERR_INTERNAL_ERROR,
 1539                                _("unsupported disk driver type for '%s'"),                                                                                                                                                            
 1540                                virStorageFileFormatTypeToString(disk->src->format));

You also get the error message when "managedsave" is used: On resuming the VM the directory seems to get mis-detected as "raw" again.
After removing the suspend state with "managedsave-remove $VM" the VM can be started without any problems.

FYI: This experience is from my old Debian system running
virsh # version 
Compiled against library: libvirt 1.2.9
Using library: libvirt 1.2.9
Using API: QEMU 1.2.9
Running hypervisor: QEMU 1.1.2

Comment 3 Martin Kletzander 2017-08-18 15:36:50 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-August/msg00536.html

Comment 5 Martin Kletzander 2017-08-29 14:34:02 UTC
Fixed upstream with v3.7.0-rc1-1-g3401e208ab1d..v3.7.0-rc1-2-ged8661a309c9:
commit 3401e208ab1dcea4694e5b18623d9b91d4bc286f
Author: Martin Kletzander <mkletzan>
Date:   Fri Aug 25 14:45:56 2017 +0200

    qemu: Don't mangle the storage format for type='dir'
    
commit ed8661a309c96e4a1573dc0ca2c76ea7ff19469a
Author: Martin Kletzander <mkletzan>
Date:   Fri Aug 18 17:33:08 2017 +0200

    qemu: Also treat directories properly when using namespaces

Comment 7 Jing Qi 2017-10-17 06:43:48 UTC
Verified with libvirt-3.7.0-1.el7 and qemu-kvm-rhev-2.10.0-1.el7.x86_64.


1.start a guest with the following xml:
<disk type='dir' device='floppy'>
      <source dir='/tmp/test'/>
      <target dev='fda' bus='fdc'/>
      <readonly/>
    </disk>

# virsh start avocado-vt-vm1
error: Failed to start domain test
error: internal error: unsupported disk driver type for 'dir'

2.start a guest with the following xml:
 <disk type='dir' device='disk'>
      <driver name='qemu'/>
      <source dir='/tmp/test'/>
      <target dev='sda' bus='scsi'/>
    </disk>


# virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: internal error: unsupported disk driver type for 'dir'

Comment 8 Jing Qi 2017-10-19 02:39:12 UTC
The error information is clear now as above comment 7 showed.

Comment 12 errata-xmlrpc 2018-04-10 10:42:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704