On Tue, May 09, 2017 at 11:30:20AM -0400, John Ferlan wrote: > The virStoragePoolObjDeleteDef already dealt with the configFile - just > add in the autostartLink as well. If there is no autostartLink defined, > then no need to attempt unlink - which also allows removal of one errno > check in moved function. > > Signed-off-by: John Ferlan <jfer...@redhat.com> > --- > src/conf/virstorageobj.c | 11 +++++++++++ > src/storage/storage_driver.c | 11 ----------- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c > index 9ce3840..69ed66d 100644 > --- a/src/conf/virstorageobj.c > +++ b/src/conf/virstorageobj.c > @@ -696,6 +696,17 @@ virStoragePoolObjDeleteDef(virStoragePoolObjPtr obj) > obj->def->name); > return -1; > } > + VIR_FREE(obj->configFile); > + > + if (!obj->autostartLink) > + return 0; > + > + if (unlink(obj->autostartLink) < 0 && errno != ENOTDIR) { > + char ebuf[1024]; > + VIR_ERROR(_("Failed to delete autostart link '%s': %s"), > + obj->autostartLink, virStrerror(errno, ebuf, > sizeof(ebuf))); > + } > + VIR_FREE(obj->autostartLink); > > return 0; > } > diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c > index c4e4e7b..c4650cd 100644 > --- a/src/storage/storage_driver.c > +++ b/src/storage/storage_driver.c > @@ -841,17 +841,6 @@ storagePoolUndefine(virStoragePoolPtr pool) > if (virStoragePoolObjDeleteDef(obj) < 0) > goto cleanup; > > - if (unlink(obj->autostartLink) < 0 && > - errno != ENOENT && > - errno != ENOTDIR) { > - char ebuf[1024]; > - VIR_ERROR(_("Failed to delete autostart link '%s': %s"), > - obj->autostartLink, virStrerror(errno, ebuf, > sizeof(ebuf))); > - }
The same as for the previous patch, keep the unlink in storage driver and use the new virStoragePoolObjGetAutostartLink(). > - > - VIR_FREE(obj->configFile); > - VIR_FREE(obj->autostartLink); > - This can be safely removed since it's handled by virStoragePoolObjFree() which is called in virStoragePoolObjRemove(). > event = virStoragePoolEventLifecycleNew(obj->def->name, > obj->def->uuid, > VIR_STORAGE_POOL_EVENT_UNDEFINED, > -- > 2.9.3 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list