X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=qemu-config.c;h=c05ffbc444ed50abaf69b343efb3d790b9757fa7;hb=42644cee08f85202f5d3e8babf6503487849353a;hp=b2ec40bd66f8ec82cc1cd76f307caae65cf5ab36;hpb=9052ea6bf4962b1342aa56d4341bb55176ed9e45;p=mirror_qemu.git diff --git a/qemu-config.c b/qemu-config.c index b2ec40bd66..c05ffbc444 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -3,6 +3,7 @@ #include "qemu-option.h" #include "qemu-config.h" #include "hw/qdev.h" +#include "error.h" static QemuOptsList qemu_drive_opts = { .name = "drive", @@ -55,7 +56,8 @@ static QemuOptsList qemu_drive_opts = { },{ .name = "cache", .type = QEMU_OPT_STRING, - .help = "host cache usage (none, writeback, writethrough, unsafe)", + .help = "host cache usage (none, writeback, writethrough, " + "directsync, unsafe)", },{ .name = "aio", .type = QEMU_OPT_STRING, @@ -84,6 +86,60 @@ static QemuOptsList qemu_drive_opts = { .name = "readonly", .type = QEMU_OPT_BOOL, .help = "open drive file as read-only", + },{ + .name = "iops", + .type = QEMU_OPT_NUMBER, + .help = "limit total I/O operations per second", + },{ + .name = "iops_rd", + .type = QEMU_OPT_NUMBER, + .help = "limit read operations per second", + },{ + .name = "iops_wr", + .type = QEMU_OPT_NUMBER, + .help = "limit write operations per second", + },{ + .name = "bps", + .type = QEMU_OPT_NUMBER, + .help = "limit total bytes per second", + },{ + .name = "bps_rd", + .type = QEMU_OPT_NUMBER, + .help = "limit read bytes per second", + },{ + .name = "bps_wr", + .type = QEMU_OPT_NUMBER, + .help = "limit write bytes per second", + },{ + .name = "copy-on-read", + .type = QEMU_OPT_BOOL, + .help = "copy read data from backing file into image file", + }, + { /* end of list */ } + }, +}; + +static QemuOptsList qemu_iscsi_opts = { + .name = "iscsi", + .head = QTAILQ_HEAD_INITIALIZER(qemu_iscsi_opts.head), + .desc = { + { + .name = "user", + .type = QEMU_OPT_STRING, + .help = "username for CHAP authentication to target", + },{ + .name = "password", + .type = QEMU_OPT_STRING, + .help = "password for CHAP authentication to target", + },{ + .name = "header-digest", + .type = QEMU_OPT_STRING, + .help = "HeaderDigest setting. " + "{CRC32C|CRC32C-NONE|NONE-CRC32C|NONE}", + },{ + .name = "initiator-name", + .type = QEMU_OPT_STRING, + .help = "Initiator iqn name to use when connecting", }, { /* end of list */ } }, @@ -164,11 +220,11 @@ static QemuOptsList qemu_chardev_opts = { QemuOptsList qemu_fsdev_opts = { .name = "fsdev", - .implied_opt_name = "fstype", + .implied_opt_name = "fsdriver", .head = QTAILQ_HEAD_INITIALIZER(qemu_fsdev_opts.head), .desc = { { - .name = "fstype", + .name = "fsdriver", .type = QEMU_OPT_STRING, }, { .name = "path", @@ -176,18 +232,32 @@ QemuOptsList qemu_fsdev_opts = { }, { .name = "security_model", .type = QEMU_OPT_STRING, + }, { + .name = "writeout", + .type = QEMU_OPT_STRING, + }, { + .name = "readonly", + .type = QEMU_OPT_BOOL, + + }, { + .name = "socket", + .type = QEMU_OPT_STRING, + }, { + .name = "sock_fd", + .type = QEMU_OPT_NUMBER, }, + { /*End of list */ } }, }; QemuOptsList qemu_virtfs_opts = { .name = "virtfs", - .implied_opt_name = "fstype", + .implied_opt_name = "fsdriver", .head = QTAILQ_HEAD_INITIALIZER(qemu_virtfs_opts.head), .desc = { { - .name = "fstype", + .name = "fsdriver", .type = QEMU_OPT_STRING, }, { .name = "path", @@ -198,6 +268,18 @@ QemuOptsList qemu_virtfs_opts = { }, { .name = "security_model", .type = QEMU_OPT_STRING, + }, { + .name = "writeout", + .type = QEMU_OPT_STRING, + }, { + .name = "readonly", + .type = QEMU_OPT_BOOL, + }, { + .name = "socket", + .type = QEMU_OPT_STRING, + }, { + .name = "sock_fd", + .type = QEMU_OPT_NUMBER, }, { /*End of list */ } @@ -280,6 +362,19 @@ static QemuOptsList qemu_global_opts = { }, }; +QemuOptsList qemu_sandbox_opts = { + .name = "sandbox", + .implied_opt_name = "enable", + .head = QTAILQ_HEAD_INITIALIZER(qemu_sandbox_opts.head), + .desc = { + { + .name = "enable", + .type = QEMU_OPT_BOOL, + }, + { /* end of list */ } + }, +}; + static QemuOptsList qemu_mon_opts = { .name = "mon", .implied_opt_name = "chardev", @@ -302,20 +397,21 @@ static QemuOptsList qemu_mon_opts = { }, }; -#ifdef CONFIG_SIMPLE_TRACE static QemuOptsList qemu_trace_opts = { .name = "trace", .implied_opt_name = "trace", .head = QTAILQ_HEAD_INITIALIZER(qemu_trace_opts.head), .desc = { { + .name = "events", + .type = QEMU_OPT_STRING, + },{ .name = "file", .type = QEMU_OPT_STRING, }, { /* end of list */ } }, }; -#endif static QemuOptsList qemu_cpudef_opts = { .name = "cpudef", @@ -465,6 +561,7 @@ QemuOptsList qemu_option_rom_opts = { static QemuOptsList qemu_machine_opts = { .name = "machine", .implied_opt_name = "type", + .merge_lists = true, .head = QTAILQ_HEAD_INITIALIZER(qemu_machine_opts.head), .desc = { { @@ -475,11 +572,77 @@ static QemuOptsList qemu_machine_opts = { .name = "accel", .type = QEMU_OPT_STRING, .help = "accelerator list", + }, { + .name = "kernel_irqchip", + .type = QEMU_OPT_BOOL, + .help = "use KVM in-kernel irqchip", + }, { + .name = "kvm_shadow_mem", + .type = QEMU_OPT_SIZE, + .help = "KVM shadow MMU size", + }, { + .name = "kernel", + .type = QEMU_OPT_STRING, + .help = "Linux kernel image file", + }, { + .name = "initrd", + .type = QEMU_OPT_STRING, + .help = "Linux initial ramdisk file", + }, { + .name = "append", + .type = QEMU_OPT_STRING, + .help = "Linux kernel command line", + }, { + .name = "dtb", + .type = QEMU_OPT_STRING, + .help = "Linux kernel device tree file", + }, { + .name = "dumpdtb", + .type = QEMU_OPT_STRING, + .help = "Dump current dtb to a file and quit", + }, { + .name = "phandle_start", + .type = QEMU_OPT_STRING, + .help = "The first phandle ID we may generate dynamically", + }, { + .name = "dt_compatible", + .type = QEMU_OPT_STRING, + .help = "Overrides the \"compatible\" property of the dt root node", + }, { + .name = "dump-guest-core", + .type = QEMU_OPT_BOOL, + .help = "Include guest memory in a core dump", }, { /* End of list */ } }, }; +QemuOptsList qemu_boot_opts = { + .name = "boot-opts", + .head = QTAILQ_HEAD_INITIALIZER(qemu_boot_opts.head), + .desc = { + /* the three names below are not used now */ + { + .name = "order", + .type = QEMU_OPT_STRING, + }, { + .name = "once", + .type = QEMU_OPT_STRING, + }, { + .name = "menu", + .type = QEMU_OPT_STRING, + /* following are really used */ + }, { + .name = "splash", + .type = QEMU_OPT_STRING, + }, { + .name = "splash-time", + .type = QEMU_OPT_STRING, + }, + { /*End of list */ } + }, +}; + static QemuOptsList *vm_config_groups[32] = { &qemu_drive_opts, &qemu_chardev_opts, @@ -490,15 +653,17 @@ static QemuOptsList *vm_config_groups[32] = { &qemu_global_opts, &qemu_mon_opts, &qemu_cpudef_opts, -#ifdef CONFIG_SIMPLE_TRACE &qemu_trace_opts, -#endif &qemu_option_rom_opts, &qemu_machine_opts, + &qemu_boot_opts, + &qemu_iscsi_opts, + &qemu_sandbox_opts, NULL, }; -static QemuOptsList *find_list(QemuOptsList **lists, const char *group) +static QemuOptsList *find_list(QemuOptsList **lists, const char *group, + Error **errp) { int i; @@ -507,14 +672,28 @@ static QemuOptsList *find_list(QemuOptsList **lists, const char *group) break; } if (lists[i] == NULL) { - error_report("there is no option group \"%s\"", group); + error_set(errp, QERR_INVALID_OPTION_GROUP, group); } return lists[i]; } QemuOptsList *qemu_find_opts(const char *group) { - return find_list(vm_config_groups, group); + QemuOptsList *ret; + Error *local_err = NULL; + + ret = find_list(vm_config_groups, group, &local_err); + if (error_is_set(&local_err)) { + error_report("%s\n", error_get_pretty(local_err)); + error_free(local_err); + } + + return ret; +} + +QemuOptsList *qemu_find_opts_err(const char *group, Error **errp) +{ + return find_list(vm_config_groups, group, errp); } void qemu_add_opts(QemuOptsList *list) @@ -576,7 +755,7 @@ int qemu_global_option(const char *str) return -1; } - opts = qemu_opts_create(&qemu_global_opts, NULL, 0); + opts = qemu_opts_create(&qemu_global_opts, NULL, 0, NULL); qemu_opt_set(opts, "driver", driver); qemu_opt_set(opts, "property", property); qemu_opt_set(opts, "value", str+offset+1); @@ -629,6 +808,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) char line[1024], group[64], id[64], arg[64], value[1024]; Location loc; QemuOptsList *list = NULL; + Error *local_err = NULL; QemuOpts *opts = NULL; int res = -1, lno = 0; @@ -645,18 +825,24 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) } if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) { /* group with id */ - list = find_list(lists, group); - if (list == NULL) + list = find_list(lists, group, &local_err); + if (error_is_set(&local_err)) { + error_report("%s\n", error_get_pretty(local_err)); + error_free(local_err); goto out; - opts = qemu_opts_create(list, id, 1); + } + opts = qemu_opts_create(list, id, 1, NULL); continue; } if (sscanf(line, "[%63[^]]]", group) == 1) { /* group without id */ - list = find_list(lists, group); - if (list == NULL) + list = find_list(lists, group, &local_err); + if (error_is_set(&local_err)) { + error_report("%s\n", error_get_pretty(local_err)); + error_free(local_err); goto out; - opts = qemu_opts_create(list, NULL, 0); + } + opts = qemu_opts_create(list, NULL, 0, NULL); continue; } if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) {