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

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



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


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