int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
BlockDriverState *bs;
- int force = qdict_get_int(qdict, "force");
+ int force = qdict_get_try_bool(qdict, "force", 0);
const char *filename = qdict_get_str(qdict, "device");
bs = bdrv_find(filename);
{
MigrationState *s = NULL;
const char *p;
- int detach = qdict_get_int(qdict, "detach");
+ int detach = qdict_get_try_bool(qdict, "detach", 0);
+ int blk = qdict_get_try_bool(qdict, "blk", 0);
+ int inc = qdict_get_try_bool(qdict, "inc", 0);
const char *uri = qdict_get_str(qdict, "uri");
if (current_migration &&
if (strstart(uri, "tcp:", &p)) {
s = tcp_start_outgoing_migration(mon, p, max_throttle, detach,
- (int)qdict_get_int(qdict, "blk"),
- (int)qdict_get_int(qdict, "inc"));
+ blk, inc);
#if !defined(WIN32)
} else if (strstart(uri, "exec:", &p)) {
s = exec_start_outgoing_migration(mon, p, max_throttle, detach,
- (int)qdict_get_int(qdict, "blk"),
- (int)qdict_get_int(qdict, "inc"));
+ blk, inc);
} else if (strstart(uri, "unix:", &p)) {
s = unix_start_outgoing_migration(mon, p, max_throttle, detach,
- (int)qdict_get_int(qdict, "blk"),
- (int)qdict_get_int(qdict, "inc"));
+ blk, inc);
} else if (strstart(uri, "fd:", &p)) {
s = fd_start_outgoing_migration(mon, p, max_throttle, detach,
- (int)qdict_get_int(qdict, "blk"),
- (int)qdict_get_int(qdict, "inc"));
+ blk, inc);
#endif
} else {
monitor_printf(mon, "unknown migration protocol: %s\n", uri);
case '-':
{
const char *tmp = p;
- int has_option, skip_key = 0;
+ int skip_key = 0;
/* option */
c = *typestr++;
goto bad_type;
while (qemu_isspace(*p))
p++;
- has_option = 0;
if (*p == '-') {
p++;
if(c != *p) {
if(skip_key) {
p = tmp;
} else {
+ /* has option */
p++;
- has_option = 1;
+ qdict_put(qdict, key, qbool_from_int(1));
}
}
- qdict_put(qdict, key, qint_from_int(has_option));
}
break;
default:
return -1;
}
- if (cmd_args->type == '-') {
- /* handlers expect a value, they need to be changed */
- qdict_put(args, name, qint_from_int(0));
- }
-
return 0;
}
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool");
return -1;
}
- if (qobject_type(value) == QTYPE_QBOOL) {
- /* handlers expect a QInt, they need to be changed */
- qdict_put(args, name,
- qint_from_int(qbool_get_int(qobject_to_qbool(value))));
- }
break;
case 'O':
default: