Error reporting patches for 2021-08-26

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmEnsHESHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZTFAAP/0zO4CPElnMRjNEZcUaEldrW3aaOzB9b
 bcBIbZIe8VzM7elQIbvSYRjHDcMIFfLzSz3N1YmRbdbO5xUJ4bTJstVarrcdCo/X
 0DUjF1gDR8w+C2sc/1Bg8mbkY0tgC+GBv4QbfU7uZXEr4FgDMxmPXRvv67rOqdCf
 Cd6AXK0Q0fMcNO//s/RaWosBdEu5kzR7RXvkmLbpBBIO69Jed1yRslfNxKoVhM/P
 v4cuhMXGxzmBVJizj4rASvJZvtqJJOVRVf+pbOsnPqxKIDUyh/LXz7eWWBINYf7i
 /CejSCGyZDQBOPMT3FmC4k6Q2GoYmTd3nlSfp9+oI494ciwHv/s6dGCA5rTgIohw
 I0GnT030osNWQvXNtIeiAzVBKSVjZtYgpdxe+kzkWw4HcueZLS/lPUC64cta4zoA
 DaHDTXFoTDtAkLqIfRUdpyCvtwvfc8f7EUW+qZMoHQ+vVLpAxy5JPEEwlKqo9m7E
 BB3ih8Dl13Kw9irU6JLaD1qGr/wHlgYHwJ2iA1C33M31+7viA9bPL7kgOoK7odkC
 aPBYcV+huzpk8o6UYj4Xh1a4su09YBqywCuJQLXvoS0SEHef6GXDRunMa0aNSICc
 G5p0gFn4gKlO9orOsfoOBPa6JRCcypluOkPVMVFI2PVYCx2+tFFt+d9fVeXh2vGT
 Nf8yLL/ir4FX
 =ZVbi
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2021-08-26' into staging

Error reporting patches for 2021-08-26

# gpg: Signature made Thu 26 Aug 2021 16:17:05 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2021-08-26:
  vl: Clean up -smp error handling
  Remove superfluous ERRP_GUARD()
  vhost: Clean up how VhostOpts method vhost_backend_init() fails
  vhost: Clean up how VhostOpts method vhost_get_config() fails
  microvm: Drop dead error handling in microvm_machine_state_init()
  migration: Handle migration_incoming_setup() errors consistently
  migration: Unify failure check for migrate_add_blocker()
  whpx nvmm: Drop useless migrate_del_blocker()
  vfio: Avoid error_propagate() after migrate_add_blocker()
  i386: Never free migration blocker objects instead of sometimes
  vhost-scsi: Plug memory leak on migrate_add_blocker() failure
  multi-process: Fix pci_proxy_dev_realize() error handling
  spapr: Explain purpose of ->fwnmi_migration_blocker more clearly
  spapr: Plug memory leak when we can't add a migration blocker
  error: Use error_fatal to simplify obvious fatal errors (again)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-08-27 09:57:28 +01:00
commit 0289f62335
24 changed files with 67 additions and 152 deletions

View File

@ -492,8 +492,7 @@ static int tpm_emulator_block_migration(TPMEmulator *tpm_emu)
error_setg(&tpm_emu->migration_blocker,
"Migration disabled: TPM emulator does not support "
"migration");
migrate_add_blocker(tpm_emu->migration_blocker, &err);
if (err) {
if (migrate_add_blocker(tpm_emu->migration_blocker, &err) < 0) {
error_report_err(err);
error_free(tpm_emu->migration_blocker);
tpm_emu->migration_blocker = NULL;

View File

@ -458,15 +458,10 @@ static void microvm_machine_state_init(MachineState *machine)
{
MicrovmMachineState *mms = MICROVM_MACHINE(machine);
X86MachineState *x86ms = X86_MACHINE(machine);
Error *local_err = NULL;
microvm_memory_init(mms);
x86_cpus_init(x86ms, CPU_VERSION_LATEST);
if (local_err) {
error_report_err(local_err);
exit(1);
}
microvm_devices_init(mms);
}

View File

@ -872,7 +872,6 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
CPUState *cs = CPU(cpu);
int ret;
Error *local_err = NULL;
if (spapr->fwnmi_machine_check_addr == -1) {
/* Non-FWNMI case, deliver it like an architected CPU interrupt. */
@ -912,16 +911,17 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
}
}
ret = migrate_add_blocker(spapr->fwnmi_migration_blocker, &local_err);
/*
* Try to block migration while FWNMI is being handled, so the
* machine check handler runs where the information passed to it
* actually makes sense. This shouldn't actually block migration,
* only delay it slightly, assuming migration is retried. If the
* attempt to block fails, carry on. Unfortunately, it always
* fails when running with -only-migrate. A proper interface to
* delay migration completion for a bit could avoid that.
*/
ret = migrate_add_blocker(spapr->fwnmi_migration_blocker, NULL);
if (ret == -EBUSY) {
/*
* We don't want to abort so we let the migration to continue.
* In a rare case, the machine check handler will run on the target.
* Though this is not preferable, it is better than aborting
* the migration or killing the VM. It is okay to call
* migrate_del_blocker on a blocker that was not added (which the
* nmi-interlock handler would do when it's called after this).
*/
warn_report("Received a fwnmi while migration was in progress");
}

View File

@ -34,7 +34,6 @@
*/
bool mpqemu_msg_send(MPQemuMsg *msg, QIOChannel *ioc, Error **errp)
{
ERRP_GUARD();
bool iolock = qemu_mutex_iothread_locked();
bool iothread = qemu_in_iothread();
struct iovec send[2] = {};
@ -97,7 +96,6 @@ bool mpqemu_msg_send(MPQemuMsg *msg, QIOChannel *ioc, Error **errp)
static ssize_t mpqemu_read(QIOChannel *ioc, void *buf, size_t len, int **fds,
size_t *nfds, Error **errp)
{
ERRP_GUARD();
struct iovec iov = { .iov_base = buf, .iov_len = len };
bool iolock = qemu_mutex_iothread_locked();
bool iothread = qemu_in_iothread();
@ -192,7 +190,6 @@ fail:
uint64_t mpqemu_msg_send_and_await_reply(MPQemuMsg *msg, PCIProxyDev *pdev,
Error **errp)
{
ERRP_GUARD();
MPQemuMsg msg_reply = {0};
uint64_t ret = UINT64_MAX;

View File

@ -102,10 +102,18 @@ static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
}
dev->ioc = qio_channel_new_fd(fd, errp);
if (!dev->ioc) {
close(fd);
return;
}
error_setg(&dev->migration_blocker, "%s does not support migration",
TYPE_PCI_PROXY_DEV);
migrate_add_blocker(dev->migration_blocker, errp);
if (migrate_add_blocker(dev->migration_blocker, errp) < 0) {
error_free(dev->migration_blocker);
object_unref(dev->ioc);
return;
}
qemu_mutex_init(&dev->io_mutex);
qio_channel_set_blocking(dev->ioc, true, NULL);

View File

@ -711,7 +711,6 @@ int s390_ipl_pv_unpack(void)
void s390_ipl_prepare_cpu(S390CPU *cpu)
{
S390IPLState *ipl = get_ipl_device();
Error *err = NULL;
cpu->env.psw.addr = ipl->start_addr;
cpu->env.psw.mask = IPL_PSW_MASK;
@ -723,10 +722,7 @@ void s390_ipl_prepare_cpu(S390CPU *cpu)
}
}
if (ipl->netboot) {
if (load_netboot_image(&err) < 0) {
error_report_err(err);
exit(1);
}
load_netboot_image(&error_fatal);
ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr);
}
s390_ipl_set_boot_menu(ipl);

View File

@ -208,7 +208,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
"target SCSI device state or use shared storage over network), "
"set 'migratable' property to true to enable migration.");
if (migrate_add_blocker(vsc->migration_blocker, errp) < 0) {
error_free(vsc->migration_blocker);
goto free_virtio;
}
}
@ -233,11 +232,12 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
return;
free_vqs:
g_free(vsc->dev.vqs);
if (!vsc->migratable) {
migrate_del_blocker(vsc->migration_blocker);
}
g_free(vsc->dev.vqs);
free_virtio:
error_free(vsc->migration_blocker);
virtio_scsi_common_unrealize(dev);
close_fd:
close(vhostfd);

View File

@ -858,7 +858,6 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
{
VFIOContainer *container = vbasedev->group->container;
struct vfio_region_info *info = NULL;
Error *local_err = NULL;
int ret = -ENOTSUP;
if (!vbasedev->enable_migration || !container->dirty_pages_supported) {
@ -885,9 +884,8 @@ add_blocker:
"VFIO device doesn't support migration");
g_free(info);
ret = migrate_add_blocker(vbasedev->migration_blocker, &local_err);
if (local_err) {
error_propagate(errp, local_err);
ret = migrate_add_blocker(vbasedev->migration_blocker, errp);
if (ret < 0) {
error_free(vbasedev->migration_blocker);
vbasedev->migration_blocker = NULL;
}

View File

@ -1876,6 +1876,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
err = vhost_user_get_features(dev, &features);
if (err < 0) {
error_setg_errno(errp, -err, "vhost_backend_init failed");
return err;
}
@ -1885,6 +1886,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
err = vhost_user_get_u64(dev, VHOST_USER_GET_PROTOCOL_FEATURES,
&protocol_features);
if (err < 0) {
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
return -EPROTO;
}
@ -1903,6 +1905,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
err = vhost_user_set_protocol_features(dev, dev->protocol_features);
if (err < 0) {
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
return -EPROTO;
}
@ -1911,6 +1914,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
err = vhost_user_get_u64(dev, VHOST_USER_GET_QUEUE_NUM,
&dev->max_queues);
if (err < 0) {
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
return -EPROTO;
}
} else {
@ -1940,6 +1944,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
} else {
err = vhost_user_get_max_memslots(dev, &ram_slots);
if (err < 0) {
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
return -EPROTO;
}
@ -1966,6 +1971,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
if (dev->vq_index == 0) {
err = vhost_setup_slave_channel(dev);
if (err < 0) {
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
return -EPROTO;
}
}
@ -2139,10 +2145,12 @@ static int vhost_user_get_config(struct vhost_dev *dev, uint8_t *config,
msg.payload.config.offset = 0;
msg.payload.config.size = config_len;
if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
error_setg_errno(errp, EPROTO, "vhost_get_config failed");
return -EPROTO;
}
if (vhost_user_read(dev, &msg) < 0) {
error_setg_errno(errp, EPROTO, "vhost_get_config failed");
return -EPROTO;
}

View File

@ -1289,7 +1289,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
VhostBackendType backend_type, uint32_t busyloop_timeout,
Error **errp)
{
ERRP_GUARD();
uint64_t features;
int i, r, n_initialized_vqs = 0;
@ -1301,9 +1300,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
r = hdev->vhost_ops->vhost_backend_init(hdev, opaque, errp);
if (r < 0) {
if (!*errp) {
error_setg_errno(errp, -r, "vhost_backend_init failed");
}
goto fail;
}
@ -1372,7 +1368,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
if (hdev->migration_blocker != NULL) {
r = migrate_add_blocker(hdev->migration_blocker, errp);
if (*errp) {
if (r < 0) {
error_free(hdev->migration_blocker);
goto fail_busyloop;
}
@ -1564,17 +1560,11 @@ void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
int vhost_dev_get_config(struct vhost_dev *hdev, uint8_t *config,
uint32_t config_len, Error **errp)
{
ERRP_GUARD();
int ret;
assert(hdev->vhost_ops);
if (hdev->vhost_ops->vhost_get_config) {
ret = hdev->vhost_ops->vhost_get_config(hdev, config, config_len, errp);
if (ret < 0 && !*errp) {
error_setg_errno(errp, -ret, "vhost_get_config failed");
}
return ret;
return hdev->vhost_ops->vhost_get_config(hdev, config, config_len,
errp);
}
error_setg(errp, "vhost_get_config not implemented");

View File

@ -188,8 +188,6 @@ static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp)
void migration_object_init(void)
{
Error *err = NULL;
/* This can only be called once. */
assert(!current_migration);
current_migration = MIGRATION_OBJ(object_new(TYPE_MIGRATION));
@ -210,10 +208,7 @@ void migration_object_init(void)
qemu_mutex_init(&current_incoming->page_request_mutex);
current_incoming->page_requested = g_tree_new(page_request_addr_cmp);
if (!migration_object_check(current_migration, &err)) {
error_report_err(err);
exit(1);
}
migration_object_check(current_migration, &error_fatal);
blk_mig_init();
ram_mig_init();
@ -616,30 +611,25 @@ fail:
}
/**
* @migration_incoming_setup: Setup incoming migration
*
* Returns 0 for no error or 1 for error
*
* migration_incoming_setup: Setup incoming migration
* @f: file for main migration channel
* @errp: where to put errors
*
* Returns: %true on success, %false on error.
*/
static int migration_incoming_setup(QEMUFile *f, Error **errp)
static bool migration_incoming_setup(QEMUFile *f, Error **errp)
{
MigrationIncomingState *mis = migration_incoming_get_current();
Error *local_err = NULL;
if (multifd_load_setup(&local_err) != 0) {
/* We haven't been able to create multifd threads
nothing better to do */
error_report_err(local_err);
exit(EXIT_FAILURE);
if (multifd_load_setup(errp) != 0) {
return false;
}
if (!mis->from_src_file) {
mis->from_src_file = f;
}
qemu_file_set_blocking(f, false);
return 0;
return true;
}
void migration_incoming_process(void)
@ -682,14 +672,11 @@ static bool postcopy_try_recover(QEMUFile *f)
void migration_fd_process_incoming(QEMUFile *f, Error **errp)
{
Error *local_err = NULL;
if (postcopy_try_recover(f)) {
return;
}
if (migration_incoming_setup(f, &local_err)) {
error_propagate(errp, local_err);
if (!migration_incoming_setup(f, errp)) {
return;
}
migration_incoming_process();
@ -710,8 +697,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
return;
}
if (migration_incoming_setup(f, &local_err)) {
error_propagate(errp, local_err);
if (!migration_incoming_setup(f, errp)) {
return;
}

View File

@ -5350,7 +5350,6 @@ int main(int argc, char **argv)
{
const img_cmd_t *cmd;
const char *cmdname;
Error *local_error = NULL;
int c;
static const struct option long_options[] = {
{"help", no_argument, 0, 'h'},
@ -5368,10 +5367,7 @@ int main(int argc, char **argv)
module_call_init(MODULE_INIT_TRACE);
qemu_init_exec_dir(argv[0]);
if (qemu_init_main_loop(&local_error)) {
error_report_err(local_error);
exit(EXIT_FAILURE);
}
qemu_init_main_loop(&error_fatal);
qcrypto_init(&error_fatal);

View File

@ -529,7 +529,6 @@ int main(int argc, char **argv)
int flags = BDRV_O_UNMAP;
int ret;
bool writethrough = true;
Error *local_error = NULL;
QDict *opts = NULL;
const char *format = NULL;
bool force_share = false;
@ -629,10 +628,7 @@ int main(int argc, char **argv)
exit(1);
}
if (qemu_init_main_loop(&local_error)) {
error_report_err(local_error);
exit(1);
}
qemu_init_main_loop(&error_fatal);
if (!trace_init_backends()) {
exit(1);

View File

@ -963,10 +963,7 @@ int main(int argc, char **argv)
}
}
if (qemu_init_main_loop(&local_err)) {
error_report_err(local_err);
exit(EXIT_FAILURE);
}
qemu_init_main_loop(&error_fatal);
bdrv_init();
atexit(qemu_nbd_shutdown);

View File

@ -45,8 +45,6 @@ get_passwd_entry(const char *username, Error **errp)
g_autoptr(GError) err = NULL;
struct passwd *p;
ERRP_GUARD();
p = g_unix_get_passwd_entry_qemu(username, &err);
if (p == NULL) {
error_setg(errp, "failed to lookup user '%s': %s",
@ -61,8 +59,6 @@ static bool
mkdir_for_user(const char *path, const struct passwd *p,
mode_t mode, Error **errp)
{
ERRP_GUARD();
if (g_mkdir(path, mode) == -1) {
error_setg(errp, "failed to create directory '%s': %s",
path, g_strerror(errno));
@ -87,8 +83,6 @@ mkdir_for_user(const char *path, const struct passwd *p,
static bool
check_openssh_pub_key(const char *key, Error **errp)
{
ERRP_GUARD();
/* simple sanity-check, we may want more? */
if (!key || key[0] == '#' || strchr(key, '\n')) {
error_setg(errp, "invalid OpenSSH public key: '%s'", key);
@ -104,8 +98,6 @@ check_openssh_pub_keys(strList *keys, size_t *nkeys, Error **errp)
size_t n = 0;
strList *k;
ERRP_GUARD();
for (k = keys; k != NULL; k = k->next) {
if (!check_openssh_pub_key(k->value, errp)) {
return false;
@ -126,8 +118,6 @@ write_authkeys(const char *path, const GStrv keys,
g_autofree char *contents = NULL;
g_autoptr(GError) err = NULL;
ERRP_GUARD();
contents = g_strjoinv("\n", keys);
if (!g_file_set_contents(path, contents, -1, &err)) {
error_setg(errp, "failed to write to '%s': %s", path, err->message);
@ -155,8 +145,6 @@ read_authkeys(const char *path, Error **errp)
g_autoptr(GError) err = NULL;
g_autofree char *contents = NULL;
ERRP_GUARD();
if (!g_file_get_contents(path, &contents, NULL, &err)) {
error_setg(errp, "failed to read '%s': %s", path, err->message);
return NULL;
@ -178,7 +166,6 @@ qmp_guest_ssh_add_authorized_keys(const char *username, strList *keys,
strList *k;
size_t nkeys, nauthkeys;
ERRP_GUARD();
reset = has_reset && reset;
if (!check_openssh_pub_keys(keys, &nkeys, errp)) {
@ -228,8 +215,6 @@ qmp_guest_ssh_remove_authorized_keys(const char *username, strList *keys,
GStrv a;
size_t nkeys = 0;
ERRP_GUARD();
if (!check_openssh_pub_keys(keys, NULL, errp)) {
return;
}
@ -277,8 +262,6 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp)
g_autoptr(GuestAuthorizedKeys) ret = NULL;
int i;
ERRP_GUARD();
p = get_passwd_entry(username, errp);
if (p == NULL) {
return NULL;

View File

@ -976,7 +976,6 @@ out:
GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
{
ERRP_GUARD();
GuestDiskInfoList *ret = NULL;
HDEVINFO dev_info;
SP_DEVICE_INTERFACE_DATA dev_iface_data;

View File

@ -1044,10 +1044,7 @@ int main(int argc, char **argv)
}
}
if (qemu_init_main_loop(&local_err)) {
error_report_err(local_err);
exit(EXIT_FAILURE);
}
qemu_init_main_loop(&error_fatal);
server_watch = qio_channel_add_watch(QIO_CHANNEL(server_ioc),
G_IO_IN,
@ -1061,10 +1058,8 @@ int main(int argc, char **argv)
}
}
if ((daemonize || pidfile_specified) &&
!qemu_write_pidfile(pidfile, &local_err)) {
error_report_err(local_err);
exit(EXIT_FAILURE);
if (daemonize || pidfile_specified) {
qemu_write_pidfile(pidfile, &error_fatal);
}
#ifdef CONFIG_LIBCAP_NG

View File

@ -1550,20 +1550,17 @@ machine_merge_property(const char *propname, QDict *prop, Error **errp)
static void
machine_parse_property_opt(QemuOptsList *opts_list, const char *propname,
const char *arg, Error **errp)
const char *arg)
{
QDict *prop = NULL;
bool help = false;
prop = keyval_parse(arg, opts_list->implied_opt_name, &help, errp);
prop = keyval_parse(arg, opts_list->implied_opt_name, &help, &error_fatal);
if (help) {
qemu_opts_print_help(opts_list, true);
exit(0);
}
if (!prop) {
return;
}
machine_merge_property(propname, prop, errp);
machine_merge_property(propname, prop, &error_fatal);
qobject_unref(prop);
}
@ -2694,12 +2691,7 @@ void qmp_x_exit_preconfig(Error **errp)
qemu_machine_creation_done();
if (loadvm) {
Error *local_err = NULL;
if (!load_snapshot(loadvm, NULL, false, NULL, &local_err)) {
error_report_err(local_err);
autostart = 0;
exit(1);
}
load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
}
if (replay_mode != REPLAY_MODE_NONE) {
replay_vmstate_init();
@ -3348,7 +3340,8 @@ void qemu_init(int argc, char **argv, char **envp)
}
break;
case QEMU_OPTION_smp:
machine_parse_property_opt(qemu_find_opts("smp-opts"), "smp", optarg, &error_fatal);
machine_parse_property_opt(qemu_find_opts("smp-opts"),
"smp", optarg);
break;
case QEMU_OPTION_vnc:
vnc_parse(optarg);

View File

@ -1435,9 +1435,8 @@ static int hyperv_init_vcpu(X86CPU *cpu)
"'hv-passthrough' CPU flag prevents migration, use explicit"
" set of hv-* flags instead");
ret = migrate_add_blocker(hv_passthrough_mig_blocker, &local_err);
if (local_err) {
if (ret < 0) {
error_report_err(local_err);
error_free(hv_passthrough_mig_blocker);
return ret;
}
}
@ -1450,9 +1449,8 @@ static int hyperv_init_vcpu(X86CPU *cpu)
" make sure SMT is disabled and/or that vCPUs are properly"
" pinned)");
ret = migrate_add_blocker(hv_no_nonarch_cs_mig_blocker, &local_err);
if (local_err) {
if (ret < 0) {
error_report_err(local_err);
error_free(hv_no_nonarch_cs_mig_blocker);
return ret;
}
}
@ -1890,9 +1888,8 @@ int kvm_arch_init_vcpu(CPUState *cs)
"State blocked by non-migratable CPU device"
" (invtsc flag)");
r = migrate_add_blocker(invtsc_mig_blocker, &local_err);
if (local_err) {
if (r < 0) {
error_report_err(local_err);
error_free(invtsc_mig_blocker);
return r;
}
}

View File

@ -926,10 +926,8 @@ nvmm_init_vcpu(CPUState *cpu)
error_setg(&nvmm_migration_blocker,
"NVMM: Migration not supported");
(void)migrate_add_blocker(nvmm_migration_blocker, &local_error);
if (local_error) {
if (migrate_add_blocker(nvmm_migration_blocker, &local_error) < 0) {
error_report_err(local_error);
migrate_del_blocker(nvmm_migration_blocker);
error_free(nvmm_migration_blocker);
return -EINVAL;
}

View File

@ -737,7 +737,6 @@ static void
sev_launch_finish(SevGuestState *sev)
{
int ret, error;
Error *local_err = NULL;
trace_kvm_sev_launch_finish();
ret = sev_ioctl(sev->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error);
@ -752,12 +751,7 @@ sev_launch_finish(SevGuestState *sev)
/* add migration blocker */
error_setg(&sev_mig_blocker,
"SEV: Migration is not implemented");
ret = migrate_add_blocker(sev_mig_blocker, &local_err);
if (local_err) {
error_report_err(local_err);
error_free(sev_mig_blocker);
exit(1);
}
migrate_add_blocker(sev_mig_blocker, &error_fatal);
}
static void

View File

@ -1346,10 +1346,8 @@ int whpx_init_vcpu(CPUState *cpu)
"State blocked due to non-migratable CPUID feature support,"
"dirty memory tracking support, and XSAVE/XRSTOR support");
(void)migrate_add_blocker(whpx_migration_blocker, &local_error);
if (local_error) {
if (migrate_add_blocker(whpx_migration_blocker, &local_error) < 0) {
error_report_err(local_error);
migrate_del_blocker(whpx_migration_blocker);
error_free(whpx_migration_blocker);
ret = -EINVAL;
goto error;

View File

@ -1481,7 +1481,6 @@ static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl)
static bool dpy_compatible_with(QemuConsole *con,
DisplayChangeListener *dcl, Error **errp)
{
ERRP_GUARD();
int flags;
flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0;
@ -1508,7 +1507,6 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
"This VM has no graphic display device.";
static DisplaySurface *dummy;
QemuConsole *con;
Error *err = NULL;
assert(!dcl->ds);
@ -1523,9 +1521,8 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
dcl->con->gl = dcl;
}
if (dcl->con && !dpy_compatible_with(dcl->con, dcl, &err)) {
error_report_err(err);
exit(1);
if (dcl->con) {
dpy_compatible_with(dcl->con, dcl, &error_fatal);
}
trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);

View File

@ -671,18 +671,13 @@ static void qemu_spice_init(void)
}
passwordSecret = qemu_opt_get(opts, "password-secret");
if (passwordSecret) {
Error *local_err = NULL;
if (qemu_opt_get(opts, "password")) {
error_report("'password' option is mutually exclusive with "
"'password-secret'");
exit(1);
}
password = qcrypto_secret_lookup_as_utf8(passwordSecret,
&local_err);
if (!password) {
error_report_err(local_err);
exit(1);
}
&error_fatal);
} else {
str = qemu_opt_get(opts, "password");
if (str) {