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

Jiri Denemark jdenemar at redhat.com
Wed Feb 20 13:52:59 UTC 2013


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




More information about the libvir-list mailing list