[libvirt] [PATCH 3/5] qemu: blockcopy: reuse storage driver APIs to pre-create copy target

Peter Krempa pkrempa at redhat.com
Thu Jul 20 07:40:28 UTC 2017


On Wed, Jul 19, 2017 at 17:44:16 -0400, John Ferlan wrote:
> 
> 
> On 07/11/2017 11:46 AM, Peter Krempa wrote:
> > Rather than using the local-file only implementation 'qemuOpenFile'
> > switch to the imagelabel aware storage driver implementation.
> > ---
> >  src/qemu/qemu_driver.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index d00166f23..48dc5e5cc 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c

[...]

> > @@ -16880,8 +16885,10 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
> >                   vm->def->name);
> > 
> >   endjob:
> > -    if (need_unlink && unlink(mirror->path))
> > -        VIR_WARN("unable to unlink just-created %s", mirror->path);
> > +    if (need_unlink && virStorageFileUnlink(mirror))
> 
> ...Unlink(mirror) < 0)
> 
> > +        VIR_WARN("%s", _("unable to remove just-created copy target"));
> > +    virStorageFileDeinit(mirror);
> > +    virStorageSourceFree(mirror);
> 
> Isn't this duplicitous with the same in the cleanup: label

Yes indeed. It would even crash on the error paths if 'mirror' was not
consumed into the disk definition structure. Good catch.

> 
> >      qemuDomainObjEndJob(driver, vm);
> >      if (monitor_error) {
> >          virSetError(monitor_error);
> > 
> 
> with fixups...
> 
> Reviewed-by: John Ferlan <jferlan at redhat.com>

Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170720/a07a20b6/attachment-0001.sig>


More information about the libvir-list mailing list