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

Osier Yang jyang at redhat.com
Wed Oct 16 12:18:28 UTC 2013


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




More information about the libvir-list mailing list