mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemuDomainVirStorageSourceFindByNodeName: Extract nodename matching
Extract the matching of the node name of a single virStorage source so that the logic can be reused in the upcoming patch. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
2a9349c8e8
commit
71935d4972
@ -2884,6 +2884,25 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainVirStorageSourceMatchNodename:
|
||||
* @src: storage source to match
|
||||
* @nodeName to match
|
||||
*
|
||||
* Returns true if any of the nodenames of @src matches @nodeName.
|
||||
*/
|
||||
static bool
|
||||
qemuDomainVirStorageSourceMatchNodename(virStorageSource *src,
|
||||
const char *nodeName)
|
||||
{
|
||||
const char *nodestorage = qemuBlockStorageSourceGetStorageNodename(src);
|
||||
const char *nodeformat = qemuBlockStorageSourceGetFormatNodename(src);
|
||||
|
||||
return (nodeformat && STREQ(nodeformat, nodeName)) ||
|
||||
(nodestorage && STREQ(nodestorage, nodeName));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainVirStorageSourceFindByNodeName:
|
||||
* @top: backing chain top
|
||||
@ -2900,11 +2919,7 @@ qemuDomainVirStorageSourceFindByNodeName(virStorageSource *top,
|
||||
virStorageSource *tmp;
|
||||
|
||||
for (tmp = top; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
|
||||
const char *nodestorage = qemuBlockStorageSourceGetStorageNodename(tmp);
|
||||
const char *nodeformat = qemuBlockStorageSourceGetFormatNodename(tmp);
|
||||
|
||||
if ((nodeformat && STREQ(nodeformat, nodeName)) ||
|
||||
(nodestorage && STREQ(nodestorage, nodeName)))
|
||||
if (qemuDomainVirStorageSourceMatchNodename(tmp, nodeName))
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user