migration: move skip_section_footers

Move it into MigrationState, revert its meaning and renaming it to
send_section_footer, with a property bound to it. Same trick is played
like previous patches.

Removing savevm_skip_section_footers().

Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1498536619-14548-9-git-send-email-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Peter Xu 2017-06-27 12:10:17 +08:00 committed by Juan Quintela
parent 71dd4c1a56
commit 15c3850325
8 changed files with 15 additions and 15 deletions

View File

@ -314,7 +314,6 @@ static void pc_init1(MachineState *machine,
static void pc_compat_2_3(MachineState *machine) static void pc_compat_2_3(MachineState *machine)
{ {
PCMachineState *pcms = PC_MACHINE(machine); PCMachineState *pcms = PC_MACHINE(machine);
savevm_skip_section_footers();
if (kvm_enabled()) { if (kvm_enabled()) {
pcms->smm = ON_OFF_AUTO_OFF; pcms->smm = ON_OFF_AUTO_OFF;
} }

View File

@ -3580,7 +3580,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
static void spapr_machine_2_3_instance_options(MachineState *machine) static void spapr_machine_2_3_instance_options(MachineState *machine)
{ {
spapr_machine_2_4_instance_options(machine); spapr_machine_2_4_instance_options(machine);
savevm_skip_section_footers();
} }
static void spapr_machine_2_3_class_options(MachineClass *mc) static void spapr_machine_2_3_class_options(MachineClass *mc)

View File

@ -138,9 +138,6 @@ static int xen_init(MachineState *ms)
return -1; return -1;
} }
qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
savevm_skip_section_footers();
return 0; return 0;
} }
@ -155,6 +152,11 @@ static GlobalProperty xen_compat_props[] = {
.property = "send-configuration", .property = "send-configuration",
.value = "off", .value = "off",
}, },
{
.driver = "migration",
.property = "send-section-footer",
.value = "off",
},
{ /* end of list */ }, { /* end of list */ },
}; };

View File

@ -185,6 +185,10 @@
.driver = "migration",\ .driver = "migration",\
.property = "send-configuration",\ .property = "send-configuration",\
.value = "off",\ .value = "off",\
},{\
.driver = "migration",\
.property = "send-section-footer",\
.value = "off",\
},{\ },{\
.driver = "migration",\ .driver = "migration",\
.property = "store-global-state",\ .property = "store-global-state",\

View File

@ -41,7 +41,6 @@ int64_t self_announce_delay(int round)
/* migration/savevm.c */ /* migration/savevm.c */
void dump_vmstate_json_to_file(FILE *out_fp); void dump_vmstate_json_to_file(FILE *out_fp);
void savevm_skip_section_footers(void);
/* migration/migration.c */ /* migration/migration.c */
void migration_object_init(void); void migration_object_init(void);

View File

@ -1987,6 +1987,8 @@ static Property migration_properties[] = {
DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, false), DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, false),
DEFINE_PROP_BOOL("send-configuration", MigrationState, DEFINE_PROP_BOOL("send-configuration", MigrationState,
send_configuration, true), send_configuration, true),
DEFINE_PROP_BOOL("send-section-footer", MigrationState,
send_section_footer, true),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -145,6 +145,8 @@ struct MigrationState
/* Whether we send QEMU_VM_CONFIGURATION during migration */ /* Whether we send QEMU_VM_CONFIGURATION during migration */
bool send_configuration; bool send_configuration;
/* Whether we send section footer during migration */
bool send_section_footer;
}; };
void migrate_set_state(int *state, int old_state, int new_state); void migrate_set_state(int *state, int old_state, int new_state);

View File

@ -62,8 +62,6 @@
const unsigned int postcopy_ram_discard_version = 0; const unsigned int postcopy_ram_discard_version = 0;
static bool skip_section_footers;
/* Subcommands for QEMU_VM_COMMAND */ /* Subcommands for QEMU_VM_COMMAND */
enum qemu_vm_cmd { enum qemu_vm_cmd {
MIG_CMD_INVALID = 0, /* Must be 0 */ MIG_CMD_INVALID = 0, /* Must be 0 */
@ -761,11 +759,6 @@ static void vmstate_save(QEMUFile *f, SaveStateEntry *se, QJSON *vmdesc)
vmstate_save_state(f, se->vmsd, se->opaque, vmdesc); vmstate_save_state(f, se->vmsd, se->opaque, vmdesc);
} }
void savevm_skip_section_footers(void)
{
skip_section_footers = true;
}
/* /*
* Write the header for device section (QEMU_VM_SECTION START/END/PART/FULL) * Write the header for device section (QEMU_VM_SECTION START/END/PART/FULL)
*/ */
@ -793,7 +786,7 @@ static void save_section_header(QEMUFile *f, SaveStateEntry *se,
*/ */
static void save_section_footer(QEMUFile *f, SaveStateEntry *se) static void save_section_footer(QEMUFile *f, SaveStateEntry *se)
{ {
if (!skip_section_footers) { if (migrate_get_current()->send_section_footer) {
qemu_put_byte(f, QEMU_VM_SECTION_FOOTER); qemu_put_byte(f, QEMU_VM_SECTION_FOOTER);
qemu_put_be32(f, se->section_id); qemu_put_be32(f, se->section_id);
} }
@ -1802,7 +1795,7 @@ static bool check_section_footer(QEMUFile *f, SaveStateEntry *se)
uint8_t read_mark; uint8_t read_mark;
uint32_t read_section_id; uint32_t read_section_id;
if (skip_section_footers) { if (!migrate_get_current()->send_section_footer) {
/* No footer to check */ /* No footer to check */
return true; return true;
} }