提交 d3833b07 编写于 作者: P Peter Krempa

qemu: blockjob: Clear out any irrelevant data in copied source

Since we copy everything from the original storage source including some
runtime data which are not relevant for the config we should clear them.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
ACKed-by: NEric Blake <eblake@redhat.com>
上级 3b27b5f3
......@@ -433,6 +433,25 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
virObjectEventStateQueue(driver->domainEventState, event2);
}
/**
* qemuBlockJobCleanStorageSourceRuntime:
* @src: storage source to clean from runtime data
*
* Remove all runtime related data from the storage source.
*/
static void
qemuBlockJobCleanStorageSourceRuntime(virStorageSourcePtr src)
{
src->id = 0;
src->detected = false;
VIR_FREE(src->relPath);
VIR_FREE(src->backingStoreRaw);
VIR_FREE(src->nodestorage);
VIR_FREE(src->nodeformat);
VIR_FREE(src->tlsAlias);
VIR_FREE(src->tlsCertdir);
}
/**
* qemuBlockJobRewriteConfigDiskSource:
......@@ -467,6 +486,8 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
return;
}
qemuBlockJobCleanStorageSourceRuntime(copy);
virObjectUnref(persistDisk->src);
VIR_STEAL_PTR(persistDisk->src, copy);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册