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-qapi-2016-09-19' into staging
QAPI patches for 2016-09-19 # gpg: Signature made Mon 19 Sep 2016 17:27:42 BST # gpg: using RSA key 0x3870B400EB918653 # 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-qapi-2016-09-19: Replace qmp-commands.hx by docs/qmp-commands.txt qmp-commands.hx: fix some styling build-sys: remove qmp-commands-old.h monitor: use qmp_dispatch() tests: add a test to check invalid args qapi: check invalid arguments on no-args commands qapi: remove the "middle" mode monitor: remove mhandler.cmd_new monitor: implement 'qmp_query_commands' without qmp_cmds monitor: use qmp_find_command() (using generated qapi code) qapi: export the marshallers qmp: Hack to keep commands configuration-specific qapi: Support unregistering QMP commands monitor: register gen:false commands manually monitor: simplify invalid_qmp_mode() qapi-schema: add 'device_add' qapi-schema: use generated marshaller for 'qmp_capabilities' build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO} Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
/qemu-monitor-info.texi
|
||||
/qemu-version.h
|
||||
/qemu-version.h.tmp
|
||||
/qmp-commands.txt
|
||||
/vscclient
|
||||
/fsdev/virtfs-proxy-helper
|
||||
*.[1-9]
|
||||
|
||||
@@ -1245,7 +1245,6 @@ M: Markus Armbruster <armbru@redhat.com>
|
||||
S: Supported
|
||||
F: qmp.c
|
||||
F: monitor.c
|
||||
F: qmp-commands.hx
|
||||
F: docs/*qmp-*
|
||||
F: scripts/qmp/
|
||||
T: git git://repo.or.cz/qemu/armbru.git qapi-next
|
||||
|
||||
@@ -92,7 +92,6 @@ HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
|
||||
|
||||
ifdef BUILD_DOCS
|
||||
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
|
||||
DOCS+=qmp-commands.txt
|
||||
ifdef CONFIG_VIRTFS
|
||||
DOCS+=fsdev/virtfs-proxy-helper.1
|
||||
endif
|
||||
@@ -312,7 +311,7 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
|
||||
qmp-commands.h qmp-marshal.c :\
|
||||
$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
|
||||
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
|
||||
$(gen-out-type) -o "." -m $<, \
|
||||
$(gen-out-type) -o "." $<, \
|
||||
" GEN $@")
|
||||
qmp-introspect.h qmp-introspect.c :\
|
||||
$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
|
||||
@@ -432,7 +431,7 @@ endif
|
||||
install-doc: $(DOCS)
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
|
||||
$(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
|
||||
$(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
|
||||
$(INSTALL_DATA) docs/qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
|
||||
ifdef CONFIG_POSIX
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
|
||||
$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
|
||||
@@ -555,9 +554,6 @@ qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
|
||||
qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
|
||||
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
|
||||
|
||||
qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
|
||||
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
|
||||
|
||||
qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
|
||||
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
|
||||
|
||||
|
||||
+2
-5
@@ -156,7 +156,7 @@ else
|
||||
obj-y += hw/$(TARGET_BASE_ARCH)/
|
||||
endif
|
||||
|
||||
GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h qmp-commands-old.h
|
||||
GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h
|
||||
|
||||
endif # CONFIG_SOFTMMU
|
||||
|
||||
@@ -209,13 +209,10 @@ hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
|
||||
hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
|
||||
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
|
||||
|
||||
qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
|
||||
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
|
||||
|
||||
clean: clean-target
|
||||
rm -f *.a *~ $(PROGS)
|
||||
rm -f $(shell find . -name '*.[od]')
|
||||
rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
|
||||
rm -f hmp-commands.h gdbstub-xml.c
|
||||
ifdef CONFIG_TRACE_SYSTEMTAP
|
||||
rm -f *.stp
|
||||
endif
|
||||
|
||||
@@ -964,9 +964,9 @@ Example:
|
||||
|
||||
Used to generate the marshaling/dispatch functions for the commands
|
||||
defined in the schema. The generated code implements
|
||||
qmp_marshal_COMMAND() (mentioned in qmp-commands.hx, and registered
|
||||
automatically), and declares qmp_COMMAND() that the user must
|
||||
implement. The following files are generated:
|
||||
qmp_marshal_COMMAND() (registered automatically), and declares
|
||||
qmp_COMMAND() that the user must implement. The following files are
|
||||
generated:
|
||||
|
||||
$(prefix)qmp-marshal.c: command marshal/dispatch functions for each
|
||||
QMP command defined in the schema. Functions
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -119,17 +119,6 @@ There are a few things to be noticed:
|
||||
5. Printing to the terminal is discouraged for QMP commands, we do it here
|
||||
because it's the easiest way to demonstrate a QMP command
|
||||
|
||||
Now a little hack is needed. As we're still using the old QMP server we need
|
||||
to add the new command to its internal dispatch table. This step won't be
|
||||
required in the near future. Open the qmp-commands.hx file and add the
|
||||
following at the bottom:
|
||||
|
||||
{
|
||||
.name = "hello-world",
|
||||
.args_type = "",
|
||||
.mhandler.cmd_new = qmp_marshal_hello_world,
|
||||
},
|
||||
|
||||
You're done. Now build qemu, run it as suggested in the "Testing" section,
|
||||
and then type the following QMP command:
|
||||
|
||||
@@ -174,21 +163,6 @@ There are two important details to be noticed:
|
||||
2. The C implementation signature must follow the schema's argument ordering,
|
||||
which is defined by the "data" member
|
||||
|
||||
The last step is to update the qmp-commands.hx file:
|
||||
|
||||
{
|
||||
.name = "hello-world",
|
||||
.args_type = "message:s?",
|
||||
.mhandler.cmd_new = qmp_marshal_hello_world,
|
||||
},
|
||||
|
||||
Notice that the "args_type" member got our "message" argument. The character
|
||||
"s" stands for "string" and "?" means it's optional. This too must be ordered
|
||||
according to the C implementation and schema file. You can look for more
|
||||
examples in the qmp-commands.hx file if you need to define more arguments.
|
||||
|
||||
Again, this step won't be required in the future.
|
||||
|
||||
Time to test our new version of the "hello-world" command. Build qemu, run it as
|
||||
described in the "Testing" section and then send two commands:
|
||||
|
||||
@@ -337,7 +311,7 @@ we should add it to the hmp-commands.hx file:
|
||||
.args_type = "message:s?",
|
||||
.params = "hello-world [message]",
|
||||
.help = "Print message to the standard output",
|
||||
.mhandler.cmd = hmp_hello_world,
|
||||
.cmd = hmp_hello_world,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -454,14 +428,6 @@ There are a number of things to be noticed:
|
||||
6. You have to include the "qmp-commands.h" header file in qemu-timer.c,
|
||||
otherwise qemu won't build
|
||||
|
||||
The last step is to add the correspoding entry in the qmp-commands.hx file:
|
||||
|
||||
{
|
||||
.name = "query-alarm-clock",
|
||||
.args_type = "",
|
||||
.mhandler.cmd_new = qmp_marshal_query_alarm_clock,
|
||||
},
|
||||
|
||||
Time to test the new command. Build qemu, run it as described in the "Testing"
|
||||
section and try this:
|
||||
|
||||
@@ -518,7 +484,7 @@ in the monitor.c file. The entry for the "info alarmclock" follows:
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show information about the alarm clock",
|
||||
.mhandler.info = hmp_info_alarm_clock,
|
||||
.cmd = hmp_info_alarm_clock,
|
||||
},
|
||||
|
||||
To test this, run qemu and type "info alarmclock" in the user monitor.
|
||||
@@ -600,14 +566,6 @@ iteration of the loop. That's because the alarm timer method in use is the
|
||||
first element of the alarm_timers array. Also notice that QAPI lists are handled
|
||||
by hand and we return the head of the list.
|
||||
|
||||
To test this you have to add the corresponding qmp-commands.hx entry:
|
||||
|
||||
{
|
||||
.name = "query-alarm-methods",
|
||||
.args_type = "",
|
||||
.mhandler.cmd_new = qmp_marshal_query_alarm_methods,
|
||||
},
|
||||
|
||||
Now Build qemu, run it as explained in the "Testing" section and try our new
|
||||
command:
|
||||
|
||||
|
||||
+59
-59
@@ -18,7 +18,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the version of QEMU",
|
||||
.mhandler.cmd = hmp_info_version,
|
||||
.cmd = hmp_info_version,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -32,7 +32,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the network state",
|
||||
.mhandler.cmd = hmp_info_network,
|
||||
.cmd = hmp_info_network,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -46,7 +46,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the character devices",
|
||||
.mhandler.cmd = hmp_info_chardev,
|
||||
.cmd = hmp_info_chardev,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -61,7 +61,7 @@ ETEXI
|
||||
.params = "[-n] [-v] [device]",
|
||||
.help = "show info of one block device or all block devices "
|
||||
"(-n: show named nodes; -v: show details)",
|
||||
.mhandler.cmd = hmp_info_block,
|
||||
.cmd = hmp_info_block,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -75,7 +75,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show block device statistics",
|
||||
.mhandler.cmd = hmp_info_blockstats,
|
||||
.cmd = hmp_info_blockstats,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -89,7 +89,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show progress of ongoing block device operations",
|
||||
.mhandler.cmd = hmp_info_block_jobs,
|
||||
.cmd = hmp_info_block_jobs,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -103,7 +103,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the cpu registers",
|
||||
.mhandler.cmd = hmp_info_registers,
|
||||
.cmd = hmp_info_registers,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -118,7 +118,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show local apic state",
|
||||
.mhandler.cmd = hmp_info_local_apic,
|
||||
.cmd = hmp_info_local_apic,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -134,7 +134,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show io apic state",
|
||||
.mhandler.cmd = hmp_info_io_apic,
|
||||
.cmd = hmp_info_io_apic,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -149,7 +149,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show infos for each CPU",
|
||||
.mhandler.cmd = hmp_info_cpus,
|
||||
.cmd = hmp_info_cpus,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -163,7 +163,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the command line history",
|
||||
.mhandler.cmd = hmp_info_history,
|
||||
.cmd = hmp_info_history,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -180,11 +180,11 @@ ETEXI
|
||||
.params = "",
|
||||
.help = "show the interrupts statistics (if available)",
|
||||
#ifdef TARGET_SPARC
|
||||
.mhandler.cmd = sun4m_hmp_info_irq,
|
||||
.cmd = sun4m_hmp_info_irq,
|
||||
#elif defined(TARGET_LM32)
|
||||
.mhandler.cmd = lm32_hmp_info_irq,
|
||||
.cmd = lm32_hmp_info_irq,
|
||||
#else
|
||||
.mhandler.cmd = hmp_info_irq,
|
||||
.cmd = hmp_info_irq,
|
||||
#endif
|
||||
},
|
||||
|
||||
@@ -200,11 +200,11 @@ ETEXI
|
||||
.params = "",
|
||||
.help = "show i8259 (PIC) state",
|
||||
#ifdef TARGET_SPARC
|
||||
.mhandler.cmd = sun4m_hmp_info_pic,
|
||||
.cmd = sun4m_hmp_info_pic,
|
||||
#elif defined(TARGET_LM32)
|
||||
.mhandler.cmd = lm32_hmp_info_pic,
|
||||
.cmd = lm32_hmp_info_pic,
|
||||
#else
|
||||
.mhandler.cmd = hmp_info_pic,
|
||||
.cmd = hmp_info_pic,
|
||||
#endif
|
||||
},
|
||||
#endif
|
||||
@@ -220,7 +220,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show PCI info",
|
||||
.mhandler.cmd = hmp_info_pci,
|
||||
.cmd = hmp_info_pci,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -236,7 +236,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show virtual to physical memory mappings",
|
||||
.mhandler.cmd = hmp_info_tlb,
|
||||
.cmd = hmp_info_tlb,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -252,7 +252,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the active virtual memory mappings",
|
||||
.mhandler.cmd = hmp_info_mem,
|
||||
.cmd = hmp_info_mem,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -267,7 +267,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show memory tree",
|
||||
.mhandler.cmd = hmp_info_mtree,
|
||||
.cmd = hmp_info_mtree,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -281,7 +281,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show dynamic compiler info",
|
||||
.mhandler.cmd = hmp_info_jit,
|
||||
.cmd = hmp_info_jit,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -295,7 +295,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show dynamic compiler opcode counters",
|
||||
.mhandler.cmd = hmp_info_opcount,
|
||||
.cmd = hmp_info_opcount,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -309,7 +309,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show KVM information",
|
||||
.mhandler.cmd = hmp_info_kvm,
|
||||
.cmd = hmp_info_kvm,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -323,7 +323,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show NUMA information",
|
||||
.mhandler.cmd = hmp_info_numa,
|
||||
.cmd = hmp_info_numa,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -337,7 +337,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show guest USB devices",
|
||||
.mhandler.cmd = hmp_info_usb,
|
||||
.cmd = hmp_info_usb,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -351,7 +351,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show host USB devices",
|
||||
.mhandler.cmd = hmp_info_usbhost,
|
||||
.cmd = hmp_info_usbhost,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -365,7 +365,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show profiling information",
|
||||
.mhandler.cmd = hmp_info_profile,
|
||||
.cmd = hmp_info_profile,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -379,7 +379,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show capture information",
|
||||
.mhandler.cmd = hmp_info_capture,
|
||||
.cmd = hmp_info_capture,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -393,7 +393,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the currently saved VM snapshots",
|
||||
.mhandler.cmd = hmp_info_snapshots,
|
||||
.cmd = hmp_info_snapshots,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -407,7 +407,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the current VM status (running|paused)",
|
||||
.mhandler.cmd = hmp_info_status,
|
||||
.cmd = hmp_info_status,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -421,7 +421,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show which guest mouse is receiving events",
|
||||
.mhandler.cmd = hmp_info_mice,
|
||||
.cmd = hmp_info_mice,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -435,7 +435,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the vnc server status",
|
||||
.mhandler.cmd = hmp_info_vnc,
|
||||
.cmd = hmp_info_vnc,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -450,7 +450,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the spice server status",
|
||||
.mhandler.cmd = hmp_info_spice,
|
||||
.cmd = hmp_info_spice,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -465,7 +465,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the current VM name",
|
||||
.mhandler.cmd = hmp_info_name,
|
||||
.cmd = hmp_info_name,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -479,7 +479,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the current VM UUID",
|
||||
.mhandler.cmd = hmp_info_uuid,
|
||||
.cmd = hmp_info_uuid,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -493,7 +493,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show CPU statistics",
|
||||
.mhandler.cmd = hmp_info_cpustats,
|
||||
.cmd = hmp_info_cpustats,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -508,7 +508,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show user network stack connection states",
|
||||
.mhandler.cmd = hmp_info_usernet,
|
||||
.cmd = hmp_info_usernet,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -523,7 +523,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show migration status",
|
||||
.mhandler.cmd = hmp_info_migrate,
|
||||
.cmd = hmp_info_migrate,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -537,7 +537,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show current migration capabilities",
|
||||
.mhandler.cmd = hmp_info_migrate_capabilities,
|
||||
.cmd = hmp_info_migrate_capabilities,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -551,7 +551,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show current migration parameters",
|
||||
.mhandler.cmd = hmp_info_migrate_parameters,
|
||||
.cmd = hmp_info_migrate_parameters,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -565,7 +565,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show current migration xbzrle cache size",
|
||||
.mhandler.cmd = hmp_info_migrate_cache_size,
|
||||
.cmd = hmp_info_migrate_cache_size,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -579,7 +579,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show balloon information",
|
||||
.mhandler.cmd = hmp_info_balloon,
|
||||
.cmd = hmp_info_balloon,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -593,7 +593,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show device tree",
|
||||
.mhandler.cmd = hmp_info_qtree,
|
||||
.cmd = hmp_info_qtree,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -607,7 +607,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show qdev device model list",
|
||||
.mhandler.cmd = hmp_info_qdm,
|
||||
.cmd = hmp_info_qdm,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -621,7 +621,7 @@ ETEXI
|
||||
.args_type = "path:s?",
|
||||
.params = "[path]",
|
||||
.help = "show QOM composition tree",
|
||||
.mhandler.cmd = hmp_info_qom_tree,
|
||||
.cmd = hmp_info_qom_tree,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -635,7 +635,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show roms",
|
||||
.mhandler.cmd = hmp_info_roms,
|
||||
.cmd = hmp_info_roms,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -650,7 +650,7 @@ ETEXI
|
||||
.params = "[name] [vcpu]",
|
||||
.help = "show available trace-events & their state "
|
||||
"(name: event name pattern; vcpu: vCPU to query, default is any)",
|
||||
.mhandler.cmd = hmp_info_trace_events,
|
||||
.cmd = hmp_info_trace_events,
|
||||
.command_completion = info_trace_events_completion,
|
||||
},
|
||||
|
||||
@@ -665,7 +665,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show the TPM device",
|
||||
.mhandler.cmd = hmp_info_tpm,
|
||||
.cmd = hmp_info_tpm,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -679,7 +679,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show memory backends",
|
||||
.mhandler.cmd = hmp_info_memdev,
|
||||
.cmd = hmp_info_memdev,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -693,7 +693,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show memory devices",
|
||||
.mhandler.cmd = hmp_info_memory_devices,
|
||||
.cmd = hmp_info_memory_devices,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -707,7 +707,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show iothreads",
|
||||
.mhandler.cmd = hmp_info_iothreads,
|
||||
.cmd = hmp_info_iothreads,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -721,7 +721,7 @@ ETEXI
|
||||
.args_type = "name:s",
|
||||
.params = "name",
|
||||
.help = "Show rocker switch",
|
||||
.mhandler.cmd = hmp_rocker,
|
||||
.cmd = hmp_rocker,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -735,7 +735,7 @@ ETEXI
|
||||
.args_type = "name:s",
|
||||
.params = "name",
|
||||
.help = "Show rocker ports",
|
||||
.mhandler.cmd = hmp_rocker_ports,
|
||||
.cmd = hmp_rocker_ports,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -749,7 +749,7 @@ ETEXI
|
||||
.args_type = "name:s,tbl_id:i?",
|
||||
.params = "name [tbl_id]",
|
||||
.help = "Show rocker OF-DPA flow tables",
|
||||
.mhandler.cmd = hmp_rocker_of_dpa_flows,
|
||||
.cmd = hmp_rocker_of_dpa_flows,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -763,7 +763,7 @@ ETEXI
|
||||
.args_type = "name:s,type:i?",
|
||||
.params = "name [type]",
|
||||
.help = "Show rocker OF-DPA groups",
|
||||
.mhandler.cmd = hmp_rocker_of_dpa_groups,
|
||||
.cmd = hmp_rocker_of_dpa_groups,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -778,7 +778,7 @@ ETEXI
|
||||
.args_type = "addr:l",
|
||||
.params = "address",
|
||||
.help = "Display the value of a storage key",
|
||||
.mhandler.cmd = hmp_info_skeys,
|
||||
.cmd = hmp_info_skeys,
|
||||
},
|
||||
#endif
|
||||
|
||||
@@ -793,7 +793,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "Display the latest dump status",
|
||||
.mhandler.cmd = hmp_info_dump,
|
||||
.cmd = hmp_info_dump,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -807,7 +807,7 @@ ETEXI
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "Show information about hotpluggable CPUs",
|
||||
.mhandler.cmd = hmp_hotpluggable_cpus,
|
||||
.cmd = hmp_hotpluggable_cpus,
|
||||
},
|
||||
|
||||
STEXI
|
||||
|
||||
+104
-104
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,7 @@ typedef struct QmpCommand
|
||||
|
||||
void qmp_register_command(const char *name, QmpCommandFunc *fn,
|
||||
QmpCommandOptions options);
|
||||
void qmp_unregister_command(const char *name);
|
||||
QmpCommand *qmp_find_command(const char *name);
|
||||
QObject *qmp_dispatch(QObject *request);
|
||||
void qmp_disable_command(const char *name);
|
||||
|
||||
@@ -20,6 +20,27 @@
|
||||
# QAPI introspection
|
||||
{ 'include': 'qapi/introspect.json' }
|
||||
|
||||
##
|
||||
# @qmp_capabilities:
|
||||
#
|
||||
# Enable QMP capabilities.
|
||||
#
|
||||
# Arguments: None.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "qmp_capabilities" }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
# Notes: This command is valid exactly when first connecting: it must be
|
||||
# issued before any other command will be accepted, and will fail once the
|
||||
# monitor is accepting other commands. (see qemu docs/qmp-spec.txt)
|
||||
#
|
||||
# Since: 0.13
|
||||
#
|
||||
##
|
||||
{ 'command': 'qmp_capabilities' }
|
||||
|
||||
##
|
||||
# @LostTickPolicy:
|
||||
#
|
||||
@@ -2179,6 +2200,46 @@
|
||||
##
|
||||
{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
|
||||
|
||||
##
|
||||
# @device_add:
|
||||
#
|
||||
# @driver: the name of the new device's driver
|
||||
#
|
||||
# @bus: #optional the device's parent bus (device tree path)
|
||||
#
|
||||
# @id: the device's ID, must be unique
|
||||
#
|
||||
# Additional arguments depend on the type.
|
||||
#
|
||||
# Add a device.
|
||||
#
|
||||
# Notes:
|
||||
# 1. For detailed information about this command, please refer to the
|
||||
# 'docs/qdev-device-use.txt' file.
|
||||
#
|
||||
# 2. It's possible to list device properties by running QEMU with the
|
||||
# "-device DEVICE,help" command-line argument, where DEVICE is the
|
||||
# device's name
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "device_add",
|
||||
# "arguments": { "driver": "e1000", "id": "net1",
|
||||
# "bus": "pci.0",
|
||||
# "mac": "52:54:00:12:34:56" } }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
# TODO This command effectively bypasses QAPI completely due to its
|
||||
# "additional arguments" business. It shouldn't have been added to
|
||||
# the schema in this form. It should be qapified properly, or
|
||||
# replaced by a properly qapified command.
|
||||
#
|
||||
# Since: 0.13
|
||||
##
|
||||
{ 'command': 'device_add',
|
||||
'data': {'driver': 'str', 'id': 'str'},
|
||||
'gen': false } # so we can get the additional arguments
|
||||
|
||||
##
|
||||
# @device_del:
|
||||
#
|
||||
|
||||
@@ -30,6 +30,14 @@ void qmp_register_command(const char *name, QmpCommandFunc *fn,
|
||||
QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
|
||||
}
|
||||
|
||||
void qmp_unregister_command(const char *name)
|
||||
{
|
||||
QmpCommand *cmd = qmp_find_command(name);
|
||||
|
||||
QTAILQ_REMOVE(&qmp_commands, cmd, node);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
QmpCommand *qmp_find_command(const char *name)
|
||||
{
|
||||
QmpCommand *cmd;
|
||||
|
||||
@@ -51,21 +51,11 @@ NameInfo *qmp_query_name(Error **errp)
|
||||
VersionInfo *qmp_query_version(Error **errp)
|
||||
{
|
||||
VersionInfo *info = g_new0(VersionInfo, 1);
|
||||
const char *version = QEMU_VERSION;
|
||||
const char *tmp;
|
||||
int err;
|
||||
|
||||
info->qemu = g_new0(VersionTriple, 1);
|
||||
err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
|
||||
assert(err == 0);
|
||||
tmp++;
|
||||
|
||||
err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->minor);
|
||||
assert(err == 0);
|
||||
tmp++;
|
||||
|
||||
err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
|
||||
assert(err == 0);
|
||||
info->qemu->major = QEMU_VERSION_MAJOR;
|
||||
info->qemu->minor = QEMU_VERSION_MINOR;
|
||||
info->qemu->micro = QEMU_VERSION_MICRO;
|
||||
info->package = g_strdup(QEMU_PKGVERSION);
|
||||
|
||||
return info;
|
||||
|
||||
@@ -7,7 +7,13 @@ while read line; do
|
||||
case $line in
|
||||
VERSION=*) # configuration
|
||||
version=${line#*=}
|
||||
major=$(echo "$version" | cut -d. -f1)
|
||||
minor=$(echo "$version" | cut -d. -f2)
|
||||
micro=$(echo "$version" | cut -d. -f3)
|
||||
echo "#define QEMU_VERSION \"$version\""
|
||||
echo "#define QEMU_VERSION_MAJOR $major"
|
||||
echo "#define QEMU_VERSION_MINOR $minor"
|
||||
echo "#define QEMU_VERSION_MICRO $micro"
|
||||
;;
|
||||
qemu_*dir=*) # qemu-specific directory configuration
|
||||
name=${line%=*}
|
||||
|
||||
+49
-34
@@ -84,10 +84,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out,
|
||||
|
||||
|
||||
def gen_marshal_proto(name):
|
||||
ret = 'void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)' % c_name(name)
|
||||
if not middle_mode:
|
||||
ret = 'static ' + ret
|
||||
return ret
|
||||
return 'void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)' % c_name(name)
|
||||
|
||||
|
||||
def gen_marshal_decl(name):
|
||||
@@ -98,6 +95,8 @@ def gen_marshal_decl(name):
|
||||
|
||||
|
||||
def gen_marshal(name, arg_type, boxed, ret_type):
|
||||
have_args = arg_type and not arg_type.is_empty()
|
||||
|
||||
ret = mcgen('''
|
||||
|
||||
%(proto)s
|
||||
@@ -112,17 +111,31 @@ def gen_marshal(name, arg_type, boxed, ret_type):
|
||||
''',
|
||||
c_type=ret_type.c_type())
|
||||
|
||||
if arg_type and not arg_type.is_empty():
|
||||
if have_args:
|
||||
visit_members = ('visit_type_%s_members(v, &arg, &err);'
|
||||
% arg_type.c_name())
|
||||
ret += mcgen('''
|
||||
Visitor *v;
|
||||
%(c_name)s arg = {0};
|
||||
|
||||
''',
|
||||
c_name=arg_type.c_name())
|
||||
else:
|
||||
visit_members = ''
|
||||
ret += mcgen('''
|
||||
Visitor *v = NULL;
|
||||
|
||||
if (args) {
|
||||
''')
|
||||
push_indent()
|
||||
|
||||
ret += mcgen('''
|
||||
v = qmp_input_visitor_new(QOBJECT(args), true);
|
||||
visit_start_struct(v, NULL, NULL, 0, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
visit_type_%(c_name)s_members(v, &arg, &err);
|
||||
%(visit_members)s
|
||||
if (!err) {
|
||||
visit_check_struct(v, &err);
|
||||
}
|
||||
@@ -131,35 +144,47 @@ def gen_marshal(name, arg_type, boxed, ret_type):
|
||||
goto out;
|
||||
}
|
||||
''',
|
||||
c_name=arg_type.c_name())
|
||||
visit_members=visit_members)
|
||||
|
||||
else:
|
||||
if not have_args:
|
||||
pop_indent()
|
||||
ret += mcgen('''
|
||||
|
||||
(void)args;
|
||||
}
|
||||
''')
|
||||
|
||||
ret += gen_call(name, arg_type, boxed, ret_type)
|
||||
|
||||
# 'goto out' produced above for arg_type, and by gen_call() for ret_type
|
||||
if (arg_type and not arg_type.is_empty()) or ret_type:
|
||||
ret += mcgen('''
|
||||
ret += mcgen('''
|
||||
|
||||
out:
|
||||
''')
|
||||
ret += mcgen('''
|
||||
error_propagate(errp, err);
|
||||
''')
|
||||
if arg_type and not arg_type.is_empty():
|
||||
ret += mcgen('''
|
||||
visit_free(v);
|
||||
''')
|
||||
|
||||
if have_args:
|
||||
visit_members = ('visit_type_%s_members(v, &arg, NULL);'
|
||||
% arg_type.c_name())
|
||||
else:
|
||||
visit_members = ''
|
||||
ret += mcgen('''
|
||||
if (args) {
|
||||
''')
|
||||
push_indent()
|
||||
|
||||
ret += mcgen('''
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_start_struct(v, NULL, NULL, 0, NULL);
|
||||
visit_type_%(c_name)s_members(v, &arg, NULL);
|
||||
%(visit_members)s
|
||||
visit_end_struct(v, NULL);
|
||||
visit_free(v);
|
||||
''',
|
||||
c_name=arg_type.c_name())
|
||||
visit_members=visit_members)
|
||||
|
||||
if not have_args:
|
||||
pop_indent()
|
||||
ret += mcgen('''
|
||||
}
|
||||
''')
|
||||
|
||||
ret += mcgen('''
|
||||
}
|
||||
@@ -209,8 +234,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
|
||||
self._visited_ret_types = set()
|
||||
|
||||
def visit_end(self):
|
||||
if not middle_mode:
|
||||
self.defn += gen_registry(self._regy)
|
||||
self.defn += gen_registry(self._regy)
|
||||
self._regy = None
|
||||
self._visited_ret_types = None
|
||||
|
||||
@@ -222,21 +246,12 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
|
||||
if ret_type and ret_type not in self._visited_ret_types:
|
||||
self._visited_ret_types.add(ret_type)
|
||||
self.defn += gen_marshal_output(ret_type)
|
||||
if middle_mode:
|
||||
self.decl += gen_marshal_decl(name)
|
||||
self.decl += gen_marshal_decl(name)
|
||||
self.defn += gen_marshal(name, arg_type, boxed, ret_type)
|
||||
if not middle_mode:
|
||||
self._regy += gen_register_command(name, success_response)
|
||||
self._regy += gen_register_command(name, success_response)
|
||||
|
||||
|
||||
middle_mode = False
|
||||
|
||||
(input_file, output_dir, do_c, do_h, prefix, opts) = \
|
||||
parse_command_line("m", ["middle"])
|
||||
|
||||
for o, a in opts:
|
||||
if o in ("-m", "--middle"):
|
||||
middle_mode = True
|
||||
(input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line()
|
||||
|
||||
c_comment = '''
|
||||
/*
|
||||
|
||||
@@ -198,6 +198,26 @@ static void test_qga_ping(gconstpointer fix)
|
||||
QDECREF(ret);
|
||||
}
|
||||
|
||||
static void test_qga_invalid_args(gconstpointer fix)
|
||||
{
|
||||
const TestFixture *fixture = fix;
|
||||
QDict *ret, *error;
|
||||
const gchar *class, *desc;
|
||||
|
||||
ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', "
|
||||
"'arguments': {'foo': 42 }}");
|
||||
g_assert_nonnull(ret);
|
||||
|
||||
error = qdict_get_qdict(ret, "error");
|
||||
class = qdict_get_try_str(error, "class");
|
||||
desc = qdict_get_try_str(error, "desc");
|
||||
|
||||
g_assert_cmpstr(class, ==, "GenericError");
|
||||
g_assert_cmpstr(desc, ==, "QMP input object member 'foo' is unexpected");
|
||||
|
||||
QDECREF(ret);
|
||||
}
|
||||
|
||||
static void test_qga_invalid_cmd(gconstpointer fix)
|
||||
{
|
||||
const TestFixture *fixture = fix;
|
||||
@@ -911,6 +931,7 @@ int main(int argc, char **argv)
|
||||
g_test_add_data_func("/qga/file-write-read", &fix, test_qga_file_write_read);
|
||||
g_test_add_data_func("/qga/get-time", &fix, test_qga_get_time);
|
||||
g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd);
|
||||
g_test_add_data_func("/qga/invalid-args", &fix, test_qga_invalid_args);
|
||||
g_test_add_data_func("/qga/fsfreeze-status", &fix,
|
||||
test_qga_fsfreeze_status);
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ static void test_dispatch_cmd(void)
|
||||
static void test_dispatch_cmd_failure(void)
|
||||
{
|
||||
QDict *req = qdict_new();
|
||||
QDict *args = qdict_new();
|
||||
QObject *resp;
|
||||
|
||||
qdict_put_obj(req, "execute", QOBJECT(qstring_from_str("user_def_cmd2")));
|
||||
@@ -116,6 +117,20 @@ static void test_dispatch_cmd_failure(void)
|
||||
|
||||
qobject_decref(resp);
|
||||
QDECREF(req);
|
||||
|
||||
/* check that with extra arguments it throws an error */
|
||||
req = qdict_new();
|
||||
qdict_put(args, "a", qint_from_int(66));
|
||||
qdict_put(req, "arguments", args);
|
||||
|
||||
qdict_put_obj(req, "execute", QOBJECT(qstring_from_str("user_def_cmd")));
|
||||
|
||||
resp = qmp_dispatch(QOBJECT(req));
|
||||
assert(resp != NULL);
|
||||
assert(qdict_haskey(qobject_to_qdict(resp), "error"));
|
||||
|
||||
qobject_decref(resp);
|
||||
QDECREF(req);
|
||||
}
|
||||
|
||||
static QObject *test_qmp_dispatch(QDict *req)
|
||||
|
||||
@@ -98,7 +98,6 @@ qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p"
|
||||
|
||||
# monitor.c
|
||||
handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
|
||||
monitor_protocol_emitter(void *mon) "mon %p"
|
||||
monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
|
||||
monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
|
||||
monitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64
|
||||
|
||||
Reference in New Issue
Block a user