aboutsummaryrefslogtreecommitdiff
path: root/qga/commands-win32.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-07qga: Fix mingw compilation warnings on enum conversionCao Jiaxi1-1/+1
The win2qemu[] is supposed to be the conversion table to convert between STORAGE_BUS_TYPE in Windows SDK and GuestDiskBusType in qga. But it was incorrectly written that it forces to set a GuestDiskBusType value to STORAGE_BUS_TYPE, which generates an enum conversion warning in clang. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Cao Jiaxi <driver1998@foxmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 20190503003650.10137-1-driver1998@foxmail.com Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-03-18qga: Fix guest-get-fsinfo PCI address collection in WindowsMatt Hines1-107/+210
The Windows QEMU guest agent erroneously tries to collect PCI information directly from the physical drive. However, windows stores SCSI/IDE information with the drive and PCI information with the underlying storage controller This changes get_pci_info to use the physical drive's underlying storage controller to get PCI information. * Additionally Fixes incorrect size being passed to DeviceIoControl when getting volume extents. Can occasionally crash the guest agent Signed-off-by: Matt Hines <mhines@scalecomputing.com> *fix up some checkpatch warnings *fix domain reporting and add some sanity checks for debug Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-03-18qga-win: Adding support for Windows Server 2019 get-osinfo commandBishara AbuHattoum1-2/+27
Since Windows Server 2016, Microsoft stopped upgrading the major and minor versions of their new Windows Server product, so, the current functionality of checking major and minor version numbers to determine the Windows Server version wont work as expected. The implemented solution here is to use the build number in addition to the major and minor version numbers of the product to determine the Windows Server product version. The final build number of Windows Server 2016 is 14939, and the final build number of Windows Server 2019 is 17764, so any Windows Server product that has the major version of 10 and minor version of 0 with a build number lower or equal to 14939 will resemble 2016 and if the build number is lower or equal to 17763 will resemble 2019. Reference: https://techcommunity.microsoft.com/t5/Windows-Server-Insiders/Windows-Server-2019-version-info/m-p/293112/highlight/true#M859 Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-01-11qga: drop < Vista compatibilityMarc-André Lureau1-64/+0
Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building qemu-thread-win32.c, which requires Vista API since commit 12f8def0 (v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181122110039.15972-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11build-sys: build with Vista API by defaultMarc-André Lureau1-5/+1
Both qemu & qga build with Vista API by default already, by defining _WIN32_WINNT 0x0600. Set it globally in osdep.h instead. This replaces WINVER by _WIN32_WINNT in osdep.h. WINVER doesn't seem to be really useful these days. (see also https://blogs.msdn.microsoft.com/oldnewthing/20070411-00/?p=27283) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181122110039.15972-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-11-09qga-win: fix leaks of build_guest_disk_info()Marc-André Lureau1-1/+4
Introduced in commit b1ba8890e63ce9432c41c5c3fc229f54c87c9c99, vol_h handle should be closed, and "out" cleanup should be done after DeviceIoControl() fails. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga: fix an off-by-one issueLi Qiang1-1/+1
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>
2018-10-31qga-win: demystify namespace strippingTomáš Golembiovský1-1/+8
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>
2018-10-31qga-win: return disk device in guest-get-fsinfoTomáš Golembiovský1-10/+11
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>
2018-10-31qga-win: handle multi-disk volumesTomáš Golembiovský1-18/+108
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>
2018-10-31qga-win: refactor disk infoTomáš Golembiovský1-17/+35
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>
2018-10-31qga-win: report disk serial numberTomáš Golembiovský1-0/+30
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>
2018-10-31qga-win: refactor disk properties (bus)Tomáš Golembiovský1-18/+27
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>
2018-10-31qga-win: add debugging informationTomáš Golembiovský1-0/+15
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>
2018-10-31qga-win: fsinfo: pci-info: allow partial infoSameeh Jubran1-13/+33
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>
2018-10-31qga-win: prevent crash when executing fsinfo commandSameeh Jubran1-1/+5
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>
2018-10-30qga-win: add support for qmp_guest_fsfreeze_freeze_listChen Hanxiao1-12/+9
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>
2018-10-30qga: Support Unicode paths in guest-file-open on win32Jonathon Reinhart1-5/+19
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>
2018-07-23qga-win: Handle fstrim for OSes lower than Win8Sameeh Jubran1-0/+13
The defrag.exe tool which is used for executing the fstrim command on Windows doesn't support retrim for OSes lower than Win8. This commit handles this case and returns a suitable error. Output of fstrim before this commit: {"execute":"guest-fstrim"} {"return": {"paths": [{"path": "C:\\", "error": "An invalid command line option was specified. (0x89000008)"}, {"path": "F:\\", "error": "An invalid command line option was specified. (0x89000008)"}, {"path": "S:\\", "error": "An invalid command line option was specified. (0x89000008)"}]}} Reported on: https://bugzilla.redhat.com/show_bug.cgi?id=1594113 Signed-off-by: Sameeh Jubran <sjubran@redhat.com> * use alternative version query code proposed by Sameeh * fix up version check logic * avoid CamelCase variable names when possible Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-07-03qga-win: add driver path usage to GuestFilesystemInfoChen Hanxiao1-0/+12
This patch adds support for getting the usage of windows driver path. The usage of fs stored as used_bytes and total_bytes. 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>
2018-07-03qga: check bytes count read by guest-file-readPrasad J Pandit1-1/+1
While reading file content via 'guest-file-read' command, 'qmp_guest_file_read' routine allocates buffer of count+1 bytes. It could overflow for large values of 'count'. Add check to avoid it. Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-06-01qga: use local path for local headersMichael S. Tsirkin1-2/+2
When pulling in headers that are in the same directory as the C file (as opposed to one in include/), we should use its relative path, without a directory. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
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-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-11-20qga: replace GetIfEntry with GetIfEntry2 for interface statsZhiPeng Lu1-16/+38
The data obtained by GetIfEntry is 32 bits, and it may overflow. Thus using GetIfEntry2 instead of GetIfEntry. Signed-off-by: ZhiPeng Lu <lu.zhipeng@zte.com.cn> *avoid CamelCase variable names *update field names for MIB_IFROW -> MIB_IF_ROW2 *dynamically probe for GetIfIndex2 to deal with older OSs *check return value from get_interface_index Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-10-25qga: add network stats to guest-network-get-interfacesZhiPeng Lu1-0/+50
we can get the network interface statistics inside a virtual machine by guest-network-get-interfaces command. it is very useful for us tomonitor and analyze network traffic. Signed-off-by: ZhiPeng Lu <lu.zhipeng@zte.com.cn> * don't rely on sizeof(wchar[]) for wchar[] indexing * avoid camelCase variable names * fix up getline() usage * condensed commit subject line Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-10-25qga-win: Updating guest_set_time actionBishara AbuHattoum1-1/+35
At the moment, Windows libraries don't provide a way to access RTC, so, a workaround is to use the Windows w32tm command to resync the time. Related bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1183874 Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Reviewed-by: Sameeh Jubran <sameeh@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-07-18qemu-ga: add guest-get-osinfo commandTomáš Golembiovský1-0/+191
Add a new 'guest-get-osinfo' command for reporting basic information of the guest operating system. This includes machine architecture, version and release of the kernel and several fields from os-release file if it is present (as defined in [1]). [1] https://www.freedesktop.org/software/systemd/man/os-release.html Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> * moved declarations to beginning of functions * dropped unecessary initialization of struct utsname Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-07-11qga-win32: Fix memory leak of device information setLi Ping1-1/+4
The caller of SetupDiGetClassDevs must delete the returned device information set when it is no longer needed by calling SetupDiDestroyDeviceInfoList. Signed-off-by: Li Ping <li.ping288@zte.com.cn> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-04-26qga: Add 'guest-get-users' commandVinzenz Feenstra1-0/+103
A command that will list all currently logged in users, and the time since when they are logged in. Examples: virsh # qemu-agent-command F25 '{ "execute": "guest-get-users" }' {"return":[{"login-time":1490622289.903835,"user":"root"}]} virsh # qemu-agent-command Win2k12r2 '{ "execute": "guest-get-users" }' {"return":[{"login-time":1490351044.670552,"domain":"LADIDA", "user":"Administrator"}]} Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> * make g_hash_table_contains compat func inline to avoid unused warnings Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-04-26qga-win: Enable 'can-offline' field in 'guest-get-vcpus' replySameeh Jubran1-1/+1
The QGA schema states: @can-offline: Whether offlining the VCPU is possible. This member is always filled in by the guest agent when the structure is returned, and always ignored on input (hence it can be omitted then). Currently 'can-offline' is missing entirely from the reply. This causes errors in libvirt which is expecting the reply to be compliant with the schema docs. BZ#1438735: https://bugzilla.redhat.com/show_bug.cgi?id=1438735 Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Reviewed-by: Eric Blake <eblake@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-04-24qga: Make errp the last parameter of qga_vss_fsfreezeFam Zheng1-2/+2
Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20170421122710.15373-14-famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-31qga: minimal support for fstrim for Windows guestsDenis V. Lunev1-3/+94
Unfortunately, there is no public Windows API to start trimming the filesystem. The only viable way here is to call 'defrag.exe /L' for each volume. This is working since Win8 and Win2k12. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> CC: Stefan Weil <sw@weilnetz.de> CC: Marc-André Lureau <marcandre.lureau@gmail.com> * check g_utf16_to_utf8() return value for GError handling instead of GError directly (Marc-André) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-06-20coccinelle: Remove unnecessary variables for function return valueEduardo Habkost1-4/+1
Use Coccinelle script to replace 'ret = E; return ret' with 'return E'. The script will do the substitution only when the function return type and variable type are the same. Manual fixups: * audio/audio.c: coding style of "read (...)" and "write (...)" * block/qcow2-cluster.c: wrap line to make it shorter * block/qcow2-refcount.c: change indentation of wrapped line * target-tricore/op_helper.c: fix coding style of "remainder|quotient" * target-mips/dsp_helper.c: reverted changes because I don't want to argue about checkpatch.pl * ui/qemu-pixman.c: fix line indentation * block/rbd.c: restore blank line between declarations and statements Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1465855078-19435-4-git-send-email-ehabkost@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Unused Coccinelle rule name dropped along with a redundant comment; whitespace touched up in block/qcow2-cluster.c; stale commit message paragraph deleted] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-20error: Remove NULL checks on error_propagate() callsEduardo Habkost1-6/+2
error_propagate() already ignores local_err==NULL, so there's no need to check it before calling. Coccinelle patch used to perform the changes added to scripts/coccinelle/error_propagate_null.cocci. Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1465855078-19435-2-git-send-email-ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@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-02-25qga: check utf8-to-utf16 conversionMarc-André Lureau1-3/+16
UTF8 to UTF16 conversion can fail for genuine reasons, let's check errors. Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: fix off-by-one length checkMarc-André Lureau1-1/+1
Laszlo Ersek said: "The length check is off by one (in the safe direction); it should be (nchars >= 2). The processing should be active for the wide string L"\r\n" -- resulting in the empty wide string --, I believe." Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: use wide-chars constants for wchar_t comparisonsMarc-André Lureau1-2/+4
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: use size_t for wcslen() return valueMarc-André Lureau1-1/+2
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: use more idiomatic qemu-style eol operatorsMarc-André Lureau1-3/+3
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: implement the guest-get-vcpus for windowsGal Hammer1-2/+66
Signed-off-by: Gal Hammer <ghammer@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> * report rather than assert when VCPU count == 0 * fix up subject: s/set-vcpus/get-vcpus/ Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-02-25qga: Support enum names in guest-file-seekEric Blake1-13/+6
Magic constants are a pain to use, especially when we run the risk that our choice of '1' for QGA_SEEK_CUR might differ from the host or guest's choice of SEEK_CUR. Better is to use an enum value, via a qapi alternate type for back-compatibility. With this, {"command":"guest-file-seek", "arguments":{"handle":1, "offset":0, "whence":"cur"}} becomes a synonym for the older {"command":"guest-file-seek", "arguments":{"handle":1, "offset":0, "whence":1}} Signed-off-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>
2016-02-04qga: Clean up includesPeter Maydell1-2/+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-12-18qga: convert to use error checked base64 decodeDaniel P. Berrange1-2/+9
Switch from using g_base64_decode over to qbase64_decode in order to get error checking of the base64 input data. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-25qga: Better mapping of SEEK_* in guest-file-seekEric Blake1-1/+19
Exposing OS-specific SEEK_ constants in our qapi was a mistake (if the host has SEEK_CUR as 1, but the guest has it as 2, then the semantics are unclear what should happen); if we had a time machine, we would instead expose only a symbolic enum. It's too late to change the fact that we have an integer in qapi, but we can at least document what mapping we want to enforce for all qga clients (and luckily, it happens to be the mapping that both Linux and Windows use); then fix the code to match that mapping. It also helps us filter out unsupported SEEK_DATA and SEEK_HOLE. In the future, we may wish to move our QGA_SEEK_* constants into qga/qapi-schema.json, along with updating the schema to take an alternate type (either the integer, or the string value of the enum name) - but that's too much risk during hard freeze. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-11qga: fix append file open modes for win32Kirk Allan1-14/+15
For append file open modes, use FILE_APPEND_DATA for the desired access for writing at the end of the file. Version 2: For "a+", "ab+", and "a+b" modes use FILE_APPEND_DATA|GENERIC_READ. ORing in GENERIC_READ starts a read at the begining of the file. All writes will append to the end fo the file. Added white space to maintain the alignment of the guest_file_open_modes[]. Signed-off-by: Kirk Allan <kallan@suse.com> Cc: qemu-stable@nongnu.org * use FILE_GENERIC_APPEND macro, which provides same semantics as FILE_APPEND_DATA, but retains other flags from GENERIC_WRITE Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-04qga: set file descriptor in qmp_guest_file_open non-blocking on Win32Olga Krishtal1-0/+27
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code. The patch introduces qemu_set_handle_nonoblocking, the local analog of qemu_set_nonblock for HANDLES. The usage of handles in qemu_set_non/block is impossible, because for win32 there is a difference between file discriptors and file handles, and all file ops are made via Win32 api. Signed-off-by: Olga Krishtal <okrishtal@parallels.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Michael Roth <mdroth@linux.vnet.ibm.com> CC: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-04qga: fixed CloseHandle in qmp_guest_file_openOlga Krishtal1-1/+1
CloseHandle use HANDLE as an argument, but not *HANDLE Signed-off-by: Olga Krishtal <okrishtal@parallels.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> CC: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-10-19qga: drop guest_file_init helper and replace it with static initializersDenis V. Lunev1-7/+3
This just makes code shorter and better. 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>