[libvirt] [PATCH 11/11] conf: Move and optimize disk target duplicity checking

Ján Tomko jtomko at redhat.com
Sat Feb 6 10:18:17 UTC 2016


On Thu, Feb 04, 2016 at 03:49:48PM +0100, Peter Krempa wrote:
> Move the logic from virDomainDiskDefDstDuplicates into
> virDomainDiskDefCheckDuplicateInfo so that we don't have to loop
> multiple times through the array of disks. Since the original function
> was called in qemuBuildDriveDevStr, it was actually called for every
> single disk which was quite wasteful.
> 
> Additionally the target uniqueness check needed to be duplicated in
> the disk hotplug case, since the disk was inserted into the domain
> definition after the device string was formatted and thus
> virDomainDiskDefDstDuplicates didn't do anything in that case.
> ---
>  src/conf/domain_conf.c   | 44 +++++++++++++-------------------------------
>  src/conf/domain_conf.h   |  1 -
>  src/libvirt_private.syms |  1 -
>  src/qemu/qemu_command.c  |  3 ---
>  src/qemu/qemu_hotplug.c  |  6 ------
>  5 files changed, 13 insertions(+), 42 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 8a7a989..c1dffc4 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 8943270..d7f19f3 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4228,9 +4228,6 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
>      const char *contAlias;
>      int controllerModel;
> 
> -    if (virDomainDiskDefDstDuplicates(def))
> -        goto error;
> -

All the callers of qemuBuildDriveDevStr have this check, except
qemuConnectDomainXMLToNative which calls qemuBuildCommandLine
without calling qemuProcessStartValidate first.

ACK with that fixed.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160206/8bf63036/attachment-0001.sig>


More information about the libvir-list mailing list