diff options
author | Peter Krempa <pkrempa@redhat.com> | 2017-07-26 09:36:21 +0200 |
---|---|---|
committer | Peter Krempa <pkrempa@redhat.com> | 2017-07-27 09:47:40 +0200 |
commit | 0175dc6ea024d4edd0f59571c3f5fa80d1ec1c0e (patch) | |
tree | 987ada21dcc73901974b6091ad5e122fc832fe28 /src/qemu/qemu_block.h | |
parent | c61d1693277952fc18fdb15770805d9eace3acef (diff) | |
download | libvirt-0175dc6ea024d4edd0f59571c3f5fa80d1ec1c0e.tar.gz |
qemu: block: Refactor node name detection code
Remove the complex and unreliable code which inferred the node name
hierarchy only from data returned by 'query-named-block-nodes'. It turns
out that query-blockstats contain the full hierarchy of nodes as
perceived by qemu so the inference code is not necessary.
In query blockstats, the 'parent' object corresponds to the storage
behind a storage volume and 'backing' corresponds to the lower level of
backing chain. Since all have node names this data can be really easily
used to detect node names.
In addition to the code refactoring the one remaining test case needed
to be fixed along.
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'src/qemu/qemu_block.h')
-rw-r--r-- | src/qemu/qemu_block.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 17dec799f8..5d21057a77 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -31,19 +31,15 @@ typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingChainDa typedef qemuBlockNodeNameBackingChainData *qemuBlockNodeNameBackingChainDataPtr; struct qemuBlockNodeNameBackingChainData { char *qemufilename; /* name of the image from qemu */ - char *backingstore; char *nodeformat; /* node name of the format layer */ char *nodestorage; /* node name of the storage backing the format node */ - char *nodebacking; /* node name of the backing file format layer */ - - /* data necessary for detection of the node names from qemu */ - virJSONValuePtr *elems; - size_t nelems; + qemuBlockNodeNameBackingChainDataPtr backing; }; virHashTablePtr -qemuBlockNodeNameGetBackingChain(virJSONValuePtr data); +qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodesdata, + virJSONValuePtr blockstats); int qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, |