提交 3921d135 编写于 作者: L Luyao Huang 提交者: Peter Krempa

qemu: Add helper to assign RNG device aliases

This function is used to assign an alias for a RNG device. It will be
later reused when hotplugging RNGs.
Signed-off-by: NLuyao Huang <lhuang@redhat.com>
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 c88b323b
......@@ -1030,6 +1030,17 @@ qemuGetNextChrDevIndex(virDomainDefPtr def,
}
int
qemuAssignDeviceRNGAlias(virDomainRNGDefPtr rng,
size_t idx)
{
if (virAsprintf(&rng->info.alias, "rng%zu", idx) < 0)
return -1;
return 0;
}
int
qemuAssignDeviceChrAlias(virDomainDefPtr def,
virDomainChrDefPtr chr,
......@@ -1155,7 +1166,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
return -1;
}
for (i = 0; i < def->nrngs; i++) {
if (virAsprintf(&def->rngs[i]->info.alias, "rng%zu", i) < 0)
if (qemuAssignDeviceRNGAlias(def->rngs[i], i) < 0)
return -1;
}
if (def->tpm) {
......
......@@ -269,6 +269,7 @@ int qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr r
int qemuAssignDeviceChrAlias(virDomainDefPtr def,
virDomainChrDefPtr chr,
ssize_t idx);
int qemuAssignDeviceRNGAlias(virDomainRNGDefPtr rng, size_t idx);
int
qemuParseKeywords(const char *str,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册