s390x/flic: fail migration on source already
Current code puts a 'FLIC_FAILED' marker into the migration stream to indicate something went wrong while saving flic state and fails load if it encounters that marker. VMState's put routine recently gained the ability to return error codes (but did not wire it up yet). In order to be able to reap the benefits of returning an error and failing migration on the source already once this gets wired up in core, return an error in addition to storing 'FLIC_FAILED'. Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
This commit is contained in:
parent
409422cd83
commit
ba690c7171
|
@ -293,6 +293,7 @@ static int kvm_flic_save(QEMUFile *f, void *opaque, size_t size,
|
||||||
int len = FLIC_SAVE_INITIAL_SIZE;
|
int len = FLIC_SAVE_INITIAL_SIZE;
|
||||||
void *buf;
|
void *buf;
|
||||||
int count;
|
int count;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
flic_disable_wait_pfault((struct KVMS390FLICState *) opaque);
|
flic_disable_wait_pfault((struct KVMS390FLICState *) opaque);
|
||||||
|
|
||||||
|
@ -303,7 +304,7 @@ static int kvm_flic_save(QEMUFile *f, void *opaque, size_t size,
|
||||||
* migration state */
|
* migration state */
|
||||||
error_report("flic: couldn't allocate memory");
|
error_report("flic: couldn't allocate memory");
|
||||||
qemu_put_be64(f, FLIC_FAILED);
|
qemu_put_be64(f, FLIC_FAILED);
|
||||||
return 0;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = __get_all_irqs(flic, &buf, len);
|
count = __get_all_irqs(flic, &buf, len);
|
||||||
|
@ -314,6 +315,7 @@ static int kvm_flic_save(QEMUFile *f, void *opaque, size_t size,
|
||||||
* target system to fail when attempting to load irqs from the
|
* target system to fail when attempting to load irqs from the
|
||||||
* migration state */
|
* migration state */
|
||||||
qemu_put_be64(f, FLIC_FAILED);
|
qemu_put_be64(f, FLIC_FAILED);
|
||||||
|
r = count;
|
||||||
} else {
|
} else {
|
||||||
qemu_put_be64(f, count);
|
qemu_put_be64(f, count);
|
||||||
qemu_put_buffer(f, (uint8_t *) buf,
|
qemu_put_buffer(f, (uint8_t *) buf,
|
||||||
|
@ -321,7 +323,7 @@ static int kvm_flic_save(QEMUFile *f, void *opaque, size_t size,
|
||||||
}
|
}
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
|
|
||||||
return 0;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue