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

Re: [libvirt] [PATCH v3 RESEND 09/12] qemu_migration: Check size prerequisites



On Wed, Feb 20, 2013 at 14:47:11 +0100, Jiri Denemark wrote:
...
> > +static int
> > +qemuMigrationPreCreateStorage(virQEMUDriverPtr driver,
> > +                              virDomainObjPtr vm,
> > +                              qemuMigrationCookiePtr mig)
> > +{
> > +    int ret = -1;
> > +    size_t i = 0;
> > +
> > +    if (!mig->nbd || !mig->nbd->ndisks) {
> > +        /* nothing to do here */
> > +        return 0;
> > +    }
> > +
> > +    for (i = 0; i < mig->nbd->ndisks; i++) {
> > +        virDomainDiskDefPtr disk;
> > +        int format;
> > +        size_t bytes;
> > +        int index;
> 
> This fails to compile:
> 
>     error: declaration of 'index' shadows a global declaration
> 
> > +
> > +        index = virDomainDiskIndexByName(vm->def, mig->nbd->disk[i].target, false);
> > +        if (index < 0) {
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,
> > +                           _("No such disk '%s"),
> > +                           mig->nbd->disk[i].target);
> > +            goto cleanup;
> > +        }
> > +
> > +        disk = vm->def->disks[i];
> 
> As John already said, I think you want vm->def->disks[index] here.
> 
> > +        format = disk->format;
> > +        bytes = mig->nbd->disk[i].bytes;

Oh, and I forgot to mention that we should only try to pre-create disks
with type='file'.

Jirka


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