mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: block: Introduce qemuBlockNamedNodeDataGetBitmapByName
This function looks up a named bitmap for a virStorageSource in the data returned from query-named-block-nodes. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
7dfd5d8d81
commit
b7f2cd4652
@ -2612,3 +2612,35 @@ qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockNamedNodeDataGetBitmapByName:
|
||||
* @blockNamedNodeData: hash table returned by qemuMonitorBlockGetNamedNodeData
|
||||
* @src: disk source to find the bitmap for
|
||||
* @bitmap: name of the bitmap to find
|
||||
*
|
||||
* Looks up a bitmap named @bitmap of the @src image.
|
||||
*/
|
||||
qemuBlockNamedNodeDataBitmapPtr
|
||||
qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData,
|
||||
virStorageSourcePtr src,
|
||||
const char *bitmap)
|
||||
{
|
||||
qemuBlockNamedNodeDataPtr nodedata;
|
||||
size_t i;
|
||||
|
||||
if (!(nodedata = virHashLookup(blockNamedNodeData, src->nodeformat)))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < nodedata->nbitmaps; i++) {
|
||||
qemuBlockNamedNodeDataBitmapPtr bitmapdata = nodedata->bitmaps[i];
|
||||
|
||||
if (STRNEQ(bitmapdata->name, bitmap))
|
||||
continue;
|
||||
|
||||
return bitmapdata;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -203,3 +203,8 @@ qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *diskTarget,
|
||||
virStorageSourcePtr src);
|
||||
|
||||
qemuBlockNamedNodeDataBitmapPtr
|
||||
qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData,
|
||||
virStorageSourcePtr src,
|
||||
const char *bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user