[libvirt] [PATCH] conf: improve the address check for dimm type

lhuang lhuang at redhat.com
Wed May 27 07:10:04 UTC 2015


On 05/27/2015 03:03 PM, Peter Krempa wrote:
> On Wed, May 27, 2015 at 14:39:58 +0800, Luyao Huang wrote:
>> 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 at 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;
> This function is designed to check if the address is equal not if it is
> not conflicting for a particular hypervisor.
>
> If you are going to enforce that both the address and base are
> different, this function is not the right place.

Okay, reasonable to me, i will found a place for the dimm address check 
in src/qemu/*

Thanks you advise and quick review.

>
> Peter

Luyao




More information about the libvir-list mailing list