summaryrefslogtreecommitdiff
path: root/qga/main.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-19qapi: Replace qobject_to_X(o) by qobject_to(X, o)Max Reitz1-1/+1
This patch was generated using the following Coccinelle script: @@ expression Obj; @@ ( - qobject_to_qnum(Obj) + qobject_to(QNum, Obj) | - qobject_to_qstring(Obj) + qobject_to(QString, Obj) | - qobject_to_qdict(Obj) + qobject_to(QDict, Obj) | - qobject_to_qlist(Obj) + qobject_to(QList, Obj) | - qobject_to_qbool(Obj) + qobject_to(QBool, Obj) ) and a bit of manual fix-up for overly long lines and three places in tests/check-qjson.c that Coccinelle did not find. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20180224154033.29559-4-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: swap order from qobject_to(o, X), rebase to master, also a fix to latent false-positive compiler complaint about hw/i386/acpi-build.c] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-12Polish the version strings containing the package versionThomas Huth1-1/+1
Since commit 67a1de0d195a there is no space anymore between the version number and the parentheses when running configure with --with-pkgversion=foo : $ qemu-system-s390x --version QEMU emulator version 2.11.50(foo) But the space is included when building without that option when building from a git checkout: $ qemu-system-s390x --version QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty) The same confusion exists with the "query-version" QMP command. Let's fix this by introducing a proper QEMU_FULL_VERSION definition that includes the space and parentheses, while the QEMU_PKGVERSION should just cleanly contain the package version string itself. Note that this also changes the behavior of the "query-version" QMP command (the space and parentheses are not included there anymore), but that's supposed to be OK since the strings there are not meant to be parsed by other tools. Fixes: 67a1de0d195a6185c39b436159c9ffc7720bf979 Buglink: https://bugs.launchpad.net/qemu/+bug/1673373 Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-02qapi: Move qapi-schema.json to qapi/, rename generated filesMarkus Armbruster1-1/+1
Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules. Consistently name the generated files qapi-MODULE.EXT: qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py, scripts/qapi/events.py, and scripts/qapi/common.py. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180211093607.27351-28-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> [eblake: Fix trailing dot in tpm.c, undo temporary hack for OSX toolchain] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-02-09Drop superfluous includes of qapi/qmp/dispatch.hMarkus Armbruster1-1/+0
Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-18-armbru@redhat.com>
2018-02-09Include qapi/qmp/qstring.h exactly where neededMarkus Armbruster1-0/+1
Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-14-armbru@redhat.com>
2018-02-09Include qapi/qmp/qdict.h exactly where neededMarkus Armbruster1-0/+1
This cleanup makes the number of objects depending on qapi/qmp/qdict.h drop from 4550 (out of 4743) to 368 in my "build everything" tree. For qapi/qmp/qobject.h, the number drops from 4552 to 390. While there, separate #include from file comment with a blank line. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-13-armbru@redhat.com>
2018-02-09Include qmp-commands.h exactly where neededMarkus Armbruster1-0/+1
Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-7-armbru@redhat.com> [OSX breakage fixed]
2018-02-09Include qapi/error.h exactly where neededMarkus Armbruster1-0/+2
This cleanup makes the number of objects depending on qapi/error.h drop from 1910 (out of 4743) to 1612 in my "build everything" tree. While there, separate #include from file comment with a blank line, and drop a useless comment on why qemu/osdep.h is included first. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-5-armbru@redhat.com> [Semantic conflict with commit 34e304e975 resolved, OSX breakage fixed]
2017-08-08maint: Include bug-reporting info in --help outputEric Blake1-1/+1
These days, many programs are including a bug-reporting address, or better yet, a link to the project web site, at the tail of their --help output. However, we were not very consistent at doing so: only qemu-nbd and qemu-qa mentioned anything, with the latter pointing to an individual person instead of the project. Add a new #define that sets up a uniform string, mentioning both bug reporting instructions and overall project details, and which a downstream vendor could tweak if they want bugs to go to a downstream database. Then use it in all of our binaries which have --help output. The canned text intentionally references http:// instead of https:// because our https website currently causes certificate errors in some browsers. That can be tweaked later once we have resolved the web site issued. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170803163353.19558-5-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08qga: Give more --version informationEric Blake1-2/+4
Include the package version information (useful for detecting builds from git or downstream backports), and the copyright notice. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <20170803163353.19558-4-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-07-17qga: report error on keyfile dump errorMarc-André Lureau1-1/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc:qemu-trivial@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-07-17qga-win32: remove a redundancy codePeng Hao1-1/+1
In the first line of run_agent,it has set ga_state = s,don't need set ga_state = s again behind. Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-06-20qapi: merge QInt and QFloat in QNumMarc-André Lureau1-1/+0
We would like to use a same QObject type to represent numbers, whether they are int, uint, or floats. Getters will allow some compatibility between the various types if the number fits other representations. Add a few more tests while at it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170607163635.17635-7-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [parse_stats_intervals() simplified a bit, comment in test_visitor_in_int_overflow() tidied up, suppress bogus warnings] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-05-09sockets: Limit SocketAddressLegacy to external interfacesMarkus Armbruster1-4/+4
SocketAddressLegacy is a simple union, and simple unions are awkward: they have their variant members wrapped in a "data" object on the wire, and require additional indirections in C. SocketAddress is the equivalent flat union. Convert all users of SocketAddressLegacy to SocketAddress, except for existing external interfaces. See also commit fce5d53..9445673 and 85a82e8..c5f1ae3. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1493192202-3184-7-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Minor editing accident fixed, commit message and a comment tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-05-09sockets: Rename SocketAddress to SocketAddressLegacyMarkus Armbruster1-4/+4
The next commit will rename SocketAddressFlat to SocketAddress, and the commit after that will replace most uses of SocketAddressLegacy by SocketAddress, replacing most of this commit's renames right back. Note that checkpatch emits a few "line over 80 characters" warnings. The long lines are all temporary; the SocketAddressLegacy replacement will shorten them again. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1493192202-3184-5-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-04-26qga-win: Fix a bug where qemu-ga service is stuck during stop operationSameeh Jubran1-0/+23
After triggering a freeze command without any following thaw command, qemu-ga will not respond to stop operation. This behaviour is wanted on Linux as there is no time limit for a freeze command and we want to prevent quitting in the middle of freeze, on the other hand on Windows the time limit for freeze is 10 seconds, so we should wait for the timeout, thaw the file system and quit. Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-03-19qemu-ga: obey LISTEN_PID when using systemd socket activationPaolo Bonzini1-38/+13
qemu-ga's socket activation support was not obeying the LISTEN_PID environment variable, which avoids that a process uses a socket-activation file descriptor meant for its parent. Mess can for example ensue if a process forks a children before consuming the socket-activation file descriptor and therefore setting O_CLOEXEC on it. Luckily, qemu-nbd also got socket activation code, and its copy does support LISTEN_PID. Some extra fixups are needed to ensure that the code can be used for both, but that's what this patch does. The main change is to replace get_listen_fds's "consume" argument with the FIRST_SOCKET_ACTIVATION_FD macro from the qemu-nbd code. Cc: "Richard W.M. Jones" <rjones@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-03-07Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2017-03-06-tag' ↵Peter Maydell1-5/+69
into staging qemu-ga patch queue for 2.9 * fix fsfreeze for filesystems mounted in multiple locations * fix test failure when running in a chroot * support for socket-based activation # gpg: Signature made Mon 06 Mar 2017 07:54:17 GMT # gpg: using RSA key 0x3353C9CEF108B584 # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" # gpg: aka "Michael Roth <mdroth@utexas.edu>" # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" # Primary key fingerprint: CEAC C9E1 5534 EBAB B82D 3FA0 3353 C9CE F108 B584 * remotes/mdroth/tags/qga-pull-2017-03-06-tag: tests: check path to avoid a failing qga/get-vcpus test qga: ignore EBUSY when freezing a filesystem qga: add systemd socket activation support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-03-06qga: add systemd socket activation supportStefan Hajnoczi1-5/+69
AF_UNIX and AF_VSOCK listen sockets can be passed in by systemd on startup. This allows systemd to manage the listen socket until the first client connects and between restarts. Advantages of socket activation are that parallel startup of network services becomes possible and that unused daemons do not consume memory. The key to achieving this is the LISTEN_FDS environment variable, which is a stable ABI as shown here: https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/ We could link against libsystemd and use sd_listen_fds(3) but it's easy to implement the tiny LISTEN_FDS ABI so that qemu-ga does not depend on libsystemd. Some systems may not have systemd installed and wish to avoid the dependency. Other init systems or socket activation servers may implement the same ABI without systemd involvement. Test as follows: $ cat ~/.config/systemd/user/qga.service [Unit] Description=qga [Service] WorkingDirectory=/tmp ExecStart=/path/to/qemu-ga --logfile=/tmp/qga.log --pidfile=/tmp/qga.pid --statedir=/tmp $ cat ~/.config/systemd/user/qga.socket [Socket] ListenStream=/tmp/qga.sock [Install] WantedBy=default.target $ systemctl --user daemon-reload $ systemctl --user start qga.socket $ nc -U /tmp/qga.sock Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-03-05qapi: Support multiple command registries per programMarkus Armbruster1-9/+10
The command registry encapsulates a single command list. Give the functions using it a parameter instead. Define suitable command lists in monitor, guest agent and test-qmp-commands. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1488544368-30622-6-git-send-email-armbru@redhat.com> [Debugging turds buried] Reviewed-by: Eric Blake <eblake@redhat.com>
2017-03-05qmp: Dumb down how we run QMP command registrationMarkus Armbruster1-1/+1
The way we get QMP commands registered is high tech: * qapi-commands.py generates qmp_init_marshal() that does the actual work * it also generates the magic to register it as a MODULE_INIT_QAPI function, so it runs when someone calls module_call_init(MODULE_INIT_QAPI) * main() calls module_call_init() QEMU needs to register a few non-qapified commands. Same high tech works: monitor.c has its own qmp_init_marshal() along with the magic to make it run in module_call_init(MODULE_INIT_QAPI). QEMU also needs to unregister commands that are not wanted in this build's configuration (commit 5032a16). Simple enough: qmp_unregister_commands_hack(). The difficulty is to make it run after the generated qmp_init_marshal(). We can't simply run it in monitor.c's qmp_init_marshal(), because the order in which the registered functions run is indeterminate. So qmp_init_marshal() registers qmp_unregister_commands_hack() separately. Since registering *appends* to the list of registered functions, this will make it run after all the functions that have been registered already. I suspect it takes a long and expensive computer science education to not find this silly. Dumb it down as follows: * Drop MODULE_INIT_QAPI entirely * Give the generated qmp_init_marshal() external linkage. * Call it instead of module_call_init(MODULE_INIT_QAPI) * Except in QEMU proper, call new monitor_init_qmp_commands() that in turn calls the generated qmp_init_marshal(), registers the additional commands and unregisters the unwanted ones. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-5-git-send-email-armbru@redhat.com>
2017-01-24qga: fix erroneous argument to strerrorPaolo Bonzini1-2/+2
process_command returns a negative value in case of error. Make this clear in the "if" statement and fix the strerror argument to flip it to positive. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-10-31qga: add vsock-listen methodStefan Hajnoczi1-2/+4
Add AF_VSOCK (virtio-vsock) support as an alternative to virtio-serial. $ qemu-system-x86_64 -device vhost-vsock-pci,guest-cid=3 ... (guest)# qemu-ga -m vsock-listen -p 3:1234 Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-09-08qga: free remaining leaking stateMarc-André Lureau1-0/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-09-08qga: free the whole blacklistMarc-André Lureau1-6/+1
Free the config blacklist list, not just the elements. Do it so in the more appropriate function config_free(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-06-07qga: Remove unnecessary glib.h includesPeter Maydell1-1/+0
Remove glib.h includes, as it is provided by osdep.h. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-03-24Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-1/+1
* Log filtering from Alex and Peter * Chardev fix from Marc-André * config.status tweak from David * Header file tweaks from Markus, myself and Veronia (Outreachy candidate) * get_ticks_per_sec() removal from Rutuja (Outreachy candidate) * Coverity fix from myself * PKE implementation from myself, based on rth's XSAVE support # gpg: Signature made Thu 24 Mar 2016 20:15:11 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (28 commits) target-i386: implement PKE for TCG config.status: Pass extra parameters char: translate from QIOChannel error to errno exec: fix error handling in file_ram_alloc cputlb: modernise the debug support qemu-log: support simple pid substitution for logs target-arm: dfilter support for in_asm qemu-log: dfilter-ise exec, out_asm, op and opt_op qemu-log: new option -dfilter to limit output qemu-log: Improve the "exec" TB execution logging qemu-log: Avoid function call for disabled qemu_log_mask logging qemu-log: correct help text for -d cpu tcg: pass down TranslationBlock to tcg_code_gen util: move declarations out of qemu-common.h Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND hw: explicitly include qemu-common.h and cpu.h include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h Move ParallelIOArg from qemu-common.h to sysemu/char.h Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: scripts/clean-includes
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa1-0/+1
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Clean up includes some moreMarkus Armbruster1-1/+0
Manually drop redundant includes that scripts/clean-includes misses, e.g. because they're hidden in generator programs, or they use the wrong kind of delimiter. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-20qemu-ga: drop unused local err variableStefan Hajnoczi1-6/+0
Commit 125b310e1d62e3a1dc1e7758563e598957ca7ae4 ("qemu-ga: move channel/transport functionality into wrapper class") stopped using the local err variable in channel_event_cb(). This patch deletes the unused variable. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-04qga: Clean up includesPeter Maydell1-4/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-9-git-send-email-peter.maydell@linaro.org
2015-11-26qjson: store tokens in a GQueuePaolo Bonzini1-1/+1
Even though we still have the "streamer" concept, the tokens can now be deleted as they are read. While doing so convert from QList to GQueue, since the next step will make tokens not a QObject and we will have to do the conversion anyway. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1448300659-23559-4-git-send-email-pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-29qdict: Make conversion from QObject * accept nullMarkus Armbruster1-8/+3
qobject_to_qdict() crashes on null, which is a trap for the unwary. Return null instead, and simplify a few callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-19qga: handle possible SIGPIPE in guest-file-writeDenis V. Lunev1-0/+6
qemu-ga should not exit on guest-file-write to pipe without read end but proper error code should be returned. The behavior of the spawned process should be default thus SIGPIPE processing should be reset to default after fork() but before exec(). Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-10-19qga: do not override configuration verbosityMarc-André Lureau1-2/+2
Move the default verbosity settings before loading the configuration file, or it will overwrite it. Found thanks to writing qga tests :) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-10-19qga: add QGA_CONF environment variableMarc-André Lureau1-1/+2
Having a environment variable allows to override default configuration path, useful for testing. Note that this can't easily be an argument, since loading config is done before parsing the arguments. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: add --dump-conf optionMarc-André Lureau1-0/+64
This new option allows to review the agent configuration, and ease the task of writing a configuration file. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> * removed unecessary keyfile != NULL prior to free * documented --dump-conf is qemu-ga --help output Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: add an optional qemu-ga.conf system configurationMarc-André Lureau1-7/+77
Learn to configure the agent with a system configuration. This may simplify command-line handling, especially when the blacklist is long. Among the other benefits, this may standardize the configuration of an init service (instead of distro-specific init keys/files) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> * removed unecessary keyfile != NULL prior to free Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: free a bit moreMarc-André Lureau1-2/+4
Now that main() has a single exit point, we can free a few more allocations. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: move agent run in a separate functionMarc-André Lureau1-76/+95
Once the options are populated, move the running state to a run_agent() function. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> * fixed up an s/ga_state/s/ artifact causing segfault * replaced g_list_free_full with g_list_foreach to maintain glib 2.22 compatibility Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: fill default options in main()Marc-André Lureau1-17/+17
Fill all default options during main(). This is a preparation patch to allow to dump the configuration. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: move option parsing to separate functionMarc-André Lureau1-69/+96
Move option parsing out of giant main(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: copy argument stringsMarc-André Lureau1-26/+31
Following patch will return allocated strings, so we must correctly initialize alloc & free them. The nice side effect is that we no longer have to check for "fixed_state_dir" to call ga_install_service() with a NULL state dir. The default values are set after parsing the command line options. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: rename 'path' to 'channel_path'Marc-André Lureau1-4/+5
'path' is already a global function, rename the variable since it's going to be in global scope in a later patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: make split_list() return allocated stringsMarc-André Lureau1-13/+9
In order to avoid any confusion, let's allocate new strings when splitting. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: move string split in separate functionMarc-André Lureau1-11/+22
The function is going to be reused in a later patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: use exit() when parsing optionsMarc-André Lureau1-12/+12
The option parsing is going to be moved to a separate function, use exit() consistently. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07Revert "guest agent: remove g_strcmp0 usage"Markus Armbruster1-1/+1
Since we now require GLib 2.22+ (commit f40685c), we don't have to work around lack of g_strcmp0() anymore. This reverts commit 8f4774789947bc4bc4c8d026a289fe980d3d2ee1. Conflicts: qemu-ga.c Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-06-22qerror: Clean up QERR_ macros to expand into a single stringMarkus Armbruster1-2/+2
These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae. The error class is always ERROR_CLASS_GENERIC_ERROR since the previous commit. Clean up as follows: * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and delete it from the QERR_ macro. No change after preprocessing. * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into error_setg(...). Again, no change after preprocessing. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-06-17qemu-ga: adding vss-[un]install optionsYossi Hindin1-1/+9
Existing command line options include '-s install' and '-s uninstall'. These options install/uninstall both Windows QEMU GA service and optional VSS COM server. The QEMU GA Windows service allows always-on serving guest agent's QMP commands and VSS COM server enables guest agent integration with Volume Shadow Service. This commit introdices new options '-s vss-install' and '-s vss-uninstall', affecting only GA VSS COM server registration. The new options are useful for registering and unregistering the COM server during MSI installation, upgrade and uninstallation. Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-2-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>