mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virDomainMemoryDefValidate: Skip the same device on validation on memory device update
In my recent commit of v9.8.0-rc1~7 I've introduced validation
wrt other memory devices. And mostly works, except when doing
memory device update ('virsh update-memory-device') because then
@mem is just parsed <memory/> device XML and thus its pointer is
not in the vm->def->mem, yet. Thus my algorithm which skips over
the same entry fails. Fortunately, we require full device XML on
device update and thus we can use device address and aliases to
detect duplicity.
Fixes: 3fd64fb0e2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8eb09a2bb9
commit
0c5f37364f
@ -2387,6 +2387,21 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
|
|||||||
if (other == mem)
|
if (other == mem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* In case we're updating an existing memory device (e.g. virtio-mem),
|
||||||
|
* then pointers will be different. But addresses and aliases are the
|
||||||
|
* same. However, STREQ_NULLABLE() returns true if both strings are
|
||||||
|
* NULL which is not what we want. */
|
||||||
|
if (virDomainDeviceInfoAddressIsEqual(&other->info,
|
||||||
|
&mem->info)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mem->info.alias &&
|
||||||
|
STREQ_NULLABLE(other->info.alias,
|
||||||
|
mem->info.alias)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (other->model) {
|
switch (other->model) {
|
||||||
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
||||||
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
|
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
|
||||||
|
Loading…
Reference in New Issue
Block a user