summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Add test for qemu broken -machine option (RHBZ#748266).Richard W.M. Jones2011-10-311-0/+12
| | | | | | | | Also add this option, if necessary, when testing for virtio-serial support. When the workaround is enabled, we specify machine type 'pc'. (cherry picked from commit 3814680423984b3c46c2f99e944c2a71862bde9f)
* Coverity: fix memory leak along error path.Richard W.M. Jones2011-09-161-0/+12
| | | | (cherry picked from commit ce18be33cd5279a8d4120eedd037400c275585c0)
* pclose: Fix other places where we only tested pclose == -1.Richard W.M. Jones2011-09-162-2/+2
| | | | | pclose can return > 0 when the status of the command was non-zero. (cherry picked from commit 631faad97171d7c1238b2e413c663cf61476f440)
* test_qemu: pclose may return any != 0 on error.Richard W.M. Jones2011-09-161-1/+1
| | | | | In particular pclose returns a status > 0 if the command fails. (cherry picked from commit a24652c7b27e8494268ccb6c9a5a2e5541ba5efd)
* qemu detection: Free up previous qemu help/version strings if they exist.Richard W.M. Jones2011-09-161-0/+5
| | | | (cherry picked from commit 2ace9be4cd69e84cd88e5b0fd74de861a4973c91)
* Coverity: test_qemu: Ensure FILE * is not leaked along error paths.Richard W.M. Jones2011-09-161-15/+22
| | | | | | This refactors the code in test_qemu slightly to ensure that FILE *fp is not leaked on error paths. (cherry picked from commit 08e77ad8cb4e8ac70d4217ebd5d236eba81645b5)
* Escape special/non-printing characters in debug output (RHBZ#731744).Richard W.M. Jones2011-09-161-12/+42
| | | | | | | | | | | | | | | | | | | The default event handler in libguestfs was simply writing all debug output directly to stderr. However if the output contains non-printable characters such as terminal control codes then these would also be sent directly. With newer SeaBIOS there is a lame attempt to implement a splash screen using terminal control codes, thus when libguestfs tries to display debugging output it would cause the screen to clear and debug output to be lost. This commit causes all non-printing characters to be escaped. (\n and \r characters from the appliance are treated somewhat specially). Furthermore, instead of using write(2), use buffered stderr calls. (cherry picked from commit 06019bc82e107f7715ebc59e491610e06dad1e39)
* inspection: Better checking for Windows root disks (RHBZ#729075).Richard W.M. Jones2011-08-173-30/+75
| | | | | | | | | | | | | | | | | | | | Previously any disk that had /autoexec.bat or /boot.ini or /ntldr would be picked up as a candidate for a Windows root disk. If further checking could not find any systemroot (eg. /windows) then this would result in complete failure of inspection. In particular, this got confused by Hp_recovery partitions which have /autoexec.bat, but don't have a systemroot in one of the usual places (they have /MiniNT instead). What we do now is to properly investigate all possible systemroot places before deciding this is a Windows systemroot, so the subsequent failure cannot occur. (Thanks to lorimar for reporting this bug). Cherry picked from commit 2c57305f72cd6181d1849ae6e1b892aa01c7f844 and backported to stable-1.10 branch.
* docs: guestfs_set_out_of_memory_handler returns void, not int.Richard W.M. Jones2011-08-071-2/+2
| | | | | It always has done. The documentation was wrong. (cherry picked from commit 70f44cc0ea0bcdd025ed657461e07f6778be44ba)
* Change link, since PostgreSQL switched to using git.Richard W.M. Jones2011-08-071-1/+1
| | | | (cherry picked from commit 3cf31c2fe0b356ea5c04117c5235b0a3cfe34971)
* Don't fail if HOSTNAME field is missing on Red Hat guests (RHBZ#726739).Richard W.M. Jones2011-08-071-3/+10
| | | | (cherry picked from commit bad3f4b54a959685f3c0697238fc5753096834fb)
* blkid: Detect when value not found and return empty string.Richard W.M. Jones2011-07-271-0/+4
| | | | | | | | | | | | | | | If the blkid command returns 2, that means the value was not found. Note that this changes the output of the vfs-type API when the filesystem has no type (eg when it is empty). Previously this would return an error. Now it returns empty string "". We did not document this either way. Making it return empty string is consistent with vfs-label and vfs-uuid. This change broke list-filesystems, since that code was assuming that vfs-type could only return a filesystem type or an error. (cherry picked from commit 168fd4ad5d1e5da93e11388095d41aaa8f804ceb)
* appliance: Capture stderr from qemu to the event system.Richard W.M. Jones2011-07-271-1/+9
| | | | (cherry picked from commit 8b2e60ce4b46e86da093ee64d4e0b0ae3c998d55)
* appliance: Document pipe fds.Richard W.M. Jones2011-07-271-0/+2
| | | | (cherry picked from commit 70daccfe4e9939078436c2830928d8e53432dd84)
* Add missing reference to guestfs-perl(3) to guestfs(3).Richard W.M. Jones2011-07-271-0/+1
| | | | (cherry picked from commit a548c9668315844763456c15e89e35e9702b851a)
* Add caution subdirectory containing safety and liveness tests.Richard W.M. Jones2011-07-131-0/+5
| | | | | | Not that I'm paranoid about qemu breaking snapshots of anything like that ... (cherry picked from commit f3ada2c7653866f2529c9f18aaa99f76cd984844)
* Change download_to_tmp so it can work with multi-root operating systems.Richard W.M. Jones2011-07-134-76/+74
| | | | | | | | | | | | | | | | | | | The previous guestfs___download_to_tmp function did not handle multiboot correctly. In particular it used the same cache name for downloaded files from different roots, which could have caused things like applications in each root to be confused. This changes the function so that the cache filename is prefixed with the root / fs number, eg. $tmpdir/0-Name instead of $tmpdir/Name. This change also requires the function to return the new name, so all places in the code which called this function had to be updated. This updates and fixes commit 3c1f762abed92f7a358f3bc93e3396d0606b18ad. (Cherry picked and backported from commit 5f26270c343bf543a7bf20cf3e6f182f6282f8ea)
* build: include <string.h> for src/match.c's use of strlenJim Meyering2011-06-131-0/+1
| | | | (cherry picked from commit daf55c07978cd29fe6675911bf76da0b056fdae1)
* protocol: Enhance "unexpected end of file when reading from daemon" error.Richard W.M. Jones2011-06-131-2/+21
| | | | | | Make this error more informative, since it is a common error when the appliance fails to start up. (cherry picked from commit 2f73ea343cc4a3433f20e99a7835152767a70f80)
* appliance: Use qemu -machine option where available (RHBZ#700369).Richard W.M. Jones2011-06-131-14/+23
| | | | (Cherry picked from commit 64841fe8957f798df12a38bd81843c7011f2c278)
* Fix guestfs___rollback_cmdline when pos == 0.Richard W.M. Jones2011-05-181-1/+1
| | | | | | | | | Because of the previous change to size_t, when pos == 0 the loop would wrap around and cause a segmentation fault. This fixes a regression introduced by commit 10167cea98f93a74abe63f0a54d3a662997e7489. (cherry picked from commit 607aa95de927b5b8e4b212655c71bf21acbba372)
* guestfs(3): Note that host file size limits affect guest disk limits.Richard W.M. Jones2011-05-181-0/+9
| | | | (cherry picked from commit 805e6dbc15eae5a4f85eea3c37e295aefaefeb69)
* guestfs(3): Refresh documentation for private data area keys.Richard W.M. Jones2011-05-181-5/+6
| | | | (cherry picked from commit 40f2b698ac765128bfcda5f0db893c95d09ae89a)
* guestfs(3): Referenced section is above, not below.Richard W.M. Jones2011-05-181-1/+1
| | | | (cherry picked from commit 108d7a134c5d26b967fa7162d9b80b40112c2869)
* guestfs(3): Refresh autosync gotcha documentation.Richard W.M. Jones2011-05-181-3/+3
| | | | (cherry picked from commit a5e421570cc840f70f2931e24b3df40c9a14cd2d)
* guestfs(3): Writing to a file descriptor, not just a pipe.Richard W.M. Jones2011-05-181-1/+1
| | | | (cherry picked from commit 470e373eea218c8d46b0c63dda93ee9ece48940f)
* guestfs(3): Refresh documentation for guestfs_create, guestfs_close.Richard W.M. Jones2011-05-181-5/+12
| | | | (cherry picked from commit dd86183f3f6d4d5ad28e1f12c56ba920934e7ad0)
* internal: Use size_t instead of int for command line size.Richard W.M. Jones2011-05-184-9/+9
| | | | (cherry picked from commit 10167cea98f93a74abe63f0a54d3a662997e7489)
* guestfs_close: Move local variables close to code that uses them.Richard W.M. Jones2011-05-181-3/+4
| | | | | This is just code motion. (cherry picked from commit 478b2d80ed1d613f621e89a97a0b140004ebac29)
* guestfs_close: Remove unused local variable.Richard W.M. Jones2011-05-181-2/+1
| | | | (cherry picked from commit b2f8627ab59daeb03f036dde6c66fb9da736950c)
* guestfs(3): Document limits.Richard W.M. Jones2011-05-181-23/+91
| | | | (cherry picked from commit c0f96e9c6eda77e5e99de862dd4366010e4a1ab8)
* inspect: Look for %systemroot%/system32 for Windows heuristic.Richard W.M. Jones2011-04-241-3/+3
| | | | | | The virt-v2v transfer ISO had a /windows directory. The core inspection code thought this was a Windows root filesystem. (cherry picked from commit 0da6f55a6745686ca056c6bc8ebf647f111cb8e8)
* list-applications: If software hive is missing, this is an error.Richard W.M. Jones2011-04-241-5/+5
| | | | | | virt-inspector would exit silently if list-applications failed along this error path. (cherry picked from commit 782f3a36469ca396dbf998ea82af2699153be3ed)
* inspect: "centos" and "scientificlinux" are now separate distros.Richard W.M. Jones2011-04-244-3/+79
| | | | | Previously we returned "rhel" for these, which was not accurate. (cherry picked from commit 2b0ca7e7b8d369a42a51b1feec72ae8f17257c78)
* inspect: Abstract out db_dump code for listing RPM applications.Richard W.M. Jones2011-04-184-81/+251
| | | | | | | | | | | | There are two changes here: (1) The code for listing RPM applications ran db_dump and parsed the output. We abstract out that parsing code into a separate reusable module (src/dbdump.c). (2) The old db_dump parsing code used db_dump -p (printable) format. Instead use db_dump -k (hex) format so we can read binary fields. (cherry picked from commit a986e8dadb0c70634f6d1d89dd3e7bb5d9af3078)
* inspect: Split code into separate files.Richard W.M. Jones2011-04-188-2533/+2879
| | | | | | | | | | | | | | | | | | The src/inspect.c file had grown rather large -- 3,500 lines. Split it across several files according to function. This is just moving code. After the split the files are more evenly divided: 536 src/inspect_apps.c 766 src/inspect.c 537 src/inspect_fs.c 404 src/inspect_fs_cd.c 785 src/inspect_fs_unix.c 535 src/inspect_fs_windows.c 3563 total (cherry picked from commit 3336b5448f12c9eb25bf7a0cecda1315c4cf07ea)
* inspect: Move shared PCRE match functions to separate file.Richard W.M. Jones2011-04-183-98/+128
| | | | | This is just moving code around. (cherry picked from commit 439a42efdb052748c8457f866b2c68a581034826)
* inspect: Cache downloaded files in the handle g->tmpdir.Richard W.M. Jones2011-04-181-56/+72
| | | | | | | | | | | | | | | | | | | During inspection we download various files such as the Windows 'software' and 'system' registries. Previously these were downloaded as temporary files and discarded immediately after use. This meant that the 'software' registry was being downloaded twice by virt-inspector (it's required once for basic OS inspection, and a second time to list Windows applications). This commit changes this so that these files are cached in g->tmpdir, and thus the second time we just reuse the file we've already downloaded. Callers shouldn't be relying on inspect-list-applications to reread the actual registry from the VM (unless you close and reopen the handle). It says in the documentation that the results of inspection may be cached in the handle. (cherry picked from commit 3c1f762abed92f7a358f3bc93e3396d0606b18ad)
* Remove temporary directory containing arbitrary files.Richard W.M. Jones2011-04-181-9/+40
| | | | | | | | | In preparation for caching inspection information in the temporary directory (g->tmpdir), allow the temporary directory to contain arbitrary files, and remove all of them when the handle is closed. This just generalizes the previous method of cleaning up the tmpdir. (cherry picked from commit 70975981bed8e0c01b5966c10b507bb82086e5f8)
* Avoid warning about implicit declaration of strlen.Jim Meyering2011-04-181-0/+1
| | | | | * src/events.c: Include <string.h>, for use of strlen. (cherry picked from commit a53833fdd21cd573fe8fd02d7a11a3a5e9764ce0)
* guestfs(3): Fix documentation for drive letters.Richard W.M. Jones2011-04-121-8/+7
| | | | We can now get drive letter mappings through the inspection API.
* inspect: Fix some small memory leaks in Windows inspection.Richard W.M. Jones2011-04-121-0/+3
| | | | Found using valgrind.
* Compile rpcgen-generated files with -fno-strict-aliasingMatthew Booth2011-04-071-7/+4
| | | | | rpcgen generates source which can't be safely compiled with strict-aliasing enabled.
* New API: inspect-get-drive-mappingsRichard W.M. Jones2011-04-052-1/+180
| | | | | | | | | | | | This returns the drive mappings from the Windows Registry. virt-inspector displays the drive mappings, giving output similar to this: <drive_mappings> <drive_mapping name="C">/dev/sda2</drive_mapping> <drive_mapping name="E">/dev/sdb1</drive_mapping> </drive_mappings>
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-052-9/+66
| | | | | | | | | | | | | | This returns the actual registry key corresponding to CurrentControlSet (eg. it might be "ControlSet001"). Previously the inspection code was hard-coding ControlSet001. Now we use the correct control set, and also make it available to callers through the API. This commit also updates the virt-dhcp-address example so it uses this new API. virt-inspector displays the current control set when available.
* Rename resolve_windows_path_silently to case_sensitive_path_silently.Richard W.M. Jones2011-04-051-9/+9
| | | | | | A more accurate description of what this function does. This is just code motion.
* daemon: Introduce "pulse mode" progress events.Richard W.M. Jones2011-04-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new form of progress event, where we don't know how much of the operation has taken place, but we nevertheless want to send back some indication of activity. Some progress bar indicators directly support this, eg. GtkProgressBar where it is known as "pulse mode". A pulse mode progress message is a special backwards-compatible form of the ordinary progress message. No change is required in callers, unless they want to add support for pulse mode. The daemon sends: - zero or more progress messages with position = 0, total = 1 - a single final progress message with position = total = 1 Note that the final progress message may not be sent if the call fails and returns an error. This is consistent with the behaviour of ordinary progress messages. The daemon allows two types of implementation. Either you can just call notify_progress (0, 1); ...; notify_progress (1, 1) as usual. Or you can call the functions pulse_mode_start, pulse_mode_end and/or pulse_mode_cancel (see documentation in daemon/daemon.h). For this second form of call, the guarantee is very weak: it *just* says the daemon is still capable of doing something, and it doesn't imply that if there is a subprocess that it is doing anything. However this does make it very easy to add pulse mode progress messages to all sorts of existing calls that depend on long-running external commands. To do: add a third variant that monitors a subprocess and only sends back progress messages if it's doing something, where "doing something" might indicate it's using CPU time or it's printing output.
* Generate progress messages during launch.Richard W.M. Jones2011-04-013-0/+54
| | | | | | | | | | | | | | | | | | | This commit generates approximate progress messages during the guestfs_launch call. Currently this code generates: 0 / 12: launch clock starts 3 / 12: appliance created 6 / 12: detected that guest kernel started 9 / 12: detected that /init script is running 12 / 12: launch completed successfully (Note this is not an ABI and may be changed or removed in a future version). Progress messages are only generated at all if 5 seconds have elapsed since the launch, and they are only generated for the ordinary appliance (not if using attach-method to attach to an existing virtio serial port).
* protocol: Sleep for 1ms before reading log messages.Richard W.M. Jones2011-04-011-1/+8
| | | | | | | | | | | | | | | As explained in the comment: /* QEMU's console emulates a 16550A serial port. The real 16550A * device has a small FIFO buffer (16 bytes) which means here we see * lots of small reads of 1-16 bytes in length, usually single * bytes. Sleeping here for a very brief period groups reads * together (so we usually get a few lines of output at once) and * improves overall throughput, as well as making the event * interface a bit more sane for callers. With a virtio-serial * based console (not yet implemented) we may be able to remove * this. XXX */
* Shared function to send progress messages.Richard W.M. Jones2011-04-012-5/+9
| | | | This is just code motion.