summaryrefslogtreecommitdiffstats
path: root/qga
Commit message (Collapse)AuthorAgeFilesLines
* qga: allow to lookup in PATH from the passed envp for guest-execYuri Pudgorodskiy2015-11-171-0/+3
| | | | | | | | | | | This was original behaviour before GLIB gspawn() rework and we rely on this behaviour. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Michael Roth <mdroth@linux.vnet.ibm.com> * add version check (2.33.2) for G_SPAWN_SEARCH_PATH_FROM_ENVP Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: fix for default env processing for guest-execYuri Pudgorodskiy2015-11-171-1/+1
| | | | | | | | | | | envp == NULL must be passed inside gspawn() if it was not passed with the command line. Original code inherits environment from the QGA, which is wrong. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.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>
* qga: fix append file open modes for win32Kirk Allan2015-11-111-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>
* qga: set file descriptor in qmp_guest_file_open non-blocking on Win32Olga Krishtal2015-11-041-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>
* qga: fixed CloseHandle in qmp_guest_file_openOlga Krishtal2015-11-041-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>
* qga: drop hand-made guest_file_toggle_flags helperDenis V. Lunev2015-11-041-25/+2
| | | | | | | | | | We'd better use generic qemu_set_nonblock directly. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> CC: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qdict: Make conversion from QObject * accept nullMarkus Armbruster2015-10-291-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>
* qga: fix uninitialized value warning for win32Michael Roth2015-10-191-1/+1
| | | | Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: guest-exec simple stdin/stdout/stderr redirectionYuri Pudgorodskiy2015-10-192-9/+187
| | | | | | | | | | | | | | | | | | | | | | | Implemented with base64-encoded strings in qga json protocol. Glib portable GIOChannel is used for data I/O. Optinal stdin parameter of guest-exec command is now used as stdin content for spawned subprocess. If capture-output bool flag is specified, guest-exec redirects out/err file descriptiors internally to pipes and collects subprocess output. Guest-exe-status is modified to return this collected data to requestor in base64 encoding. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> * switch from 'struct GuestIOExecData' to 'GuestIOExecData' * s/TRUE/true/g, s/FALSE/false/g for gboolean return values * s/inp_data/input_data/ Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()Yuri Pudgorodskiy2015-10-191-12/+11
| | | | | | | | | | glib may return G_IO_STATUS_AGAIN which is actually not an error. Also fixed a bug when on incomplete write buf pointer was not adjusted. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: handle possible SIGPIPE in guest-file-writeDenis V. Lunev2015-10-192-1/+23
| | | | | | | | | | | | | 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>
* qga: guest exec functionalityYuri Pudgorodskiy2015-10-192-0/+261
| | | | | | | | | | | | | | | | | | | | | Guest-exec rewritten in platform-independent style with glib spawn. Child process is spawn asynchronously and exit status can later be picked up by guest-exec-status command. stdin/stdout/stderr of the child now is redirected to /dev/null Later we will add ability to specify stdin in guest-exec command and to get collected stdout/stderr with guest-exec-status. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Michael Roth <mdroth@linux.vnet.ibm.com> * use g_new0 in place of g_malloc for GuestExec struct * commit msg spelling fixes * s/inp-data/input-data * document capture-input mode as false by default * use GetProcessId() for pids on w32 instead of casting HANDLE Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: drop guest_file_init helper and replace it with static initializersDenis V. Lunev2015-10-192-14/+6
| | | | | | | | | | 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>
* qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocksMichael Roth2015-10-191-2/+8
| | | | | | | | Some guests don't expose memory blocks via sysfs at all. This shouldn't be a failure, instead just return an empty list. For other access failures we still report an error. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: do not override configuration verbosityMarc-André Lureau2015-10-191-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>
* qga: add QGA_CONF environment variableMarc-André Lureau2015-10-191-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>
* qga: Use g_new() & friends where that makes obvious senseMarkus Armbruster2015-10-196-17/+17
| | | | | | | | | | | | | | 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>
* typofixes - v4Veres Lajos2015-09-111-1/+1
| | | | | Signed-off-by: Veres Lajos <vlajos@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* docs: fix a qga/qapi-schema.json commentMarc-André Lureau2015-09-111-1/+2
| | | | | | | | For consistency with the rest of the comment blocks. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* maint: remove double semicolons in many filesDaniel P. Berrange2015-09-111-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>
* error: On abort, report where the error was createdMarkus Armbruster2015-09-103-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is particularly useful when we abort in error_propagate(), because there the stack backtrace doesn't lead to where the error was created. Looks like this: Unexpected error in parse_block_error_action() at .../qemu/blockdev.c:322: qemu-system-x86_64: -drive if=none,werror=foo: 'foo' invalid write error action Aborted (core dumped) Note: to get this example output, I monkey-patched drive_new() to pass &error_abort to blockdev_init(). To keep the error handling boiler plate from growing even more, all error_setFOO() become macros expanding into error_setFOO_internal() with additional __FILE__, __LINE__, __func__ arguments. Not exactly pretty, but it works. The macro trickery breaks down when you take the address of an error_setFOO(). Fortunately, we do that in just one place: qemu-ga's Windows VSS provider and requester DLL wants to call error_setg_win32() through a function pointer "to avoid linking glib to the DLL". Use error_setg_win32_internal() there. The use of the function pointer is already wrapped in a macro, so the churn isn't bad. Code size increases by some 35KiB for me (0.7%). Tolerable. Could be less if we passed relative rather than absolute source file names to the compiler, or forwent reporting __func__. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
* qga/vss-win32: Document the DLL requires non-null errpMarkus Armbruster2015-09-103-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | requester.cpp uses this pattern to receive an error and pass it on to the caller (err_is_set() macro peeled off for clarity): ... code that may set errset->errp ... if (errset->errp && *errset->errp) { ... handle error ... } This breaks when errset->errp is null. As far as I can tell, it currently isn't, so this is merely fragile, not actually broken. The robust way to do this is to receive the error in a local variable, then propagate it up, like this: Error *err = NULL; ... code that may set err ... if (err) ... handle error ... error_propagate(errset->errp, err); } See also commit 5e54769, 0f230bf, a903f40. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qga: Clean up unnecessarily dirty castsMarkus Armbruster2015-09-103-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | qga_vss_fsfreeze() casts error_set_win32() from void (*)(Error **, int, ErrorClass, const char *, ...) to void (*)(void **, int, int, const char *, ...) The result is later called. Since the two types are not compatible, the call is undefined behavior. It works in practice anyway. However, there's no real need for trickery here. Clean it up as follows: * Declare struct Error, and fix the first parameter. * Switch to error_setg_win32(). This gets rid of the troublesome ErrorClass parameter. Requires converting error_setg_win32() from macro to function, but that's trivially easy, because this is the only user of error_set_win32(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qemu-ga: implement win32 guest-set-user-passwordMarc-André Lureau2015-09-011-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>
* qga: add --dump-conf optionMarc-André Lureau2015-09-011-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>
* qga: add an optional qemu-ga.conf system configurationMarc-André Lureau2015-09-011-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>
* qga: free a bit moreMarc-André Lureau2015-09-011-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>
* qga: move agent run in a separate functionMarc-André Lureau2015-09-011-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>
* qga: fill default options in main()Marc-André Lureau2015-09-011-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>
* qga: move option parsing to separate functionMarc-André Lureau2015-09-011-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>
* qga: copy argument stringsMarc-André Lureau2015-09-011-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>
* qga: rename 'path' to 'channel_path'Marc-André Lureau2015-09-011-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>
* qga: make split_list() return allocated stringsMarc-André Lureau2015-09-013-18/+14
| | | | | | | | | 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>
* qga: move string split in separate functionMarc-André Lureau2015-09-011-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>
* qga: use exit() when parsing optionsMarc-André Lureau2015-09-011-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>
* qga: misc spellingMarc-André Lureau2015-09-011-1/+1
| | | | | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Fixed paths issue with MSI buildLeonid Bloch2015-09-011-3/+3
| | | | | | | | | | Previously, if building out-of-tree, the MSI build would fail since it wasn't able to find the needed files. Signed-off-by: Leonid Bloch <leonid@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> * fixed up commit msg formating Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Prevent QEMU-GA VSS provider from being unregistered on MSI reinstallLeonid Bloch2015-09-011-9/+5
| | | | | | | | | | Previously, running the .msi would unregister the QEMU GA VSS service if QEMU GA was already installed on the machine, and then register it only if QEMU GA was NOT previously installed. This behavior caused the service to be registered only after the INITIAL installation, and any subsequent run of the .msi (to redo, repair, or upgrade the installation) ended in the service being unregistered. Now, the VSS service is still unregistered if QEMU GA is already installed (so that a fix or an update could be performed) but then it is registered again (if the GA is not being uninstalled) thus finishing the repair/upgrade correctly. Additionally, downgrading is now prevented. If a user would like to downgrade a version, he/she must uninstall the newer version first. Signed-off-by: Leonid Bloch <leonid@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Created a separate component for each installed file in the MSILeonid Bloch2015-09-011-11/+36
| | | | | | | | This is done to follow the recommendations given here: https://msdn.microsoft.com/en-us/library/aa368269%28VS.85%29.aspx Signed-off-by: Leonid Bloch <leonid@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Minor cosmetic changes to the WXS fileLeonid Bloch2015-09-011-3/+3
| | | | | Signed-off-by: Leonid Bloch <leonid@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Fixed GUID capitalizationLeonid Bloch2015-09-011-3/+3
| | | | | | | For compatibility, all the letters in GUID should be capital. Signed-off-by: Leonid Bloch <leonid@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Two MSI related cosmetic changesLeonid Bloch2015-09-011-1/+2
| | | | | Signed-off-by: Leonid Bloch <leonid@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: fixed versions for guest bus types in qapi-schemaOlga Krishtal2015-07-211-1/+1
| | | | | | | | | | 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> Reviewed-by: Eric Blake <eblake@redhat.com> *added semi-colon to better delineate 2.2 vs. 2.4 versioning Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: added GuestPCIAddress informationMichael Roth2015-07-071-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>
* qga: added bus type and disk location pathOlga Krishtal2015-07-072-2/+147
| | | | | | | | | | | | | | | | | | | | | | 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>
* qga: added mountpoint and filesystem type for single volumeOlga Krishtal2015-07-071-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>
* qga: added empty qmp_quest_get_fsinfo functionality.Olga Krishtal2015-07-071-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>
* qga: fail early for invalid timeMarc-André Lureau2015-07-071-0/+7
| | | | | | | | | | It's possible to set system time with dates after 2070, however, it's not possible to set the RTC. It has limitation to up to year 2070 (1970+100). In order to keep both clock in sync and before the kernel complains on invalid values, bail out early. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: win32 qmp_guest_network_get_interfaces implementationKirk Allan2015-07-071-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>
* Revert "guest agent: remove g_strcmp0 usage"Markus Armbruster2015-07-071-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>
OpenPOWER on IntegriCloud