mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
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: Luyao Huang <lhuang@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
c88b323bf5
commit
3921d13581
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user