diff options
-rw-r--r-- | accel/accel.c | 3 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 1 | ||||
-rw-r--r-- | migration/migration.c | 11 | ||||
-rw-r--r-- | migration/migration.h | 3 | ||||
-rw-r--r-- | migration/savevm.c | 2 | ||||
-rw-r--r-- | qapi/migration.json | 6 | ||||
-rw-r--r-- | vl.c | 45 |
7 files changed, 44 insertions, 27 deletions
diff --git a/accel/accel.c b/accel/accel.c index 8deb475b5d..454fef9d92 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -65,8 +65,9 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms) ms->accelerator = NULL; *(acc->allowed) = false; object_unref(OBJECT(accel)); + } else { + object_set_accelerator_compat_props(acc->compat_props); } - object_set_accelerator_compat_props(acc->compat_props); return ret; } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 6065d9e420..5f133cae83 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -14,6 +14,7 @@ /* vl.c */ extern const char *bios_name; +extern int only_migratable; extern const char *qemu_name; extern QemuUUID qemu_uuid; extern bool qemu_uuid_set; diff --git a/migration/migration.c b/migration/migration.c index 69f75124c9..609e0df5d0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1646,7 +1646,11 @@ bool migration_in_postcopy_after_devices(MigrationState *s) bool migration_is_idle(void) { - MigrationState *s = migrate_get_current(); + MigrationState *s = current_migration; + + if (!s) { + return true; + } switch (s->state) { case MIGRATION_STATUS_NONE: @@ -1707,7 +1711,7 @@ static GSList *migration_blockers; int migrate_add_blocker(Error *reason, Error **errp) { - if (migrate_get_current()->only_migratable) { + if (only_migratable) { error_propagate_prepend(errp, error_copy(reason), "disallowing migration blocker " "(--only_migratable) for: "); @@ -3337,7 +3341,7 @@ void migration_global_dump(Monitor *mon) monitor_printf(mon, "store-global-state: %s\n", ms->store_global_state ? "on" : "off"); monitor_printf(mon, "only-migratable: %s\n", - ms->only_migratable ? "on" : "off"); + only_migratable ? "on" : "off"); monitor_printf(mon, "send-configuration: %s\n", ms->send_configuration ? "on" : "off"); monitor_printf(mon, "send-section-footer: %s\n", @@ -3352,7 +3356,6 @@ void migration_global_dump(Monitor *mon) static Property migration_properties[] = { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), - DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, false), DEFINE_PROP_BOOL("send-configuration", MigrationState, send_configuration, true), DEFINE_PROP_BOOL("send-section-footer", MigrationState, diff --git a/migration/migration.h b/migration/migration.h index 0f986935e1..438f17edad 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -219,9 +219,6 @@ struct MigrationState */ bool store_global_state; - /* Whether the VM is only allowing for migratable devices */ - bool only_migratable; - /* Whether we send QEMU_VM_CONFIGURATION during migration */ bool send_configuration; /* Whether we send section footer during migration */ diff --git a/migration/savevm.c b/migration/savevm.c index 1415001d1c..34bcad3807 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2844,7 +2844,7 @@ void vmstate_register_ram_global(MemoryRegion *mr) bool vmstate_check_only_migratable(const VMStateDescription *vmsd) { /* check needed if --only-migratable is specified */ - if (!migrate_get_current()->only_migratable) { + if (!only_migratable) { return true; } diff --git a/qapi/migration.json b/qapi/migration.json index cfde29acf8..9cfbaf8c6c 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1380,16 +1380,16 @@ # @mode: COLO running mode. If COLO is running, this field will return # 'primary' or 'secondary'. # -# @last_mode: COLO last running mode. If COLO is running, this field +# @last-mode: COLO last running mode. If COLO is running, this field # will return same like mode field, after failover we can -# use this field to get last colo mode. (since 4.1) +# use this field to get last colo mode. (since 4.0) # # @reason: describes the reason for the COLO exit. # # Since: 3.1 ## { 'struct': 'COLOStatus', - 'data': { 'mode': 'COLOMode', 'last_mode': 'COLOMode', + 'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode', 'reason': 'COLOExitReason' } } ## @@ -185,6 +185,7 @@ const char *prom_envs[MAX_PROM_ENVS]; int boot_menu; bool boot_strict; uint8_t *boot_splash_filedata; +int only_migratable; /* turn it off unless user states otherwise */ bool wakeup_suspend_enabled; int icount_align_option; @@ -3119,6 +3120,7 @@ int main(int argc, char **argv, char **envp) if (optind >= argc) break; if (argv[optind][0] != '-') { + loc_set_cmdline(argv, optind, 1); drive_add(IF_DEFAULT, 0, argv[optind++], HD_OPTS); } else { const QEMUOption *popt; @@ -3799,13 +3801,7 @@ int main(int argc, char **argv, char **envp) incoming = optarg; break; case QEMU_OPTION_only_migratable: - /* - * TODO: we can remove this option one day, and we - * should all use: - * - * "-global migration.only-migratable=true" - */ - qemu_global_option("migration.only-migratable=true"); + only_migratable = 1; break; case QEMU_OPTION_nodefaults: has_defaults = 0; @@ -4277,16 +4273,9 @@ int main(int argc, char **argv, char **envp) } /* - * Migration object can only be created after global properties - * are applied correctly. - */ - migration_object_init(); - - /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to - * them, and after migration_object_init(), so we can create - * migration blockers. + * them. */ configure_blockdev(&bdo_queue, machine_class, snapshot); @@ -4297,13 +4286,39 @@ int main(int argc, char **argv, char **envp) current_machine->maxram_size = maxram_size; current_machine->ram_slots = ram_slots; + /* + * Note: uses machine properties such as kernel-irqchip, must run + * after machine_set_property(). + */ configure_accelerator(current_machine, argv[0]); + /* + * Beware, QOM objects created before this point miss global and + * compat properties. + * + * Global properties get set up by qdev_prop_register_global(), + * called from user_register_global_props(), and certain option + * desugaring. Also in CPU feature desugaring (buried in + * parse_cpu_model()), which happens below this point, but may + * only target the CPU type, which can only be created after + * parse_cpu_model() returned the type. + * + * Machine compat properties: object_set_machine_compat_props(). + * Accelerator compat props: object_set_accelerator_compat_props(), + * called from configure_accelerator(). + */ + if (!qtest_enabled() && machine_class->deprecation_reason) { error_report("Machine type '%s' is deprecated: %s", machine_class->name, machine_class->deprecation_reason); } + /* + * Note: creates a QOM object, must run only after global and + * compat properties have been set up. + */ + migration_object_init(); + if (qtest_chrdev) { qtest_init(qtest_chrdev, qtest_log, &error_fatal); } |