mirror of https://github.com/xemu-project/xemu.git
Block layer patches
- Fix qmp_device_add() to not throw non-scalar options away (fixes iothread-vq-mapping being silently ignored in device_add) - Fix qdev property crash with integer PCI addresses and JSON -device - iotests: Fix mypy failure - parallels: Avoid potential integer overflow - ssh: libssh broke with non-blocking sessions, use a blocking one for now - Fix crash in migration_is_running() -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmdES74RHGt3b2xmQHJl ZGhhdC5jb20ACgkQfwmycsiPL9abFQ//fGmBl3Jp99GWB1R0y49/hPhfj0166UGj zeEmhdy+k6gKywyhVy0Fj0xLztDTb/2bGflrwtDDxYA0PBLel461QSeJUzwDsn9h ZGLyFrosXgIPADP55RF1wJ6c+m13MX4jVy80Neh2jemhinMazjj3ADb4RdCf0B4M XoYOy96goDFPlzZNvr08dlaDvJaD5QmPYX8nK7TaZqZOSYvdSRWMuB+QQCPj+qEf UfpBo3beNsxedNu/1wKS1Nc6FVX7VHKoMzhDLAvxkYMBKcCg9l5lEAGrgp61O+79 nYZmPtEG5RHsMNBCZtk8zZMIHPg2Ydxpj3jOV3eA0rF4Twk/fPrOOfBEUHT6PapX tCS1UJtgyQA2GTULiax3vKV4yBSpmUzbhjddNwBkW7uG1md67d17nqbjkEhHVxZL yMuauFRCx5onzE0TSgTYEMAmAgD9oawuGUqBiNCOqJlTbGZwJ9l7jtwP4Bl1gskk pWzL/PLP8MkVf50dcP0QBPNHn85/oZOwv5yNr2Z893qNQhh/0xqCEFwqSq2SJOkg vKd/bAusgmicoh1XD0o0+mv2ewZor/JghrU83YDPKWM1MmOwePZ8wRTx9pJtZWvq Pnc71397zppHIw7aIWKYDoyQ3aeaoTM/oY2Q5Y7et6c/FvGW5JtFjsPCGbgm9mw+ +6JA51ujtYU= =oLdE -----END PGP SIGNATURE----- Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging Block layer patches - Fix qmp_device_add() to not throw non-scalar options away (fixes iothread-vq-mapping being silently ignored in device_add) - Fix qdev property crash with integer PCI addresses and JSON -device - iotests: Fix mypy failure - parallels: Avoid potential integer overflow - ssh: libssh broke with non-blocking sessions, use a blocking one for now - Fix crash in migration_is_running() # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmdES74RHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9abFQ//fGmBl3Jp99GWB1R0y49/hPhfj0166UGj # zeEmhdy+k6gKywyhVy0Fj0xLztDTb/2bGflrwtDDxYA0PBLel461QSeJUzwDsn9h # ZGLyFrosXgIPADP55RF1wJ6c+m13MX4jVy80Neh2jemhinMazjj3ADb4RdCf0B4M # XoYOy96goDFPlzZNvr08dlaDvJaD5QmPYX8nK7TaZqZOSYvdSRWMuB+QQCPj+qEf # UfpBo3beNsxedNu/1wKS1Nc6FVX7VHKoMzhDLAvxkYMBKcCg9l5lEAGrgp61O+79 # nYZmPtEG5RHsMNBCZtk8zZMIHPg2Ydxpj3jOV3eA0rF4Twk/fPrOOfBEUHT6PapX # tCS1UJtgyQA2GTULiax3vKV4yBSpmUzbhjddNwBkW7uG1md67d17nqbjkEhHVxZL # yMuauFRCx5onzE0TSgTYEMAmAgD9oawuGUqBiNCOqJlTbGZwJ9l7jtwP4Bl1gskk # pWzL/PLP8MkVf50dcP0QBPNHn85/oZOwv5yNr2Z893qNQhh/0xqCEFwqSq2SJOkg # vKd/bAusgmicoh1XD0o0+mv2ewZor/JghrU83YDPKWM1MmOwePZ8wRTx9pJtZWvq # Pnc71397zppHIw7aIWKYDoyQ3aeaoTM/oY2Q5Y7et6c/FvGW5JtFjsPCGbgm9mw+ # +6JA51ujtYU= # =oLdE # -----END PGP SIGNATURE----- # gpg: Signature made Mon 25 Nov 2024 10:04:46 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: ssh: Do not switch session to non-blocking mode vl: use qmp_device_add() in qemu_create_cli_devices() qdev-monitor: avoid QemuOpts in QMP device_add tests/avocado/hotplug_blk: Fix addr in device_add command qdev: Fix set_pci_devfn() to visit option only once python: silence pylint raising-non-exception error python: disable too-many-positional-arguments warning iotests: correct resultclass type in ReproducibleTestRunner iotests: reflow ReproducibleTestRunner arguments parallels: fix possible int overflow Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
bd5629db93
|
@ -184,11 +184,11 @@ static int mark_used(BlockDriverState *bs, unsigned long *bitmap,
|
|||
BDRVParallelsState *s = bs->opaque;
|
||||
uint32_t cluster_index = host_cluster_index(s, off);
|
||||
unsigned long next_used;
|
||||
if (cluster_index + count > bitmap_size) {
|
||||
if ((uint64_t)cluster_index + count > bitmap_size) {
|
||||
return -E2BIG;
|
||||
}
|
||||
next_used = find_next_bit(bitmap, bitmap_size, cluster_index);
|
||||
if (next_used < cluster_index + count) {
|
||||
if (next_used < (uint64_t)cluster_index + count) {
|
||||
return -EBUSY;
|
||||
}
|
||||
bitmap_set(bitmap, cluster_index, count);
|
||||
|
|
|
@ -866,9 +866,6 @@ static int ssh_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
|
|||
goto err;
|
||||
}
|
||||
|
||||
/* Go non-blocking. */
|
||||
ssh_set_blocking(s->session, 0);
|
||||
|
||||
if (s->attrs->type == SSH_FILEXFER_TYPE_REGULAR) {
|
||||
bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
|
||||
}
|
||||
|
|
|
@ -816,39 +816,57 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
|||
void *opaque, Error **errp)
|
||||
{
|
||||
Property *prop = opaque;
|
||||
g_autofree GenericAlternate *alt;
|
||||
int32_t value, *ptr = object_field_prop_ptr(obj, prop);
|
||||
unsigned int slot, fn, n;
|
||||
char *str;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
if (!visit_type_str(v, name, &str, NULL)) {
|
||||
if (!visit_start_alternate(v, name, &alt, sizeof(*alt), errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (alt->type) {
|
||||
case QTYPE_QSTRING:
|
||||
if (!visit_type_str(v, name, &str, errp)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
|
||||
fn = 0;
|
||||
if (sscanf(str, "%x%n", &slot, &n) != 1) {
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
if (str[n] != '\0' || fn > 7 || slot > 31) {
|
||||
goto invalid;
|
||||
}
|
||||
*ptr = slot << 3 | fn;
|
||||
break;
|
||||
|
||||
case QTYPE_QNUM:
|
||||
if (!visit_type_int32(v, name, &value, errp)) {
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
if (value < -1 || value > 255) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "a value between -1 and 255");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
*ptr = value;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
error_setg(errp, "Invalid parameter type for '%s', expected int or str",
|
||||
name ? name : "null");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
|
||||
fn = 0;
|
||||
if (sscanf(str, "%x%n", &slot, &n) != 1) {
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
if (str[n] != '\0' || fn > 7 || slot > 31) {
|
||||
goto invalid;
|
||||
}
|
||||
*ptr = slot << 3 | fn;
|
||||
g_free(str);
|
||||
return;
|
||||
goto out;
|
||||
|
||||
invalid:
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||
g_free(str);
|
||||
out:
|
||||
visit_end_alternate(v, (void **) &alt);
|
||||
}
|
||||
|
||||
static int print_pci_devfn(Object *obj, Property *prop, char *dest,
|
||||
|
|
|
@ -379,6 +379,9 @@ def make_venv( # pylint: disable=too-many-arguments
|
|||
try:
|
||||
builder.create(str(env_dir))
|
||||
except SystemExit as exc:
|
||||
# pylint 3.3 bug:
|
||||
# pylint: disable=raising-non-exception, raise-missing-from
|
||||
|
||||
# Some versions of the venv module raise SystemExit; *nasty*!
|
||||
# We want the exception that prompted it. It might be a subprocess
|
||||
# error that has output we *really* want to see.
|
||||
|
|
|
@ -142,6 +142,7 @@ ignore_missing_imports = True
|
|||
disable=consider-using-f-string,
|
||||
consider-using-with,
|
||||
too-many-arguments,
|
||||
too-many-positional-arguments,
|
||||
too-many-function-args, # mypy handles this with less false positives.
|
||||
too-many-instance-attributes,
|
||||
no-member, # mypy also handles this better.
|
||||
|
|
|
@ -856,18 +856,9 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict)
|
|||
|
||||
void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
|
||||
{
|
||||
QemuOpts *opts;
|
||||
DeviceState *dev;
|
||||
|
||||
opts = qemu_opts_from_qdict(qemu_find_opts("device"), qdict, errp);
|
||||
if (!opts) {
|
||||
return;
|
||||
}
|
||||
if (!monitor_cur_is_qmp() && qdev_device_help(opts)) {
|
||||
qemu_opts_del(opts);
|
||||
return;
|
||||
}
|
||||
dev = qdev_device_add(opts, errp);
|
||||
dev = qdev_device_add_from_qdict(qdict, true, errp);
|
||||
if (!dev) {
|
||||
/*
|
||||
* Drain all pending RCU callbacks. This is done because
|
||||
|
@ -879,9 +870,6 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
|
|||
* to the user
|
||||
*/
|
||||
drain_call_rcu();
|
||||
|
||||
qemu_opts_del(opts);
|
||||
return;
|
||||
}
|
||||
object_unref(OBJECT(dev));
|
||||
}
|
||||
|
@ -1018,8 +1006,34 @@ void qmp_device_sync_config(const char *id, Error **errp)
|
|||
void hmp_device_add(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *err = NULL;
|
||||
QemuOpts *opts;
|
||||
DeviceState *dev;
|
||||
|
||||
qmp_device_add((QDict *)qdict, NULL, &err);
|
||||
opts = qemu_opts_from_qdict(qemu_find_opts("device"), qdict, &err);
|
||||
if (!opts) {
|
||||
goto out;
|
||||
}
|
||||
if (qdev_device_help(opts)) {
|
||||
qemu_opts_del(opts);
|
||||
return;
|
||||
}
|
||||
dev = qdev_device_add(opts, &err);
|
||||
if (!dev) {
|
||||
/*
|
||||
* Drain all pending RCU callbacks. This is done because
|
||||
* some bus related operations can delay a device removal
|
||||
* (in this case this can happen if device is added and then
|
||||
* removed due to a configuration error)
|
||||
* to a RCU callback, but user might expect that this interface
|
||||
* will finish its job completely once qmp command returns result
|
||||
* to the user
|
||||
*/
|
||||
drain_call_rcu();
|
||||
|
||||
qemu_opts_del(opts);
|
||||
}
|
||||
object_unref(dev);
|
||||
out:
|
||||
hmp_handle_error(mon, err);
|
||||
}
|
||||
|
||||
|
|
14
system/vl.c
14
system/vl.c
|
@ -2653,17 +2653,11 @@ static void qemu_create_cli_devices(void)
|
|||
qemu_opts_foreach(qemu_find_opts("device"),
|
||||
device_init_func, NULL, &error_fatal);
|
||||
QTAILQ_FOREACH(opt, &device_opts, next) {
|
||||
DeviceState *dev;
|
||||
QObject *ret_data = NULL;
|
||||
|
||||
loc_push_restore(&opt->loc);
|
||||
/*
|
||||
* TODO Eventually we should call qmp_device_add() here to make sure it
|
||||
* behaves the same, but QMP still has to accept incorrectly typed
|
||||
* options until libvirt is fixed and we want to be strict on the CLI
|
||||
* from the start, so call qdev_device_add_from_qdict() directly for
|
||||
* now.
|
||||
*/
|
||||
dev = qdev_device_add_from_qdict(opt->opts, true, &error_fatal);
|
||||
object_unref(OBJECT(dev));
|
||||
qmp_device_add(opt->opts, &ret_data, &error_fatal);
|
||||
assert(ret_data == NULL); /* error_fatal aborts */
|
||||
loc_pop(&opt->loc);
|
||||
}
|
||||
rom_reset_order_override();
|
||||
|
|
|
@ -33,7 +33,7 @@ class HotPlug(LinuxTest):
|
|||
'drive': 'disk',
|
||||
'id': 'virtio-disk0',
|
||||
'bus': 'pci.1',
|
||||
'addr': 1
|
||||
'addr': '1',
|
||||
}
|
||||
|
||||
self.assert_no_vda()
|
||||
|
|
|
@ -1614,10 +1614,13 @@ class ReproducibleStreamWrapper:
|
|||
self.stream.write(arg)
|
||||
|
||||
class ReproducibleTestRunner(unittest.TextTestRunner):
|
||||
def __init__(self, stream: Optional[TextIO] = None,
|
||||
resultclass: Type[unittest.TestResult] =
|
||||
ReproducibleTestResult,
|
||||
**kwargs: Any) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
stream: Optional[TextIO] = None,
|
||||
resultclass: Type[unittest.TextTestResult] =
|
||||
ReproducibleTestResult,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
rstream = ReproducibleStreamWrapper(stream or sys.stdout)
|
||||
super().__init__(stream=rstream, # type: ignore
|
||||
descriptions=True,
|
||||
|
|
|
@ -13,6 +13,7 @@ disable=invalid-name,
|
|||
no-else-return,
|
||||
too-few-public-methods,
|
||||
too-many-arguments,
|
||||
too-many-positional-arguments,
|
||||
too-many-branches,
|
||||
too-many-lines,
|
||||
too-many-locals,
|
||||
|
|
Loading…
Reference in New Issue