[libvirt] [PATCHv2.5 08/10] qemu: conf: Add support for memory device cold(un)plug

John Ferlan jferlan at redhat.com
Fri Mar 13 23:53:46 UTC 2015


>> +
>> +int
>> +virDomainMemoryInsert(virDomainDefPtr def,
>> +                      virDomainMemoryDefPtr mem)
>> +{
>> +    int id = def->nmems;
>> +
>> +    if (mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
>> +        virDomainDefHasDeviceAddress(def, &mem->info)) {
> 
> Hmm... so if our incoming mem has an address defined - it could be
> anything - we're just failing declaring that the domain already contains
> a device with the same address? Doesn't seem right.
> 
> And again - we have this problem of TYPE_NONE, TYPE_DIMM, TYPE_LAST and
> who knows what in the future.
> 
> 

Perhaps I was thinking too much about the various Find* API's when I
first read this, but upon further reflection and looking at the code
paths using it I see what the goal is. So safely ignore this particular
comment.

John
>> +        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> +                       _("Domain already contains a device with the same "
>> +                         "address"));
>> +        return -1;
>> +    }
>> +
>> +    if (VIR_APPEND_ELEMENT(def->mems, def->nmems, mem) < 0)
>> +        return -1;
>> +
>> +    return id;
>> +}
>> +




More information about the libvir-list mailing list