s390/stattrib: Add Error** argument to set_migrationmode() handler

This will prepare ground for future changes adding an Error** argument
to the save_setup() handler. We need to make sure that on failure,
set_migrationmode() always sets a new error. See the Rules section in
qapi/error.h.

Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Thomas Huth <thuth@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/r/20240320064911.545001-2-clg@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Cédric Le Goater 2024-03-20 07:48:57 +01:00 committed by Peter Xu
parent fe3ba17b33
commit e86f243487
3 changed files with 21 additions and 8 deletions

View file

@ -17,6 +17,7 @@
#include "sysemu/kvm.h"
#include "exec/ram_addr.h"
#include "kvm/kvm_s390x.h"
#include "qapi/error.h"
Object *kvm_s390_stattrib_create(void)
{
@ -137,14 +138,21 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
}
}
static int kvm_s390_stattrib_set_migrationmode(S390StAttribState *sa, bool val)
static int kvm_s390_stattrib_set_migrationmode(S390StAttribState *sa, bool val,
Error **errp)
{
struct kvm_device_attr attr = {
.group = KVM_S390_VM_MIGRATION,
.attr = val,
.addr = 0,
};
return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
int r;
r = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
if (r) {
error_setg_errno(errp, -r, "setting KVM_S390_VM_MIGRATION failed");
}
return r;
}
static long long kvm_s390_stattrib_get_dirtycount(S390StAttribState *sa)