When hot-plug/cold-plug a memory device, we use
memcmp() function to check if there is a memory device
have the same address with the memory device we want
hot-pluged. But qemu forbid use/hot-plug 2 memory device
with same slot *or* the same base(qemu side this elemnt
named addr).
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e57425..413f839 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3089,7 +3089,10 @@ virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a,
break;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
- if (memcmp(&a->addr.dimm, &b->addr.dimm, sizeof(a->addr.dimm)))
+ if (a->addr.dimm.slot != b->addr.dimm.slot &&
+ (a->addr.dimm.base == 0 ||
+ b->addr.dimm.base == 0 ||
+ a->addr.dimm.base != b->addr.dimm.base))
return false;
break;
}
--
1.8.3.1