summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* guestfs-testing: Use L<> around links.Richard W.M. Jones2012-10-301-2/+2
| | | | | (cherry picked from commit dd09744432468c416033ca84dc0ae1a438240de0) (cherry picked from commit 204d87098a0c9375c3bc5c10e8a9b7b7e8a1f768)
* inspection: Fix calls to case_sensitive_path (RHBZ#858126).Richard W.M. Jones2012-10-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | Don't assume that if guestfs_case_sensitive_path returns NULL, that it means the file does not exist. The (previously undefined) behaviour of case_sensitive_path was that a NULL return meant "either the file doesn't exist or some other error". However in commit 973581780d8a006f336684fef6762801402d775d this was changed so that if the last element of the path didn't exist, it was assumed to be a new file and the (non-NULL) path of the new file is returned. This change breaks code (including in libguestfs) which tries to use case_sensitive_path as a dual-purpose call to fix-up a path for Windows and test if the file exists. Such code should be rewritten so that it explicitly tests for file existence after calling case_sensitive_path. I examined all the calls to case_sensitive_path in libguestfs and modified them where necessary. Cherry picked from commit 9ea6e9701461e594033999150f930cc4fafec4d2. (cherry picked from commit ff610469fb8ad1d27dac5d3cb2f1e007d8c0ecc7)
* recipes: Add a section about diagnosing hanging guests.Richard W.M. Jones2012-10-011-0/+29
| | | | | (cherry picked from commit f7e138835a7194135113088767c46df65dbf292a) (cherry picked from commit f487298ed4cff3cbda26c0a62c94b9a5e71c13df)
* guestfs-testing(1): Start by running libguestfs-test-tool.Richard W.M. Jones2012-10-011-0/+14
| | | | | (cherry picked from commit 9b7813c5bd91d53e358deee64ab42b00b42c37ba) (cherry picked from commit 7d674f2fbfa663366c957f8662822f55ed1f2e1c)
* recipes: Add section about uploading raw filesystem content.Richard W.M. Jones2012-10-011-0/+24
| | | | | (cherry picked from commit 8aa8eb205b02e1014e5ed9577f4a9da9fd864aba) (cherry picked from commit 53c4ec871d0d43dd628a9693b18017d1552ec651)
* syntax: Remove trailing whitespace.Richard W.M. Jones2012-09-191-1/+0
| | | | | Found by 'make syntax-check'. (cherry picked from commit 2cac8d490e9884a8c7376e49fd1cda2e3d3abec1)
* recipes: Checksum file/device. Download to stdout.Richard W.M. Jones2012-09-191-0/+26
| | | | (cherry picked from commit b799bc58a84e155783afae23f64f27e23ddd06dd)
* podwrapper: Add --license parameter, which is required.Richard W.M. Jones2012-08-301-0/+3
| | | | | | | | | | | | This adds standard LICENSE and BUGS sections to all of the man pages that are processed by podwrapper. Modify all the calls to $(PODWRAPPER) to add the right --license parameter according to the content. Note that this relaxes the license on some code example pages, making them effectively BSD-style licensed. (cherry picked from commit 2f97bf873b64384835f257f8916bf1ebb2af62b4)
* man pages: Ensure consistent copyright/author sections, remove licenseRichard W.M. Jones2012-08-303-50/+3
| | | | | | | | | | | | section. Ensure each man page contains consistent COPYRIGHT and AUTHOR sections. Remove the LICENSE section. We will add that back in podwrapper in a later commit. (cherry picked from commit f1d98bbc79496947210ee0305f80440ed8557ec1)
* recipes: Update dumping filesystem content to mention that we now support ↵Richard W.M. Jones2012-08-301-1/+1
| | | | | | MD/RAID. (cherry picked from commit 52e38c7bdc293cb2f2531eab3dde6d569a05b5e9)
* recipes: Refer to virt-format, virt-make-fs for creating disk images.Richard W.M. Jones2012-08-301-1/+7
| | | | (cherry picked from commit 1e4c6e36a6d122b4615dc509ef745dde7e37321d)
* recipes: Cloning Windows: plans for virt-sysprep.Richard W.M. Jones2012-08-301-10/+10
| | | | (cherry picked from commit 5f234548ed07b8e41a31462290aae3ea842630c2)
* recipes: For auditing for setuid files, point to virt-ls examples.Richard W.M. Jones2012-08-301-4/+1
| | | | (cherry picked from commit 9fd4d16819ad200814be717732c77664e18132f2)
* recipes: For sparsifying guests, point to virt-sparsify.Richard W.M. Jones2012-08-301-4/+1
| | | | (cherry picked from commit 0d2e70b1c71dba01f71a4375eb10b83059a41bb2)
* recipes: For listing files, point to virt-ls.Richard W.M. Jones2012-08-301-3/+1
| | | | (cherry picked from commit d944a491ac3aa9b9ed1bcdc0ee378519a367276a)
* recipes: Add a section on deleting a file and other common file operations.Richard W.M. Jones2012-08-301-0/+18
| | | | (cherry picked from commit 10d48bef3055e1b7177b4f8df52133c50484a87a)
* docs: Use L<...> for links.Richard W.M. Jones2012-08-052-28/+24
| | | | | | Instead of working around bugs, podwrapper has been fixed so that links work in all output formats. (cherry picked from commit 4bc110e2bc738bde9b9c09bc602ef13c06b60e90)
* build: Change calls to podwrapper.sh to use $(PODWRAPPER).Richard W.M. Jones2012-08-051-3/+3
| | | | | | | This will allow us to easily change the location of this script in future. (cherry picked from commit f2ea617e224cd82496e56a41b5878063d6f02e3d)
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new API splits orderly close into a two-step process: if (guestfs_shutdown (g) == -1) { /* handle the error, eg. qemu error */ } guestfs_close (g); Note that the explicit shutdown step is only necessary in the case where you have made changes to the disk image and want to handle write errors. Read the documentation for further information. This change also: - deprecates guestfs_kill_subprocess - turns guestfs_kill_subprocess into the same as guestfs_shutdown - changes guestfish and other tools to call shutdown + close where necessary (not for read-only tools) - updates documentation - updates examples (cherry picked from commit ffbf1475f7ae7c462db289ad4834391469e72edd)
* examples: In create_disk example, don't call set_autosync.Richard W.M. Jones2012-07-071-9/+0
| | | | | | This is now set by default in all supported versions of libguestfs. It's just confusing if the examples refer to it. (cherry picked from commit 917550a117904ec1a06b77a7870a147014d71adb)
* examples: Add if HAVE_HIVEX ... endif around virt_dhcp_address example.Richard W.M. Jones2012-05-141-0/+2
| | | | (cherry picked from commit 7201a48d18d03bf3b16141bcff8c56e842d3b1c1)
* Check return values of guestfs_inspect_get_{type,distro} (found by Coverity).Richard W.M. Jones2012-03-081-0/+4
| | | | | | | | | | Error: NULL_RETURNS: /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:129: var_assigned: Assigning: "guest_distro" = null return value from "guestfs_inspect_get_distro". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:131: dereference: Dereferencing a pointer that might be null "guest_distro" when calling "__coverity_strcmp". [...] /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:126: var_assigned: Assigning: "guest_type" = null return value from "guestfs_inspect_get_type". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:128: dereference: Dereferencing a pointer that might be null "guest_type" when calling "__coverity_strcmp". (cherry picked from commit 618954a6b0adc3e0eacda799b88f020c801a0106)
* examples: code cleanupsWanlong Gao2012-02-022-2/+2
| | | | | | | do a code cleanup by removing the tailing spaces Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> (cherry picked from commit 90d6386c13edcb479113889bbd3cedf83c2e6277)
* Tempus fugit.Richard W.M. Jones2012-01-182-2/+2
| | | | Update all copyright dates to 2012.
* df, testing: Add notes on virt-df numbers (thanks Kashyap Chamarthy).Richard W.M. Jones2011-11-221-1/+23
|
* guestfs-testing: Link to libguestfs-test-tool.Richard W.M. Jones2011-11-211-0/+5
|
* Add guestfs-testing(1) man page.Richard W.M. Jones2011-11-202-4/+309
| | | | This contains suggested manual tests that users can run.
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* Add Erlang bindings.Richard W.M. Jones2011-09-212-0/+2
|
* out-of-tree build: remove unneeded explicit pathsHilko Bengen2011-08-171-2/+2
|
* recipes: Remove two C file dependencies which are not actually used in the POD.Richard W.M. Jones2011-08-151-1/+1
|
* out-of-tree build: fix documentation generationHilko Bengen2011-08-151-6/+6
|
* java: Add guestfs-java(3) man page.Richard W.M. Jones2011-07-192-0/+2
|
* recipes: in tr command \000 should be \0Richard W.M. Jones2011-06-031-1/+1
|
* Add new guestfs-rescue(1) man page with recipes.Richard W.M. Jones2011-05-183-4/+440
|
* guestfs-examples(3): Remove link to OCaml homepage.Richard W.M. Jones2011-05-181-2/+1
|
* Enable deprecation warnings on all C programs.Richard W.M. Jones2011-05-171-0/+3
|
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-051-23/+8
| | | | | | | | | | | | | | 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.
* examples: Add virt-dhcp-address program.Richard W.M. Jones2011-03-312-0/+354
| | | | | | This is like the mythical 'virt-ifconfig'. There is not enough certainty around the right way to be doing this for us to make a full virt tool for this. Therefore the code is just an example.
* examples: Use WARN_CFLAGS, WERROR_CFLAGS macros instead of -WallRichard W.M. Jones2011-03-311-5/+11
|
* examples: size_t-correctness change in inspect_vm.cRichard W.M. Jones2011-03-311-2/+2
|
* perl: Translate C examples into Perl and include a manual page.Richard W.M. Jones2011-01-301-0/+1
|
* fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).Richard W.M. Jones2011-01-111-2/+4
| | | | | | | | | | | | | | | | | Fix guestfish (and other C tools) so that they ignore errors when /etc/fstab contains bogus entries. Update the documentation for inspect-get-mountpoints to emphasize that callers must be aware of this when mounting the returned values. Add a regression test. Update the example code ("inspect_vm") to reflect the way this API ought to be called. For more detail see: https://bugzilla.redhat.com/show_bug.cgi?id=668574
* ruby: Translate C examples into Ruby and include documentation.Richard W.M. Jones2010-11-241-0/+1
|
* python: Translate C examples into Python and include documentation.Richard W.M. Jones2010-11-241-0/+1
|
* docs: Standard C examples, and guestfs-examples(3) man page.Richard W.M. Jones2010-11-248-276/+361
|
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-222-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This large commit changes the generator so that optional arguments can be supported for functions. The model for arguments (known as the "style") is changed from (ret, args) to (ret, args, optargs) where optargs is a more limited list of arguments. One function has been added which takes optional arguments, it is "add-drive-opts", modelled as: (RErr, [String "filename"], #required [Bool "readonly"; String "format"; String "iface"]) #optional Note that this function is processed in the library (does not go over the RPC protocol to the daemon). This has allowed us to simplify the current implementation by omitting changes related to RPC or the daemon, although we plan to add these at some point in the future. From C this function can be called in 3 different ways as in these examples: guestfs_add_drive_opts (g, filename, GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", -1); (the argument(s) between 'filename' and '-1' are the optional ones). guestfs_add_drive_opts_va (g, filename, args); where 'args' is a va_list. This works like the first version. struct guestfs_add_drive_opts_argv optargs = { .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK, .readonly = 1, } guestfs_add_drive_opts_argv (g, filename, &optargs); This last form lets you construct lists of optional arguments, and is used by guestfish and the language bindings. In guestfish optional arguments are used like this: add-drive-opts filename readonly:true In OCaml these are mapped naturally to OCaml optional arguments, eg: g#add_drive_opts ~readonly:true filename; In Perl these are mapped to extra arguments, eg: $g->add_drive_opts ($filename, readonly => 1); In Python these are mapped to optional arguments, eg: g.add_drive_opts ("file", readonly = 1, format = "qcow2") In Ruby these are mapped to a final hash argument, eg: g.add_drive_opts("file", {}) g.add_drive_opts("file", :readonly => 1) g.add_drive_opts("file", :readonly => 1, :iface => "virtio") In PHP these are mapped to extra parameters. This is not quite accurate since you cannot omit arbitrary optional parameters, but there's not much than can be done within the limitations of PHP as a language. Unimplemented in: Haskell, C#, Java.
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-202-9/+9
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds an explicit dependency on generator.ml for every file it generates, except java files. Java is left for another time because it's considerably trickier. It also adds a build rule for src/libguestfs.la so it can be rebuilt as required from other directories. It does this by creating a top level make file, subdir-rules.mk, which can be included from sub-directories. sub-directories need to define 'generator_built' to include local files which are built by generator.ml, and they will be updated automatically. This fixes parallel make, and will automatically re-create generated files when make is run from any directory. It also fixes the problem which efad4f53 was targetting. Specifically, src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and therefore generator.ml, despite not being directly created by it. This caused them to be recreated every time generator.ml ran rather than only when src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore appliance update. This patch also changes the contents of the distribution tarball by including files created by rpcgen.
* examples: Don't use STREQ etc in the to-xml.c example.Richard Jones2009-11-101-8/+8
|