summaryrefslogtreecommitdiff
path: root/qga/commands-win32.c
AgeCommit message (Collapse)AuthorFilesLines
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>
2015-10-19qga: Use g_new() & friends where that makes obvious senseMarkus Armbruster1-5/+5
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-11maint: remove double semicolons in many filesDaniel P. Berrange1-1/+1
A number of source files have statements accidentally terminated by a double semicolon - eg 'foo = bar;;'. This is harmless but a mistake none the less. The tcg/ia64/tcg-target.c file is whitelisted because it has valid use of ';;' in a comment containing assembly code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-09-01qemu-ga: implement win32 guest-set-user-passwordMarc-André Lureau1-2/+75
Use NetUserSetInfo() to set the user password. This function is notoriously known to be problematic for users with EFS encrypted files. But the alternative, NetUserChangePassword() requires the old password. Nevertheless, The EFS file should be recovered by changing back to the old password. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-09-01qga: make split_list() return allocated stringsMarc-André Lureau1-2/+2
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-07-07qga: added GuestPCIAddress informationMichael Roth1-1/+96
PCIAddress inforfation is obtained via SetupApi, which provides the information about address, bus, etc. We look throught entire device tree in the system and try to find device object for given volume. For this PDO SetupDiGetDeviceRegistryProperty is called, which reads PCI configuration for a given devicei if it is possible. This is the most convinient way for a userspace service. The lookup is performed for every volume available. However, this information is not mandatory for vss-provider. In order to use SetupApi we need to notify linker about it. We do not need to install additional libs, so we do not make separate configuration option to use libsetupapi.su SetupApi gives as the same information as kernel driver with IRP_MN_QUERY_INTERFACE. https://support.microsoft.com/en-us/kb/253232 Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Eric Blake <eblake@redhat.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> * stub out get_pci_info if !CONFIG_QGA_NTDDSCSI Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07qga: added bus type and disk location pathOlga Krishtal1-1/+134
According to Microsoft disk location path can be obtained via IOCTL_SCSI_GET_ADDRESS. Unfortunately this ioctl can not be used for all devices. There are certain bus types which could be obtained with this API. Please, refer to the following link for more details https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx Bus type could be obtained using IOCTL_STORAGE_QUERY_PROPERTY. Enum STORAGE_BUS_TYPE describes all buses supported by OS. Windows defines more bus types than Linux. Thus some values have been added to GuestDiskBusType. Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Eric Blake <eblake@redhat.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> * fixed warning in CreateFile due to use of NULL instead of 0 * only provide disk info when CONFIG_QGA_NTDDSCSI=y Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07qga: added mountpoint and filesystem type for single volumeOlga Krishtal1-1/+53
We should use GetVolumeXXX api to work with volumes. This will help us to resolve the situation with volumes without drive letter, i.e. when the volume is mounted as a folder. Such volume is called mounted folder. This volume is a regular mounted volume from all other points of view. The information about non mounted volume is reported as System Reserved. This volume is not mounted and thus it is not writable. GuestDiskAddressList API is not used because operations are performed with volumes but no with disks. This means that spanned disk will be counted and handled as a single volume. It is worth mentioning that the information about every disk in the volume can be queried via IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS. Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Eric Blake <eblake@redhat.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07qga: added empty qmp_quest_get_fsinfo functionality.Olga Krishtal1-3/+24
We need qmp_quest_get_fsinfo togather with vss-provider, which works with volumes. The call to this function is implemented via FindFirst/NextVolumes. Moreover, volumes in Windows OS are filesystem unit, so it will be more effective to work with them rather with devices. Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Eric Blake <eblake@redhat.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07qga: win32 qmp_guest_network_get_interfaces implementationKirk Allan1-3/+216
By default, IPv4 prefixes will be derived by matching the address to those returned by GetAdaptersInfo. IPv6 prefixes can not be matched this way due to the unpredictable order of entries. In Windows Vista/2008 guests and newer, both IPv4 and IPv6 prefixes can be retrieved from OnLinkPrefixLength. Setting --extra-cflags in the build configuration to "-D_WIN32_WINNT=0x600" or greater makes OnLinkPrefixLength available. Setting --extra-cflags is not required and if not set, the default approach to get the prefix will be taken. Signed-off-by: Kirk Allan <kallan@suse.com> * drop ws2ipdef.h, it's missing on old mingw, and ws2tcpip.h already includes it automatically on new builds Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-07-07qga/qmp_guest_fstrim: Return per path fstrim resultJustin Ossevoort1-1/+3
The current guest-fstrim support only returns an error if some mountpoint was unable to be trimmed, skipping any possible additional mountpoints. The result of the TRIM operation itself is also discarded. This change returns a per mountpoint result of the TRIM operation. If an error occurs on some mountpoints that error is returned and the guest-fstrim continue with any additional mountpoints. The returned values for errors, minimum and trimmed are dependant on the filesystem, storage stacks and kernel version. Signed-off-by: Justin Ossevoort <justin@quarantainenet.nl> * s/type/struct/ in schema type definitions * moved version annotation for new guest-fstrim return field to the field itself rather than applying to the entire command Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-06-22qerror: Clean up QERR_ macros to expand into a single stringMarkus Armbruster1-33/+33
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: debug printouts to help troubleshoot installationYossi Hindin1-0/+1
Debug printouts extended, helps installation troubleshooting Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-3-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-02-17qemu-ga-win: Fail loudly on bare 'set-time'Michal Privoznik1-22/+22
The command is not implemented correctly yet. The documentation allows to not pass any value to set, in which case the time is re-read from RTC. However, reading CMOS on Windows is not trivial to implement. So instead of pretending we've set the correct time, fail explicitly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-02-17qga: add memory block command that unsupportedzhanghailiang1-0/+2
For memory block command, we only support for linux with sysfs. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-02-17qga: introduce three guest memory block commmands with stubszhanghailiang1-0/+19
Introduce three new guest commands: guest-get-memory-blocks, guest-set-memory-blocks, guest-get-memory-block-size. With these three commands, we can support online/offline guest's memory block (logical memory hotplug/unplug) as required from host. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> *generalized guest-get-memory-block-size to get-get-memory-block-info for future extensibility Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-02-16qga: implement file commands for Windows guestOlga Krishtal1-21/+250
The following commands are implemented: - guest_file_open - guest_file_close - guest_file_write - guest_file_read - guest_file_seek - guest_file_flush Motivation is quite simple: Windows guests should be supported with the same set of features as Linux one. Also this patch is a prerequisite for Windows guest-exec command support. 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> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-02-16qga: add guest-set-user-password commandDaniel P. Berrange1-0/+9
Add a new 'guest-set-user-password' command for changing the password of guest OS user accounts. This command is needed to enable OpenStack to support its API for changing the admin password of guests running on KVM/QEMU. It is not practical to provide a command at the QEMU level explicitly targetting administrator account password change only, since different guest OS have different names for the admin account. While UNIX systems use 'root', Windows systems typically use 'Administrator' and even that can be renamed. Higher level apps like OpenStack have the ability to figure out the correct admin account name since they have info that QEMU/libvirt do not. The command accepts either the clear text password string, encoded in base64 to make it 8-bit safe in JSON: $ echo -n "123456" | base64 MTIzNDU2 $ virsh -c qemu:///system qemu-agent-command f21x86_64 \ '{ "execute": "guest-set-user-password", "arguments": { "crypted": false, "username": "root", "password": "MTIzNDU2" } }' {"return":{}} Or a password that has already been run though a crypt(3) like algorithm appropriate for the guest, again then base64 encoded: $ echo -n '$6$n01A2Tau$e...snip...DfMOP7of9AJ1I8q0' | base64 JDYkb...snip...YT2Ey $ virsh -c qemu:///system qemu-agent-command f21x86_64 \ '{ "execute": "guest-set-user-password", "arguments": { "crypted": true, "username": "root", "password": "JDYkb...snip...YT2Ey" } }' NB windows support is desirable, but not implemented in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-08-07qga: Disable unsupported commands by defaultTomoki Sekiyama1-1/+31
Currently management softwares cannot know whether a qemu-ga command is supported or not on the running platform until they actually execute it. This patch disables unsupported commands at launch time of qemu-ga, so that management softwares can check whether they are supported from 'enabled' property of the result from 'guest-info' command. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-08-07qga: Add guest-get-fsinfo commandTomoki Sekiyama1-0/+6
Add command to get mounted filesystems information in the guest. The returned value contains a list of mountpoint paths and corresponding disks info such as disk bus type, drive address, and the disk controllers' PCI addresses, so that management layer such as libvirt can resolve the disk backends. For example, when `lsblk' result is: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 1G 0 disk `-sdb1 8:17 0 1024M 0 part `-vg0-lv0 253:1 0 1.4G 0 lvm /mnt/test sdc 8:32 0 1G 0 disk `-sdc1 8:33 0 512M 0 part `-vg0-lv0 253:1 0 1.4G 0 lvm /mnt/test vda 252:0 0 25G 0 disk `-vda1 252:1 0 25G 0 part / where sdb is a SCSI disk with PCI controller 0000:00:0a.0 and ID=1, sdc is an IDE disk with PCI controller 0000:00:01.1, and vda is a virtio-blk disk with PCI device 0000:00:06.0, guest-get-fsinfo command will return the following result: {"return": [{"name":"dm-1", "mountpoint":"/mnt/test", "disk":[ {"bus-type":"scsi","bus":0,"unit":1,"target":0, "pci-controller":{"bus":0,"slot":10,"domain":0,"function":0}}, {"bus-type":"ide","bus":0,"unit":0,"target":0, "pci-controller":{"bus":0,"slot":1,"domain":0,"function":1}}], "type":"xfs"}, {"name":"vda1", "mountpoint":"/", "disk":[ {"bus-type":"virtio","bus":0,"unit":0,"target":0, "pci-controller":{"bus":0,"slot":6,"domain":0,"function":0}}], "type":"ext4"}]} In Linux guest, the disk information is resolved from sysfs. So far, it only supports virtio-blk, virtio-scsi, IDE, SATA, SCSI disks on x86 hosts, and "disk" parameter may be empty for unsupported disk types. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> *updated schema to report 2.2 as initial supported version Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-08-07qga: Add guest-fsfreeze-freeze-list commandTomoki Sekiyama1-0/+9
If an array of mount point paths is specified as 'mountpoints' argument of guest-fsfreeze-freeze-list, qemu-ga will only freeze the file systems mounted on specified paths in Linux guests. Otherwise, it works as the same way as guest-fsfreeze-freeze. This would be useful when the host wants to create partial disk snapshots. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Reviewed-by: Eric Blake <eblake@redhat.com> *updated schema to report 2.2 as initial supported version Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-06-03qga: Fix handle fd leak in acquire_privilege()Gonglei1-2/+4
token should be closed in all conditions. So move CloseHandle(token) to "out" branch. Signed-off-by: Wang Rui <moon.wangrui@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-05-09qga: Drop superfluous error_is_set()Markus Armbruster1-10/+0
acquire_privilege(), execute_async() and check_suspend_mode() do nothing when called with an error set. Callers shouldn't do that, and no caller does. Drop the superfluous tests. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>