[libvirt] [PATCH] qemu: Fix the wrong logic of building cmd line for volume type disk

It builds a "libiscsi" uri if the volume type is "file" and "disk->auth.username" is specified, but I even see no reason to build the "libiscsi" uri for a "file" type volume, and the logic to check whether "disk->auth.username" is specified is also beyond understanding. It produces unexpected result like below: Disk config (pool is of 'fs' type): <disk type='volume' device='disk'> <driver name='qemu' type='raw'/> <auth username='myuser'> </auth> <source pool='default' volume='f18.img'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> % virsh start f18 error: Failed to start domain f18 error: internal error: iscsi accepts only one host --- src/qemu/qemu_command.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index abb62e9..9b6a27d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3806,13 +3806,7 @@ qemuBuildVolumeString(virConnectPtr conn, } break; case VIR_STORAGE_VOL_FILE: - if (disk->auth.username) { - if (qemuBuildISCSIString(conn, disk, opt) < 0) - goto cleanup; - virBufferAddChar(opt, ','); - } else { - virBufferEscape(opt, ',', ",", "file=%s,", disk->src); - } + virBufferEscape(opt, ',', ",", "file=%s,", disk->src); break; case VIR_STORAGE_VOL_NETWORK: /* Keep the compiler quite, qemuTranslateDiskSourcePool already -- 1.8.1.4

On Wed, Oct 16, 2013 at 08:18:28PM +0800, Osier Yang wrote:
It builds a "libiscsi" uri if the volume type is "file" and "disk->auth.username" is specified, but I even see no reason to build the "libiscsi" uri for a "file" type volume, and the logic to check whether "disk->auth.username" is specified is also beyond understanding.
It produces unexpected result like below:
Disk config (pool is of 'fs' type):
<disk type='volume' device='disk'> <driver name='qemu' type='raw'/> <auth username='myuser'> </auth> <source pool='default' volume='f18.img'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk>
% virsh start f18 error: Failed to start domain f18 error: internal error: iscsi accepts only one host --- src/qemu/qemu_command.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
Test case.... Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Osier Yang