b70d6afe | 07-Oct-2018 |
Bishara AbuHattoum <bishara@daynix.com> |
qga-win: changing --retry-path option behavior
Currently whenever the qemu-ga's service doesn't find the virtio-serial the run_agent() loops in a QGA_RETRY_INTERVAL (default 5 seconds) intervals and
qga-win: changing --retry-path option behavior
Currently whenever the qemu-ga's service doesn't find the virtio-serial the run_agent() loops in a QGA_RETRY_INTERVAL (default 5 seconds) intervals and try to restart the qemu-ga which causes a synchronous loop. Changed to wait and listen for the serial events by registering for notifications a proper serial event handler that deals with events: DBT_DEVICEARRIVAL indicates that the device has been inserted and is available DBT_DEVICEREMOVECOMPLETE indicates that the devive has been removed Which allow us to determine when the channel path is available for the qemu-ga to restart.
Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
a2c1ac4e | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga-win: report specific error when failing to open channel
Useful in general, but especially now that errors might occur more frequently with --retry-path set.
Signed-off-by: Michael Roth <mdroth@
qga-win: report specific error when failing to open channel
Useful in general, but especially now that errors might occur more frequently with --retry-path set.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
ebc88c0e | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga-win: install service with --retry-path set by default
It's nicer from a management perspective that the agent can survive hotplug/unplug of the channel device, or be started prior to the install
qga-win: install service with --retry-path set by default
It's nicer from a management perspective that the agent can survive hotplug/unplug of the channel device, or be started prior to the installation of the channel device's driver without and still be able to resume normal function afterward. On linux there are alternatives like systemd to support this, but on w32 --retry-path is the only option so it makes sense to set it by default when installed as a w32 service.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
d951fada | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga: add --retry-path option for re-initializing channel on failure
This adds an option to instruct the agent to periodically attempt re-opening the communication channel after a channel error has o
qga: add --retry-path option for re-initializing channel on failure
This adds an option to instruct the agent to periodically attempt re-opening the communication channel after a channel error has occurred. The main use-case for this is providing an OS-independent way of allowing the agent to survive situations like hotplug/unplug of the communication channel, or initial guest set up where the agent may be installed/started prior to the installation of the channel device's driver.
There are nicer ways of implementing this functionality via things like systemd services, but this option is useful for platforms like *BSD/w32.
Currently a channel error will result in the GSource for that channel being removed from the GMainLoop, but the main loop continuing to run. That behavior results in a dead loop when --retry-path isn't set, and prevents us from knowing when to attempt re-opening the channel when it is set, so we also force the loop to exit as part of this patch.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
d88495a8 | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga: move w32 service handling out of run_agent()
Eventually we want a w32 service to be able to restart the qga main loop from within service_main(). To allow for this we move service handling out
qga: move w32 service handling out of run_agent()
Eventually we want a w32 service to be able to restart the qga main loop from within service_main(). To allow for this we move service handling out of run_agent() such that service_main() calls run_agent() instead of the reverse.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
0f4d3a49 | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga: hang GAConfig/socket_activation off of GAState global
For w32 services we rely on the global GAState to access resources associated with the agent within service_main(). Currently this is suffi
qga: hang GAConfig/socket_activation off of GAState global
For w32 services we rely on the global GAState to access resources associated with the agent within service_main(). Currently this is sufficient for starting the agent since we open the channel once prior to calling service_main(), and simply start the GMainLoop to start the agent from within service_main().
Eventually we want to be able to also [re-]open the communication channel from within service_main(), which requires access to config/socket_activation variables, so we hang them off GAState in preparation for that.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> *dont move GAConfig struct, just the typedef *fix build bisect for w32 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
50d5b3c4 | 07-Oct-2018 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qga: group agent init/cleanup init separate routines
This patch better separates the init/cleanup routines out into separate functions to make the start-up procedure a bit easier to follow. This wil
qga: group agent init/cleanup init separate routines
This patch better separates the init/cleanup routines out into separate functions to make the start-up procedure a bit easier to follow. This will be useful when we eventually break out the actual start/stop of the agent's main loop into separates routines that can be called multiple times after the init phase.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
d9c85b6c | 17-Oct-2018 |
Li Qiang <liq3ea@gmail.com> |
qga: fix an off-by-one issue
Signed-off-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> |
7fae5184 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: demystify namespace stripping
It was not obvious what exactly the cryptic string copying does to the GUID. This change makes the intent clearer.
Signed-off-by: Tomáš Golembiovský <tgolembi
qga-win: demystify namespace stripping
It was not obvious what exactly the cryptic string copying does to the GUID. This change makes the intent clearer.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
4550dee8 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: return disk device in guest-get-fsinfo
Report device UNC of the disk. It is reported as "\\.\PhysicalDriveX".
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael
qga-win: return disk device in guest-get-fsinfo
Report device UNC of the disk. It is reported as "\\.\PhysicalDriveX".
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
b1ba8890 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: handle multi-disk volumes
Probe the volume for disk extents and return list of all disks. Originally only first disk of composite volume was returned.
Note that the patch changes get_pci_i
qga-win: handle multi-disk volumes
Probe the volume for disk extents and return list of all disks. Originally only first disk of composite volume was returned.
Note that the patch changes get_pci_info() from one state of brokenness into a different state of brokenness. In other words it still does not do what it's supposed to do (see comment in code). If anyone knows how to fix it, please step in.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
9e65fd65 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: refactor disk info
Refactor building of disk info into a function that builds the list and a function that returns infor for single disk. This will be used in future commit that will handle
qga-win: refactor disk info
Refactor building of disk info into a function that builds the list and a function that returns infor for single disk. This will be used in future commit that will handle multi-disk volumes.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
fb08aa70 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: report disk serial number
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> *coding style fix-ups (declarations at beginning of block) *improve readability for user-visible errors *co
qga-win: report disk serial number
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> *coding style fix-ups (declarations at beginning of block) *improve readability for user-visible errors *cover additional edge-cases with debug statements Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
c76d70f4 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: refactor disk properties (bus)
Refactor code that queries bus type to be more generic. The function get_disk_bus_type() has been renamed to build_guest_disk_info(). Following commit(s) will
qga-win: refactor disk properties (bus)
Refactor code that queries bus type to be more generic. The function get_disk_bus_type() has been renamed to build_guest_disk_info(). Following commit(s) will extend this function.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
222682ab | 29-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga-win: add debugging information
The windows code generaly lacks debug information (compared to posix code). This patch adds some related to HW info in guest-get-fsinfo command.
Signed-off-by: To
qga-win: add debugging information
The windows code generaly lacks debug information (compared to posix code). This patch adds some related to HW info in guest-get-fsinfo command.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
6880b94f | 23-Oct-2018 |
Sameeh Jubran <sjubran@redhat.com> |
qga-win: fsinfo: pci-info: allow partial info
The call to SetupDiGetDeviceRegistryProperty might fail because the value doesn't exist in the registry, in this case we shouldn't exit from the loop bu
qga-win: fsinfo: pci-info: allow partial info
The call to SetupDiGetDeviceRegistryProperty might fail because the value doesn't exist in the registry, in this case we shouldn't exit from the loop but instead continue to look for other available values in the registry and set this value as unavailable (-1).
Signed-off-by: Sameeh Jubran <sjubran@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> *squash in fix for when get_pci_info() returns NULL pci_controller field *fix handling for error_set() cases in get_pci_info(), not just NULL return *force all -1 PCI addr fields if any single one of them isn't found Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
0d7f937e | 23-Oct-2018 |
Sameeh Jubran <sjubran@redhat.com> |
qga-win: prevent crash when executing fsinfo command
The fsinfo command is currently implemented for Windows only and it's disk parameter can be enabled by adding the define "CONFIG_QGA_NTDDSCSI" to
qga-win: prevent crash when executing fsinfo command
The fsinfo command is currently implemented for Windows only and it's disk parameter can be enabled by adding the define "CONFIG_QGA_NTDDSCSI" to the qga code. When enabled and executed the qemu-ga crashed with the following message:
------------------------------------------------ File qapi/qapi-visit-core.c, Line 49
Expression: !(v->type & VISITOR_OUTPUT) || *obj) ------------------------------------------------
After some digging, turns out that the GuestPCIAddress is null and the qapi visitor doesn't like that, so we can always allocate it instead and initiate all it's members to -1.
Signed-off-by: Sameeh Jubran <sjubran@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
6589ce35 | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga: linux: return disk device in guest-get-fsinfo
Report device node of the disk on Linux (e.g. "/dev/sda2"). Requirs libudev.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by
qga: linux: return disk device in guest-get-fsinfo
Report device node of the disk on Linux (e.g. "/dev/sda2"). Requirs libudev.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
b616105a | 23-Oct-2018 |
Tomáš Golembiovský <tgolembi@redhat.com> |
qga: linux: report disk serial number
Add reporting of disk serial number on Linux guests. The feature depends on libudev.
Example:
{ "name": "dm-2", "mountpoint": "/", ...
qga: linux: report disk serial number
Add reporting of disk serial number on Linux guests. The feature depends on libudev.
Example:
{ "name": "dm-2", "mountpoint": "/", ... "disk": [ { "serial": "SAMSUNG_MZ7LN512HCHP-000L1_S1ZKNXAG822493", ... } ], }
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
b4bf912a | 06-Sep-2018 |
Igor Mammedov <imammedo@redhat.com> |
qga: ignore non present cpus when handling qmp_guest_get_vcpus()
If VM has VCPUs plugged sparselly (for example a VM started with 3 VCPUs (cpu0, cpu1 and cpu2) and then cpu1 was hotunplugged so only
qga: ignore non present cpus when handling qmp_guest_get_vcpus()
If VM has VCPUs plugged sparselly (for example a VM started with 3 VCPUs (cpu0, cpu1 and cpu2) and then cpu1 was hotunplugged so only cpu0 and cpu2 are present), QGA will rise a error error: internal error: unable to execute QEMU agent command 'guest-get-vcpus': open("/sys/devices/system/cpu/cpu1/"): No such file or directory when virsh vcpucount FOO --guest is executed. Fix it by ignoring non present CPUs when fetching CPUs status from sysfs.
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
0692b03e | 31-Aug-2018 |
Chen Hanxiao <chenhanxiao@gmail.com> |
qga-win: add support for qmp_guest_fsfreeze_freeze_list
This patch add support for freeze specified fs.
The valid mountpoints list member are [1]:
The path of a mounted folder, for example, Y:\M
qga-win: add support for qmp_guest_fsfreeze_freeze_list
This patch add support for freeze specified fs.
The valid mountpoints list member are [1]:
The path of a mounted folder, for example, Y:\MountX\ A drive letter, for example, D:\ A volume GUID path of the form \\?\Volume{GUID}\, where GUID identifies the volume A UNC path that specifies a remote file share, for example, \\Clusterx\Share1\
[1] https://docs.microsoft.com/en-us/windows/desktop/api/vsbackup/nf-vsbackup-ivssbackupcomponents-addtosnapshotset
Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
bad0227d | 01-Aug-2018 |
Jonathon Reinhart <jreinhart@cc-sw.com> |
qga: Support Unicode paths in guest-file-open on win32
Currently, the win32 port of QEMU Guest Agent does not properly handle Unicode paths. The JSON decoder produces a valid UTF-8 path string, but
qga: Support Unicode paths in guest-file-open on win32
Currently, the win32 port of QEMU Guest Agent does not properly handle Unicode paths. The JSON decoder produces a valid UTF-8 path string, but this is passed directly to CreateFileA, which is expecting an ANSI string and not UTF-8. This leads to mangled filenames.
This patch follows the example of qmp_guest_set_user_password() and uses g_utf8_to_utf16() to convert the string to UTF-16 and calls CreateFileW() explicitly.
Signed-off-by: Jonathon Reinhart <jreinhart@cc-sw.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
9e6bdef2 | 31-Aug-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
util: add qemu_write_pidfile()
There are variants of qemu_create_pidfile() in qemu-pr-helper and qemu-ga. Let's have a common implementation in libqemuutil.
The code is initially based from pr-help
util: add qemu_write_pidfile()
There are variants of qemu_create_pidfile() in qemu-pr-helper and qemu-ga. Let's have a common implementation in libqemuutil.
The code is initially based from pr-helper write_pidfile(), with various improvements and suggestions from Daniel Berrangé:
QEMU will leave the pidfile existing on disk when it exits which initially made me think it avoids the deletion race. The app managing QEMU, however, may well delete the pidfile after it has seen QEMU exit, and even if the app locks the pidfile before deleting it, there is still a race.
eg consider the following sequence
QEMU 1 libvirtd QEMU 2
1. lock(pidfile)
2. exit()
3. open(pidfile)
4. lock(pidfile)
5. open(pidfile)
6. unlink(pidfile)
7. close(pidfile)
8. lock(pidfile)
IOW, at step 8 the new QEMU has successfully acquired the lock, but the pidfile no longer exists on disk because it was deleted after the original QEMU exited.
While we could just say no external app should ever delete the pidfile, I don't think that is satisfactory as people don't read docs, and admins don't like stale pidfiles being left around on disk.
To make this robust, I think we might want to copy libvirt's approach to pidfile acquisition which runs in a loop and checks that the file on disk /after/ acquiring the lock matches the file that was locked. Then we could in fact safely let QEMU delete its own pidfiles on clean exit..
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180831145314.14736-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
86cdf9ec | 23-Aug-2018 |
Markus Armbruster <armbru@redhat.com> |
json: Clean up headers
The JSON parser has three public headers, json-lexer.h, json-parser.h, json-streamer.h. They all contain stuff that is of no interest outside qobject/json-*.c.
Collect the p
json: Clean up headers
The JSON parser has three public headers, json-lexer.h, json-parser.h, json-streamer.h. They all contain stuff that is of no interest outside qobject/json-*.c.
Collect the public interface in include/qapi/qmp/json-parser.h, and everything else in qobject/json-parser-int.h.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-54-armbru@redhat.com>
show more ...
|
84a56f38 | 23-Aug-2018 |
Markus Armbruster <armbru@redhat.com> |
json: Pass lexical errors and limit violations to callback
The callback to consume JSON values takes QObject *json, Error *err. If both are null, the callback is supposed to make up an error by itse
json: Pass lexical errors and limit violations to callback
The callback to consume JSON values takes QObject *json, Error *err. If both are null, the callback is supposed to make up an error by itself. This sucks.
qjson.c's consume_json() neglects to do so, which makes qobject_from_json() null instead of failing. I consider that a bug.
The culprit is json_message_process_token(): it passes two null pointers when it runs into a lexical error or a limit violation. Fix it to pass a proper Error object then. Update the callbacks:
* monitor.c's handle_qmp_command(): the code to make up an error is now dead, drop it.
* qga/main.c's process_event(): lumps the "both null" case together with the "not a JSON object" case. The former is now gone. The error message "Invalid JSON syntax" is misleading for the latter. Improve it to "Input must be a JSON object".
* qobject/qjson.c's consume_json(): no update; check-qjson demonstrates qobject_from_json() now sets an error on lexical errors, but still doesn't on some other errors.
* tests/libqtest.c's qmp_response(): the Error object is now reliable, so use it to improve the error message.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-40-armbru@redhat.com>
show more ...
|