mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator
When editing a domain with hotplug enabled, I removed the only NUMA node it had and got no error. I got the error later though, when starting the domain. This is not as user friendly as it can be. Move the validation call out from command line generator and into domain validator (which is called prior to starting cmd line generation anyway). When doing this, I had to remove memory-hotplug-nonuma xml2xml test case because there is no way the test case can succeed, obviously. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
50410baa83
commit
fc19155819
@ -7123,9 +7123,6 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
virCommandAddArg(cmd, "-m");
|
||||
|
||||
if (virDomainDefHasMemoryHotplug(def)) {
|
||||
|
@ -8468,6 +8468,8 @@ qemuCheckMemoryDimmConflict(const virDomainDef *def,
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem,
|
||||
const virDomainDef *def)
|
||||
|
@ -916,6 +916,9 @@ qemuValidateDomainDef(const virDomainDef *def,
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuValidateDomainDefClockTimers(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -2931,7 +2931,7 @@ mymain(void)
|
||||
DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM);
|
||||
|
||||
DO_TEST_FAILURE("memory-align-fail", NONE);
|
||||
DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
|
||||
DO_TEST_PARSE_ERROR("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
|
||||
DO_TEST("memory-hotplug", NONE);
|
||||
DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
|
||||
DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
|
||||
|
@ -1,28 +0,0 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<maxMemory slots='9' unit='KiB'>1233456789</maxMemory>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-i386</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='virtio'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
</domain>
|
@ -303,18 +303,21 @@ mymain(void)
|
||||
|
||||
DO_TEST("pages-discard", NONE);
|
||||
DO_TEST("pages-discard-hugepages", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("pages-dimm-discard", NONE);
|
||||
DO_TEST("pages-dimm-discard", QEMU_CAPS_DEVICE_PC_DIMM);
|
||||
DO_TEST("hugepages-default", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-default-system-size", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-nodeset-part", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-memaccess", QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-memaccess2", QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-nvdimm", QEMU_CAPS_DEVICE_NVDIMM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("nosharepages", NONE);
|
||||
@ -1260,8 +1263,7 @@ mymain(void)
|
||||
DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
|
||||
|
||||
DO_TEST("memory-hotplug", NONE);
|
||||
DO_TEST("memory-hotplug-nonuma", NONE);
|
||||
DO_TEST("memory-hotplug-dimm", NONE);
|
||||
DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-label", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
|
Loading…
x
Reference in New Issue
Block a user