Re: [PATCH 3/4] qemu: check presence of each disk in chain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/18/2013 01:32 PM, Guannan Ren wrote:
> For disk with startupPolicy support, such as cdrom and floppy
> when its chain is broken, the startup policy  will apply,
> otherwise, report error on chain issue.
> 
> Force to collect diskchain metadata when qemu process start
> everytime.
> ---
>  src/qemu/qemu_domain.c  | 19 ++++++++++---------
>  src/qemu/qemu_process.c |  7 -------
>  2 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 1fa1a5f..c4adbaa 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -2057,20 +2057,21 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
>      for (i = 0; i < vm->def->ndisks; i++) {
>          disk = vm->def->disks[i];
>  
> -        if (!disk->startupPolicy || !disk->src)
> +        if (!disk->src)
>              continue;
>  
> -        if (virFileAccessibleAs(disk->src, F_OK,
> -                                cfg->user,
> -                                cfg->group) >= 0) {
> -            /* disk accessible */
> +        if (qemuDomainDetermineDiskChain(driver,
> +                                         disk, true) >= 0)
>              continue;

As mentioned in [PATCH 2/4], this should be changed to check whether the
backing chain is broken or not.

> +
> +        if (disk->startupPolicy) {
> +            if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
> +                                                 disk->startupPolicy,
> +                                                 cold_boot) >= 0)
> +                continue;
>          }
>  
> -        if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
> -                                             disk->startupPolicy,
> -                                             cold_boot) < 0)
> -            goto cleanup;
> +        goto cleanup;
>      }
>  
>      ret = 0;
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 3d5e8f6..f495267 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3562,17 +3562,10 @@ int qemuProcessStart(virConnectPtr conn,
>      if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
>          goto cleanup;
>  
> -    VIR_DEBUG("Checking for CDROM and floppy presence");

Changed debug message could be used in qemuDomainCheckDiskPresence(),
even for every disk, so it is easier to find why we were browsing
through files on the host.

Other than that the patch looks fine, we'll see how it looks after 2/4
is fixed.

Martin

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]