The alignment of the mem object in qemuDomainDetachPrepMemory()
allows for the virDomainMemoryFindByDef() call to find the
right memory object for detach.
Turns out that, after recent changes, the alignment of the mem
object is already granted at this point. This function is used by
qemuDomainDetachDeviceLive(), which in turn is used in two
places with a memory device:
- qemuDomainDetachDeviceLiveAndConfig(), after a virDomainDeviceDefParse()
calll that will align the mem object via PostParse callbacks;
- qemuDomainDetachDeviceAliasLiveAndConfig(), after a call to
virDomainDefFindDevice() that will get the already aligned mem object
from the domain definition.
This means that the qemuDomainMemoryDeviceAlignSize() call at the
start of this function is now obsolete and can be removed.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_hotplug.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c1461ac621..e0495ef59e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5682,9 +5682,9 @@ qemuDomainDetachPrepMemory(virDomainObjPtr vm,
{
int idx;
- if (qemuDomainMemoryDeviceAlignSize(vm->def, match) < 0)
- return -1;
-
+ /* 'match' is granted to be aligned at this point, either
+ * by PostParse callbacks when parsing it or by fetching it
+ * from the domain definition. */
if ((idx = virDomainMemoryFindByDef(vm->def, match)) < 0) {
virReportError(VIR_ERR_DEVICE_MISSING,
_("model '%s' memory device not present "
--
2.26.2