@@ -312,6 +312,21 @@ static bool machine_get_suppress_vmdesc(Object *obj, Error **errp)
return ms->suppress_vmdesc;
}
+static void machine_set_require_config_section(Object *obj, bool value,
+ Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ ms->require_config_section = value;
+}
+
+static bool machine_get_require_config_section(Object *obj, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ return ms->require_config_section;
+}
+
static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
{
error_report("Option '-device %s' cannot be handled by this machine",
@@ -365,6 +380,7 @@ static void machine_initfn(Object *obj)
ms->kvm_shadow_mem = -1;
ms->dump_guest_core = true;
ms->mem_merge = true;
+ ms->require_config_section = true;
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
@@ -467,6 +483,12 @@ static void machine_initfn(Object *obj)
object_property_set_description(obj, "suppress-vmdesc",
"Set on to disable self-describing migration",
NULL);
+ object_property_add_bool(obj, "require-config-section",
+ machine_get_require_config_section,
+ machine_set_require_config_section, NULL);
+ object_property_set_description(obj, "require-config-section",
+ "Set on/off to reject/accept migration without configuration section",
+ NULL);
/* Register notifier when init is done for sysbus sanity checks */
ms->sysbus_notifier.notify = machine_init_notify;
@@ -128,6 +128,7 @@ struct MachineState {
char *firmware;
bool iommu;
bool suppress_vmdesc;
+ bool require_config_section;
ram_addr_t ram_size;
ram_addr_t maxram_size;
@@ -1847,6 +1847,12 @@ static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
return 0;
}
+static bool must_receive_configuration(void)
+{
+ MachineState *machine = MACHINE(qdev_get_machine());
+ return machine->require_config_section;
+}
+
int qemu_loadvm_state(QEMUFile *f)
{
MigrationIncomingState *mis = migration_incoming_get_current();
@@ -1876,15 +1882,18 @@ int qemu_loadvm_state(QEMUFile *f)
}
if (!savevm_state.skip_configuration) {
- if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
+ if (qemu_peek_byte(f, 0) == QEMU_VM_CONFIGURATION) {
+ qemu_file_skip(f, 1);
+ ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state,
+ 0);
+
+ if (ret) {
+ return ret;
+ }
+ } else if (must_receive_configuration()) {
error_report("Configuration section missing");
return -EINVAL;
}
- ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
-
- if (ret) {
- return ret;
- }
}
ret = qemu_loadvm_state_main(f, mis);
@@ -43,7 +43,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
" aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
" dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
" suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
- " nvdimm=on|off controls NVDIMM support (default=off)\n",
+ " nvdimm=on|off controls NVDIMM support (default=off)\n"
+ " require-config-section=on|off incoming migration requires configuration section (default=on)\n",
QEMU_ARCH_ALL)
STEXI
@item -machine [type=]@var{name}[,prop=@var{value}[,...]]