提交 8ac83013 编写于 作者: P Peter Krempa

util: storage: Add helper for determining whether a backing chain requires PR

With blockdev support we will need to introspect whether any of the
backing chain members requires PR rather just one of them. Add a helper
and reuse it in virDomainDefHasManagedPR.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 38754592
......@@ -29946,7 +29946,7 @@ virDomainDefHasManagedPR(const virDomainDef *def)
size_t i;
for (i = 0; i < def->ndisks; i++) {
if (virStoragePRDefIsManaged(def->disks[i]->src->pr))
if (virStorageSourceChainHasManagedPR(def->disks[i]->src))
return true;
}
......
......@@ -2815,6 +2815,7 @@ virStoragePRDefIsEqual;
virStoragePRDefIsManaged;
virStoragePRDefParseXML;
virStorageSourceBackingStoreClear;
virStorageSourceChainHasManagedPR;
virStorageSourceClear;
virStorageSourceCopy;
virStorageSourceFindByNodeName;
......
......@@ -2025,6 +2025,20 @@ virStoragePRDefIsManaged(virStoragePRDefPtr prd)
}
bool
virStorageSourceChainHasManagedPR(virStorageSourcePtr src)
{
virStorageSourcePtr n;
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
if (virStoragePRDefIsManaged(src->pr))
return true;
}
return false;
}
virSecurityDeviceLabelDefPtr
virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
const char *model)
......
......@@ -400,6 +400,9 @@ bool virStoragePRDefIsEqual(virStoragePRDefPtr a,
virStoragePRDefPtr b);
bool virStoragePRDefIsManaged(virStoragePRDefPtr prd);
bool
virStorageSourceChainHasManagedPR(virStorageSourcePtr src);
virSecurityDeviceLabelDefPtr
virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
const char *model);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册