Put it into MigrationState then we can use the properties to specify
whether to enable storing global state.
Removing global_state_set_optional() since now we can use HW_COMPAT_2_3
for x86/power, and AccelClass.global_props for Xen.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <
1498536619-14548-6-git-send-email-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
if (kvm_enabled()) {
pcms->smm = ON_OFF_AUTO_OFF;
}
- global_state_set_optional();
savevm_skip_configuration();
}
{
spapr_machine_2_4_instance_options(machine);
savevm_skip_section_footers();
- global_state_set_optional();
savevm_skip_configuration();
}
}
qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
- global_state_set_optional();
savevm_skip_configuration();
savevm_skip_section_footers();
return 0;
}
+static GlobalProperty xen_compat_props[] = {
+ {
+ .driver = "migration",
+ .property = "store-global-state",
+ .value = "off",
+ },
+ { /* end of list */ },
+};
+
static void xen_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
ac->name = "Xen";
ac->init_machine = xen_init;
ac->allowed = &xen_allowed;
+ ac->global_props = xen_compat_props;
}
#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
.driver = TYPE_PCI_DEVICE,\
.property = "x-pcie-lnksta-dllla",\
.value = "off",\
+ },{\
+ .driver = "migration",\
+ .property = "store-global-state",\
+ .value = "off",\
},
#define HW_COMPAT_2_2 \
#include "sysemu/sysemu.h"
void register_global_state(void);
-void global_state_set_optional(void);
int global_state_store(void);
void global_state_store_running(void);
bool global_state_received(void);
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/util.h"
+#include "migration.h"
#include "migration/global_state.h"
#include "migration/vmstate.h"
#include "trace.h"
typedef struct {
- bool optional;
uint32_t size;
uint8_t runstate[100];
RunState state;
return global_state.state;
}
-void global_state_set_optional(void)
-{
- global_state.optional = true;
-}
-
static bool global_state_needed(void *opaque)
{
GlobalState *s = opaque;
/* If it is not optional, it is mandatory */
- if (s->optional == false) {
+ if (migrate_get_current()->store_global_state) {
return true;
}
s->migration_thread_running = true;
}
+static Property migration_properties[] = {
+ DEFINE_PROP_BOOL("store-global-state", MigrationState,
+ store_global_state, true),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void migration_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->user_creatable = false;
+ dc->props = migration_properties;
}
static void migration_instance_init(Object *obj)
/* Do we have to clean up -b/-i from old migrate parameters */
/* This feature is deprecated and will be removed */
bool must_remove_block_options;
+
+ /*
+ * Global switch on whether we need to store the global state
+ * during migration.
+ */
+ bool store_global_state;
};
void migrate_set_state(int *state, int old_state, int new_state);