diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 2ee1829c8e..0c1689b57f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -232,6 +232,9 @@ struct _qemuDomainObjPrivate { /* private XML) - need to restore at process reconnect */ uint8_t *masterKey; size_t masterKeyLen; + + /* note whether memory device alias does not correspond to slot number */ + bool memAliasOrderMismatch; }; # define QEMU_DOMAIN_PRIVATE(vm) \ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1b67aee727..09b2a72b53 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3205,6 +3205,29 @@ qemuDomainPerfRestart(virDomainObjPtr vm) return 0; } + +static void +qemuProcessReconnectCheckMemAliasOrderMismatch(virDomainObjPtr vm) +{ + size_t i; + int aliasidx; + virDomainDefPtr def = vm->def; + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!virDomainDefHasMemoryHotplug(def) || def->nmems == 0) + return; + + for (i = 0; i < def->nmems; i++) { + aliasidx = qemuDomainDeviceAliasIndex(&def->mems[i]->info, "dimm"); + + if (def->mems[i]->info.addr.dimm.slot != aliasidx) { + priv->memAliasOrderMismatch = true; + break; + } + } +} + + struct qemuProcessReconnectData { virConnectPtr conn; virQEMUDriverPtr driver; @@ -3389,6 +3412,8 @@ qemuProcessReconnect(void *opaque) if (qemuProcessUpdateDevices(driver, obj) < 0) goto error; + qemuProcessReconnectCheckMemAliasOrderMismatch(obj); + /* Failure to connect to agent shouldn't be fatal */ if ((ret = qemuConnectAgent(driver, obj)) < 0) { if (ret == -2)