mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage: fs: Properly parse backing store info
Use the backing store parser to properly create the information about a volume's backing store. Unfortunately as the storage driver isn't prepared to allow volumes backed by networked filesystems add a workaround that will avoid changing the XML output.
This commit is contained in:
parent
cd4d547576
commit
dc2943579f
@ -96,16 +96,28 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (meta->backingStoreRaw) {
|
if (meta->backingStoreRaw) {
|
||||||
if (VIR_ALLOC(target->backingStore) < 0)
|
if (!(target->backingStore = virStorageSourceNewFromBacking(meta)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
target->backingStore->path = meta->backingStoreRaw;
|
|
||||||
meta->backingStoreRaw = NULL;
|
|
||||||
target->backingStore->format = backingStoreFormat;
|
target->backingStore->format = backingStoreFormat;
|
||||||
|
|
||||||
|
/* XXX: Remote storage doesn't play nicely with volumes backed by
|
||||||
|
* remote storage. To avoid trouble, just fake the backing store is RAW
|
||||||
|
* and put the string from the metadata as the path of the target. */
|
||||||
|
if (!virStorageSourceIsLocalStorage(target->backingStore)) {
|
||||||
|
virStorageSourceFree(target->backingStore);
|
||||||
|
|
||||||
|
if (VIR_ALLOC(target->backingStore) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
target->backingStore->type = VIR_STORAGE_TYPE_NETWORK;
|
||||||
|
target->backingStore->path = meta->backingStoreRaw;
|
||||||
|
meta->backingStoreRaw = NULL;
|
||||||
|
target->backingStore->format = VIR_STORAGE_FILE_RAW;
|
||||||
|
}
|
||||||
|
|
||||||
if (target->backingStore->format == VIR_STORAGE_FILE_AUTO) {
|
if (target->backingStore->format == VIR_STORAGE_FILE_AUTO) {
|
||||||
if (!virStorageIsFile(target->backingStore->path) ||
|
if ((rc = virStorageFileProbeFormat(target->backingStore->path,
|
||||||
(rc = virStorageFileProbeFormat(target->backingStore->path,
|
|
||||||
-1, -1)) < 0) {
|
-1, -1)) < 0) {
|
||||||
/* If the backing file is currently unavailable or is
|
/* If the backing file is currently unavailable or is
|
||||||
* accessed via remote protocol only log an error, fake the
|
* accessed via remote protocol only log an error, fake the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user