mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-10-22' into staging
Error reporting patches for 2018-10-22 # gpg: Signature made Mon 22 Oct 2018 13:20:23 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-error-2018-10-22: (40 commits) error: Drop bogus "use error_setg() instead" admonitions vpc: Fail open on bad header checksum block: Clean up bdrv_img_create()'s error reporting vl: Simplify call of parse_name() vl: Fix exit status for -drive format=help blockdev: Convert drive_new() to Error vl: Assert drive_new() does not fail in default_drive() fsdev: Clean up error reporting in qemu_fsdev_add() spice: Clean up error reporting in add_channel() tpm: Clean up error reporting in tpm_init_tpmdev() numa: Clean up error reporting in parse_numa() vnc: Clean up error reporting in vnc_init_func() ui: Convert vnc_display_init(), init_keyboard_layout() to Error ui/keymaps: Fix handling of erroneous include files vl: Clean up error reporting in device_init_func() vl: Clean up error reporting in parse_fw_cfg() vl: Clean up error reporting in mon_init_func() vl: Clean up error reporting in machine_set_property() vl: Clean up error reporting in chardev_init_func() qom: Clean up error reporting in user_creatable_add_opts_foreach() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -4697,9 +4697,9 @@ bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp)
|
||||
assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX);
|
||||
if (!QLIST_EMPTY(&bs->op_blockers[op])) {
|
||||
blocker = QLIST_FIRST(&bs->op_blockers[op]);
|
||||
error_propagate(errp, error_copy(blocker->reason));
|
||||
error_prepend(errp, "Node '%s' is busy: ",
|
||||
bdrv_get_device_or_node_name(bs));
|
||||
error_propagate_prepend(errp, error_copy(blocker->reason),
|
||||
"Node '%s' is busy: ",
|
||||
bdrv_get_device_or_node_name(bs));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -4803,9 +4803,6 @@ void bdrv_img_create(const char *filename, const char *fmt,
|
||||
if (options) {
|
||||
qemu_opts_do_parse(opts, options, NULL, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
local_err = NULL;
|
||||
error_setg(errp, "Invalid options for file format '%s'", fmt);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1844,7 +1844,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
iscsi_set_timeout(iscsi, timeout);
|
||||
#else
|
||||
if (timeout) {
|
||||
error_report("iSCSI: ignoring timeout value for libiscsi <1.15.0");
|
||||
warn_report("iSCSI: ignoring timeout value for libiscsi <1.15.0");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -2208,8 +2208,8 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
|
||||
qemu_co_mutex_unlock(&s->lock);
|
||||
qobject_unref(options);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
error_prepend(errp, "Could not reopen qcow2 layer: ");
|
||||
error_propagate_prepend(errp, local_err,
|
||||
"Could not reopen qcow2 layer: ");
|
||||
bs->drv = NULL;
|
||||
return;
|
||||
} else if (ret < 0) {
|
||||
|
||||
+2
-2
@@ -1606,8 +1606,8 @@ static void coroutine_fn bdrv_qed_co_invalidate_cache(BlockDriverState *bs,
|
||||
ret = bdrv_qed_do_open(bs, NULL, bs->open_flags, &local_err);
|
||||
qemu_co_mutex_unlock(&s->table_lock);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
error_prepend(errp, "Could not reopen qed layer: ");
|
||||
error_propagate_prepend(errp, local_err,
|
||||
"Could not reopen qed layer: ");
|
||||
return;
|
||||
} else if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not reopen qed layer");
|
||||
|
||||
+2
-2
@@ -750,8 +750,8 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
/* Take care whenever deciding to actually deprecate; once this ability
|
||||
* is removed, we will not be able to open any images with legacy-styled
|
||||
* backing image strings. */
|
||||
error_report("RBD options encoded in the filename as keyvalue pairs "
|
||||
"is deprecated");
|
||||
warn_report("RBD options encoded in the filename as keyvalue pairs "
|
||||
"is deprecated");
|
||||
}
|
||||
|
||||
/* Remove the processed options from the QDict (the visitor processes
|
||||
|
||||
+1
-1
@@ -572,7 +572,7 @@ static int connect_to_sdog(BDRVSheepdogState *s, Error **errp)
|
||||
if (s->addr->type == SOCKET_ADDRESS_TYPE_INET && fd >= 0) {
|
||||
int ret = socket_set_nodelay(fd);
|
||||
if (ret < 0) {
|
||||
error_report("%s", strerror(errno));
|
||||
warn_report("can't set TCP_NODELAY: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -284,9 +284,11 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
checksum = be32_to_cpu(footer->checksum);
|
||||
footer->checksum = 0;
|
||||
if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum)
|
||||
fprintf(stderr, "block-vpc: The header checksum of '%s' is "
|
||||
"incorrect.\n", bs->filename);
|
||||
if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) {
|
||||
error_setg(errp, "Incorrect header checksum");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Write 'checksum' back to footer, or else will leave it with zero. */
|
||||
footer->checksum = cpu_to_be32(checksum);
|
||||
|
||||
+14
-13
@@ -759,7 +759,8 @@ QemuOptsList qemu_legacy_drive_opts = {
|
||||
},
|
||||
};
|
||||
|
||||
DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type,
|
||||
Error **errp)
|
||||
{
|
||||
const char *value;
|
||||
BlockBackend *blk;
|
||||
@@ -808,7 +809,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
qemu_opt_rename(all_opts, opt_renames[i].from, opt_renames[i].to,
|
||||
&local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_propagate(errp, local_err);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -819,7 +820,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
bool writethrough;
|
||||
|
||||
if (bdrv_parse_cache_mode(value, &flags, &writethrough) != 0) {
|
||||
error_report("invalid cache option");
|
||||
error_setg(errp, "invalid cache option");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -847,7 +848,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
&error_abort);
|
||||
qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_propagate(errp, local_err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -860,7 +861,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
media = MEDIA_CDROM;
|
||||
read_only = true;
|
||||
} else {
|
||||
error_report("'%s' invalid media", value);
|
||||
error_setg(errp, "'%s' invalid media", value);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -885,7 +886,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
type++) {
|
||||
}
|
||||
if (type == IF_COUNT) {
|
||||
error_report("unsupported bus type '%s'", value);
|
||||
error_setg(errp, "unsupported bus type '%s'", value);
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
@@ -902,7 +903,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
if (index != -1) {
|
||||
if (bus_id != 0 || unit_id != -1) {
|
||||
error_report("index cannot be used with bus and unit");
|
||||
error_setg(errp, "index cannot be used with bus and unit");
|
||||
goto fail;
|
||||
}
|
||||
bus_id = drive_index_to_bus_id(type, index);
|
||||
@@ -921,13 +922,13 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
}
|
||||
|
||||
if (max_devs && unit_id >= max_devs) {
|
||||
error_report("unit %d too big (max is %d)", unit_id, max_devs - 1);
|
||||
error_setg(errp, "unit %d too big (max is %d)", unit_id, max_devs - 1);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (drive_get(type, bus_id, unit_id) != NULL) {
|
||||
error_report("drive with bus=%d, unit=%d (index=%d) exists",
|
||||
bus_id, unit_id, index);
|
||||
error_setg(errp, "drive with bus=%d, unit=%d (index=%d) exists",
|
||||
bus_id, unit_id, index);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -970,7 +971,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
if (werror != NULL) {
|
||||
if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO &&
|
||||
type != IF_NONE) {
|
||||
error_report("werror is not supported by this bus type");
|
||||
error_setg(errp, "werror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put_str(bs_opts, "werror", werror);
|
||||
@@ -980,7 +981,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
if (rerror != NULL) {
|
||||
if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI &&
|
||||
type != IF_NONE) {
|
||||
error_report("rerror is not supported by this bus type");
|
||||
error_setg(errp, "rerror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put_str(bs_opts, "rerror", rerror);
|
||||
@@ -991,7 +992,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
bs_opts = NULL;
|
||||
if (!blk) {
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
goto fail;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -259,7 +259,7 @@ static void char_pty_open(Chardev *chr,
|
||||
qemu_set_nonblock(master_fd);
|
||||
|
||||
chr->filename = g_strdup_printf("pty:%s", pty_name);
|
||||
error_report("char device redirected to %s (label %s)",
|
||||
error_printf("char device redirected to %s (label %s)\n",
|
||||
pty_name, chr->label);
|
||||
|
||||
s = PTY_CHARDEV(chr);
|
||||
|
||||
+1
-1
@@ -634,7 +634,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, Error **errp)
|
||||
|
||||
chardev_name_foreach(help_string_append, str);
|
||||
|
||||
error_report("Available chardev backend types: %s", str->str);
|
||||
error_printf("Available chardev backend types: %s\n", str->str);
|
||||
g_string_free(str, true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -211,12 +211,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
|
||||
error_setg(errp, "No MTTCG when icount is enabled");
|
||||
} else {
|
||||
#ifndef TARGET_SUPPORTS_MTTCG
|
||||
error_report("Guest not yet converted to MTTCG - "
|
||||
"you may get unexpected results");
|
||||
warn_report("Guest not yet converted to MTTCG - "
|
||||
"you may get unexpected results");
|
||||
#endif
|
||||
if (!check_tcg_memory_orders_compatible()) {
|
||||
error_report("Guest expects a stronger memory ordering "
|
||||
"than the host provides");
|
||||
warn_report("Guest expects a stronger memory ordering "
|
||||
"than the host provides");
|
||||
error_printf("This may cause strange/hard to debug errors\n");
|
||||
}
|
||||
mttcg_enabled = true;
|
||||
|
||||
+4
-1
@@ -28,6 +28,7 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/option.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
@@ -36,6 +37,7 @@
|
||||
|
||||
static DriveInfo *add_init_drive(const char *optstr)
|
||||
{
|
||||
Error *err = NULL;
|
||||
DriveInfo *dinfo;
|
||||
QemuOpts *opts;
|
||||
MachineClass *mc;
|
||||
@@ -45,8 +47,9 @@ static DriveInfo *add_init_drive(const char *optstr)
|
||||
return NULL;
|
||||
|
||||
mc = MACHINE_GET_CLASS(current_machine);
|
||||
dinfo = drive_new(opts, mc->block_default_type);
|
||||
dinfo = drive_new(opts, mc->block_default_type, &err);
|
||||
if (!dinfo) {
|
||||
error_report_err(err);
|
||||
qemu_opts_del(opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/module.h"
|
||||
|
||||
int qemu_fsdev_add(QemuOpts *opts)
|
||||
int qemu_fsdev_add(QemuOpts *opts, Error **errp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-7
@@ -30,7 +30,7 @@ static FsDriverTable FsDrivers[] = {
|
||||
{ .name = "proxy", .ops = &proxy_ops},
|
||||
};
|
||||
|
||||
int qemu_fsdev_add(QemuOpts *opts)
|
||||
int qemu_fsdev_add(QemuOpts *opts, Error **errp)
|
||||
{
|
||||
int i;
|
||||
struct FsDriverListEntry *fsle;
|
||||
@@ -38,10 +38,9 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||
const char *fsdriver = qemu_opt_get(opts, "fsdriver");
|
||||
const char *writeout = qemu_opt_get(opts, "writeout");
|
||||
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!fsdev_id) {
|
||||
error_report("fsdev: No id specified");
|
||||
error_setg(errp, "fsdev: No id specified");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -53,11 +52,11 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(FsDrivers)) {
|
||||
error_report("fsdev: fsdriver %s not found", fsdriver);
|
||||
error_setg(errp, "fsdev: fsdriver %s not found", fsdriver);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
error_report("fsdev: No fsdriver specified");
|
||||
error_setg(errp, "fsdev: No fsdriver specified");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -76,8 +75,7 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||
}
|
||||
|
||||
if (fsle->fse.ops->parse_opts) {
|
||||
if (fsle->fse.ops->parse_opts(opts, &fsle->fse, &local_err)) {
|
||||
error_report_err(local_err);
|
||||
if (fsle->fse.ops->parse_opts(opts, &fsle->fse, errp)) {
|
||||
g_free(fsle->fse.fsdev_id);
|
||||
g_free(fsle);
|
||||
return -1;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ typedef struct FsDriverListEntry {
|
||||
QTAILQ_ENTRY(FsDriverListEntry) next;
|
||||
} FsDriverListEntry;
|
||||
|
||||
int qemu_fsdev_add(QemuOpts *opts);
|
||||
int qemu_fsdev_add(QemuOpts *opts, Error **errp);
|
||||
FsDriverEntry *get_fsdev_fsentry(char *id);
|
||||
extern FileOperations local_ops;
|
||||
extern FileOperations handle_ops;
|
||||
|
||||
+4
-2
@@ -19,6 +19,7 @@
|
||||
#include <grp.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/xattr.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/error-report.h"
|
||||
@@ -655,12 +656,13 @@ static int handle_parse_opts(QemuOpts *opts, FsDriverEntry *fse, Error **errp)
|
||||
warn_report("handle backend is deprecated");
|
||||
|
||||
if (sec_model) {
|
||||
error_report("Invalid argument security_model specified with handle fsdriver");
|
||||
error_setg(errp,
|
||||
"Invalid argument security_model specified with handle fsdriver");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
error_report("fsdev: No path specified");
|
||||
error_setg(errp, "fsdev: No path specified");
|
||||
return -1;
|
||||
}
|
||||
fse->path = g_strdup(path);
|
||||
|
||||
+2
-2
@@ -1509,8 +1509,8 @@ static int local_parse_opts(QemuOpts *opts, FsDriverEntry *fse, Error **errp)
|
||||
|
||||
fsdev_throttle_parse_opts(opts, &fse->fst, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
error_prepend(errp, "invalid throttle configuration: ");
|
||||
error_propagate_prepend(errp, local_err,
|
||||
"invalid throttle configuration: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "hw/9pfs/9p.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/9pfs/xen-9pfs.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/option.h"
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
@@ -355,6 +356,7 @@ static int xen_9pfs_free(struct XenDevice *xendev)
|
||||
|
||||
static int xen_9pfs_connect(struct XenDevice *xendev)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int i;
|
||||
Xen9pfsDev *xen_9pdev = container_of(xendev, Xen9pfsDev, xendev);
|
||||
V9fsState *s = &xen_9pdev->state;
|
||||
@@ -452,7 +454,10 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
|
||||
qemu_opt_set(fsdev, "path", xen_9pdev->path, NULL);
|
||||
qemu_opt_set(fsdev, "security_model", xen_9pdev->security_model, NULL);
|
||||
qemu_opts_set_id(fsdev, s->fsconf.fsdev_id);
|
||||
qemu_fsdev_add(fsdev);
|
||||
qemu_fsdev_add(fsdev, &err);
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
}
|
||||
v9fs_device_realize_common(s, &xen_9p_transport, NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
|
||||
ret = load_image_mr(fcode_filename, &s->rom);
|
||||
g_free(fcode_filename);
|
||||
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
||||
error_report("cg3: could not load prom '%s'", CG3_ROM_FILE);
|
||||
warn_report("cg3: could not load prom '%s'", CG3_ROM_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -823,7 +823,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
|
||||
ret = load_image_mr(fcode_filename, &s->rom);
|
||||
g_free(fcode_filename);
|
||||
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
||||
error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
|
||||
warn_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user