For device hotplug, the new alias ID needs to be checked in the list
rather than using the count of devices. Unplugging a device that is not
last in the array will make further hotplug impossible due to alias
collision.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1324551
---
src/qemu/qemu_alias.c | 20 ++++++++++++++++++--
src/qemu/qemu_alias.h | 3 ++-
src/qemu/qemu_hotplug.c | 2 +-
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 010d6b9..052a829 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -382,9 +382,25 @@ qemuAssignDeviceRedirdevAlias(virDomainDefPtr def,
int
-qemuAssignDeviceRNGAlias(virDomainRNGDefPtr rng,
+qemuAssignDeviceRNGAlias(virDomainDefPtr def,
+ virDomainRNGDefPtr rng,
size_t idx)
{
+ if (idx == -1) {
+ size_t i;
+ idx = 0;
+ for (i = 0; i < def->nrngs; i++) {
+ int thisidx;
+ if ((thisidx = qemuDomainDeviceAliasIndex(&def->rngs[i]->info,
"rng")) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine device index for rng
device"));
+ return -1;
For net and hostdev alias this was updated by recent commit 8f74f527 to ignore
that fact and just continue with next device. This error isn't required since we
are trying only to create a non-collision alias matching 'rng[0-9]+'.
ACK with that fixed.
Pavle