
On 10/7/19 6:49 PM, Cole Robinson wrote:
Add the plumbing to track a externalDataStoreRaw as a virStorageSource
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/util/virstoragefile.c | 9 +++++++++ src/util/virstoragefile.h | 3 +++ 2 files changed, 12 insertions(+)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 7ae6719dd6..ce669b6e0b 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2339,6 +2339,12 @@ virStorageSourceCopy(const virStorageSource *src, return NULL; }
+ if (src->externalDataStore) { + if (!(def->externalDataStore = virStorageSourceCopy(src->externalDataStore, + true))) + return NULL; + } + VIR_STEAL_PTR(ret, def); return ret; } @@ -2560,6 +2566,9 @@ virStorageSourceClear(virStorageSourcePtr def) VIR_FREE(def->timestamps); VIR_FREE(def->externalDataStoreRaw);
+ virObjectUnref(def->externalDataStore); + def->externalDataStore = NULL;
Is this assign to NULL necessary? virObjectUnref will call VIR_FREE() in def->externalDataStore if there is no more references to it (which will assign it to NULL in the end). LGTM otherwise Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
+ virStorageNetHostDefFree(def->nhosts, def->hosts); virStorageAuthDefFree(def->auth); virObjectUnref(def->privateData); diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index bbff511657..d84dad052d 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -292,6 +292,9 @@ struct _virStorageSource { /* backing chain of the storage source */ virStorageSourcePtr backingStore;
+ /* external data store storage source */ + virStorageSourcePtr externalDataStore; + /* metadata for storage driver access to remote and local volumes */ virStorageDriverDataPtr drv;