[libvirt] [PATCH v4 2/2] qemu_capabilities: Introduce gluster specific debug capability

Jiri Denemark jdenemar at redhat.com
Wed Sep 21 13:51:17 UTC 2016


On Wed, Sep 21, 2016 at 19:00:17 +0530, Prasanna Kumar Kalever wrote:
> Teach qemu driver to detect whether qemu supports this configuration
> factor or not.
> 
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>
...
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 545e25d..b73ad70 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1314,7 +1314,8 @@ qemuDiskBusNeedsDeviceArg(int bus)
>  
>  static int
>  qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
> -                        virBufferPtr buf)
> +                        virBufferPtr buf,
> +                        virQEMUCapsPtr qemuCaps)
>  {
>      int actualType = virStorageSourceGetActualType(disk->src);
>      qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
> @@ -1385,7 +1386,8 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
>  
>      if (disk->src &&
>          disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
> -        virBufferAsprintf(buf, "file.debug=%d,", disk->src->debug_level);
> +        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL))
> +            virBufferAsprintf(buf, "file.debug=%d,", disk->src->debug_level);

Adding file.debug unconditionally first and making it conditional in the
next patch is pretty strange. The capability should really be introduced
as the first patch in the series to avoid it.

>      }
>  
>      if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) {
> @@ -1513,7 +1515,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
>          break;
>      }
>  
> -    if (qemuBuildDriveSourceStr(disk, &opt) < 0)
> +    if (qemuBuildDriveSourceStr(disk, &opt, qemuCaps) < 0)
>          goto error;
>  
>      if (emitDeviceSyntax)
> @@ -2263,8 +2265,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
>  
>          if (disk->src &&
>              disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
> -            if (cfg->glusterDebugLevel)
> -                disk->src->debug_level = cfg->glusterDebugLevel;
> +            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL) &&
> +                cfg->glusterDebugLevel)
> +                    disk->src->debug_level = cfg->glusterDebugLevel;

Wrong indentation, but it doesn't matter much because of my comment on
this code in patch 1.
...

Jirka




More information about the libvir-list mailing list