summaryrefslogtreecommitdiffstats
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* Add Lua bindings.Richard W.M. Jones2012-11-171-0/+1
| | | | | | | | These are relatively complete, although only lightly tested. Missing: - events - last_errno - user_cancel
* New APIs: guestfs_create_flags, guestfs_parse_environment,Richard W.M. Jones2012-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | guestfs_parse_environment_list. Add a new function for creating a handle: guestfs_h *guestfs_create_flags (unsigned flags [, ...]); This variant lets you supply flags and extra arguments, although extra arguments are not used at the moment. Of particular interest is the ability to separate the creation of the handle from the parsing of environment variables like LIBGUESTFS_DEBUG. guestfs_create does both together, which prevents us from propagating errors from parsing environment variables back to the caller (guestfs_create has always printed any errors on stderr and then just ignored them). If you are interested in these errors, you can now write: g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT); if (!g) exit (EXIT_FAILURE); r = guestfs_parse_environment (g); if (!r) exit (EXIT_FAILURE); Also you can *omit* the call to guestfs_parse_environment, which creates a handle unaffected by the environment (which was not possible before). This commit also includes new (backwards compatible) changes to the OCaml, Perl, Python, Ruby and Java constructors that let you use the flags.
* syntax: Remove include <assert.h> where assert is not used.Richard W.M. Jones2012-09-151-1/+0
| | | | Found by 'make syntax-check'.
* podwrapper: Add --license parameter, which is required.Richard W.M. Jones2012-08-211-0/+1
| | | | | | | | | | 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.
* man pages: Ensure consistent copyright/author sections, remove licenseRichard W.M. Jones2012-08-211-18/+1
| | | | | | | | | | 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.
* Replace mount-options with mount where appropriate.Richard W.M. Jones2012-08-181-1/+1
| | | | | | Since our minimum supported version is now 1.16 and mount was fixed in 1.13.16, it is now safe to replace mount-options + empty options with mount wherever it occurs.
* python: Fix comment referring to Perl(!)Richard W.M. Jones2012-08-151-1/+1
|
* python: Fix optargs so we don't use special sentinel values.Richard W.M. Jones2012-08-151-1/+1
| | | | | | | | | Previously with Python it was impossible to set a boolean or integer optarg to -1 because that was used as a special sentinel value to indicate that the optarg was not set. Instead, use None as the sentinel value, since that cannot be a boolean or integer type.
* examples: Use add_drive_opts function in examples.Richard W.M. Jones2012-08-023-3/+3
| | | | | | | | | | | | In libguestfs 1.20, you will be able to use 'add_drive' instead of 'add_drive_opts' (except in the C bindings). However until libguestfs 1.20 is the minimum stable version people will still be using old versions where you have to use 'add_drive_opts'. This makes the examples confusing. Therefore continue to use 'add_drive_opts' in the examples for now.
* build: Change calls to podwrapper.sh to use $(PODWRAPPER).Richard W.M. Jones2012-07-161-1/+1
| | | | | This will allow us to easily change the location of this script in future.
* generator: Rename 'add_drive_opts' API to 'add_drive'.Richard W.M. Jones2012-07-145-7/+7
| | | | | | By using the once_had_no_optargs flag, this change is backwards compatible for callers (except Haskell, PHP and GObject as discussed in earlier commit).
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-032-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* perl, python, ruby: Fix comments on call to close method.Richard W.M. Jones2012-07-031-0/+3
| | | | | | | Make the comments consistent. Also make the Perl example call $g->close explicitly so it is consistent with the other examples.
* examples: In create_disk example, don't call set_autosync.Richard W.M. Jones2012-07-031-7/+0
| | | | | This is now set by default in all supported versions of libguestfs. It's just confusing if the examples refer to it.
* python: Set PYTHON in run script.Richard W.M. Jones2012-06-281-3/+1
|
* tests: Add ./run --test option.Richard W.M. Jones2012-06-261-1/+1
| | | | | | | This option, when added via TESTS_ENVIRONMENT = [...] $(top_builddir)/run --test allows us to run the tests and only print the full output (including debugging etc) when the test fails.
* launch: Treat /dev/null specially, for old KVM.Richard W.M. Jones2012-06-252-2/+10
| | | | | | | | | Old KVM can't add /dev/null readonly. Treat /dev/null as a special case. We also fix a few tests where /dev/null was being used with format=qcow2. This was always incorrect behaviour, but qemu appears to tolerate it.
* build: Define builddir and abs_srcdir when they are missing.Richard W.M. Jones2012-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | RHEL 5-era autoconf did not define these, so define them manually when they are missing. Define builddir as '.' The scripts require this. It won't work in the srcdir != builddir case, but we don't care about that for RHEL 5. This commit also moves the builddir / abs_srcdir variable setting above the include of subdir-rules.mk, in case that include uses these variables. Useful script: for f in $(find -name Makefile.am | xargs fgrep '$(abs_srcdir)' -l) ; do if ! grep -q '^abs_srcdir' $f; then echo missing in $f fi done
* python: Remove 'del g' from the docs, replace with 'g.close ()'.Richard W.M. Jones2012-04-174-4/+4
| | | | | | | | | 'del g' is a trap for the unwary. If the handle has any other references, it does nothing (in fact, it can be actively dangerous if the user was expecting the appliance to go away). In non-CPython it can be delayed arbitrarily long. Using 'g.close()' on the other hand is always safe.
* python: Add a regression test for RHBZ#811650.Richard W.M. Jones2012-04-111-0/+29
|
* python: Add PYTHONPATH to './run' script.Richard W.M. Jones2012-04-111-4/+2
| | | | | | | Also: - tidy up the script - use the ./run script when running Python tests
* maint: use $var notation rather than ${var} when possibleJim Meyering2012-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed some uses of ${srcdir} in shell scripts. That is almost always better written as $srcdir. The patch below converts most such variable references. Here are the few remaining candidates: $ git grep -i -E '\$\{[a-zA-Z_0-9]+\}'|grep -v Makefile.in.in configure.ac: JAR_INSTALL_DIR=\${prefix}/share/java configure.ac: JNI_INSTALL_DIR=\${libdir} debian/rules: for TEST in ${DEBIAN_SKIP_TEST}; do \ debian/rules:# mv $${mod} $$(dirname $${mod})/libguestfsmod.so; \ java/Makefile.am:libguestfs_jar_DATA = libguestfs-${VERSION}.jar java/Makefile.am:libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files) perl/lib/Sys/Guestfs/Lib.pm: "-f", '${Package} ${Version} ${Architecture} ${Status}\n', perl/typemap: croak (\"${Package}::$func_name(): called on a closed handle\"); perl/typemap: croak (\"${Package}::$func_name(): $var is not a blessed HV reference\"); tests/data/Makefile.am: echo "$${i}abcdefghijklmnopqrstuvwxyz"; \ We could change all of those, too, except the ones in configure.ac and Makefile.am, since they refer to Make variables. Even those should be changed, but to use the preferred Makefile notation: $(prefix), $(libdir), $(VERSION). >From a86770ecd45666232a94d76c8725c8f9b1c76e3a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Mon, 23 Jan 2012 11:15:12 +0100 Subject: [PATCH libguestfs] maint: use $var notation rather than ${var} when possible The only case to avoid in a shell script is when the byte after the "}" is word-constituent, and concatenating it would thus change the name of the variable. These changes were induced by running this command: git grep -l -i -E '\$\{(srcdir|md)' \ |xargs perl -pi -e 's/\$\{(srcdir|md)\}($|\w)/\$$1$2/gi' The "g" was needed because there was one line with two instances. The "i" is to handle ${SRCDIR}. The ($|\w) ensures that concatenating whatever follows the "}" won't change semantics. * gobject/run-bindtests: Use "$srcdir", not "${srcdir}". * haskell/run-bindtests: Likewise. * java/run-bindtests: Likewise. * ocaml/run-bindtests: Likewise. * perl/run-bindtests: Likewise. * python/run-bindtests: Likewise. * ruby/run-bindtests: Likewise. * tests/guests/guest-aux/make-debian-img.sh: Likewise, but $SRCDIR. * tests/guests/guest-aux/make-ubuntu-img.sh: Likewise. * tests/guests/guest-aux/make-windows-img.sh: Likewise. * tests/md/test-mdadm.sh: Likewise, but $md.
* Do not run appliance-related checks if not building applianceHilko Bengen2012-01-231-2/+6
|
* Tempus fugit.Richard W.M. Jones2012-01-186-6/+6
| | | | Update all copyright dates to 2012.
* python: Missing () in guestfs-python(1) examples.Richard W.M. Jones2011-12-141-1/+1
|
* python: Memory leak: Free roots array along handle close path.Richard W.M. Jones2011-11-291-0/+1
|
* Update FSF address.Matthew Booth2011-11-089-9/+9
|
* python: Fixes for Python 3 (RHBZ#750889).Richard W.M. Jones2011-11-021-1/+1
| | | | | | | | | | | | | These fixes allow libguestfs bindings to work with Python 3 (tested with Python 3.2) You can select which Python you compile against by doing: PYTHON=python ./configure && make && make check or: PYTHON=python3 ./configure && make && make check
* python: Pass $PYTHON environment variable to tests.Richard W.M. Jones2011-11-023-6/+7
| | | | | | | | If the user set PYTHON when configuring, this variable is not passed through to the tests, so it is possible the tests will fail because they are testing the wrong version of python. By passing $PYTHON through to the tests we ensure that we test against the same version of python that we configured with.
* out-of-tree build: fixed bindtests and inspectorHilko Bengen2011-10-211-2/+2
|
* Add Erlang bindings.Richard W.M. Jones2011-09-211-0/+1
|
* python: Don't build static libraryHilko Bengen2011-08-241-1/+1
|
* out-of-tree build: fix documentation generationHilko Bengen2011-08-151-3/+3
|
* build: Set TMPDIR for local testing.Richard W.M. Jones2011-08-081-1/+2
| | | | | | This avoids conflicts with the globally installed libguestfs appliance, or lets us build in multiple local directories at the same time without conflicts.
* python: Don't name extension with .so.0.0 and symlinks (thanks Dan Berrange).Richard W.M. Jones2011-08-051-0/+1
|
* java: Add guestfs-java(3) man page.Richard W.M. Jones2011-07-191-0/+1
|
* python: Add explicit g.close() method (RHBZ#717786).Richard W.M. Jones2011-06-301-0/+59
|
* Add new guestfs-rescue(1) man page with recipes.Richard W.M. Jones2011-05-181-0/+1
|
* python: Ensure Python GIL state is correct during callback.Richard W.M. Jones2011-04-221-0/+8
| | | | This updates commit 2cac52000a6a96a583af72e289a4296c596047d5.
* python: Implement new event API.Richard W.M. Jones2011-04-223-0/+215
| | | | | This implements set_event_callback and delete_event_callback so that Python programs can use the new event mechanism.
* python: Rearrange C files for bindings.Richard W.M. Jones2011-04-223-1/+137
| | | | | | | Move the hand-written functions into two new files: guestfs-py.h and guestfs-py-byhand.c This is just code motion.
* 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-1/+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
* build: Use ./configure --with-python-installdir=DIR to select Python dir.Richard W.M. Jones2010-12-091-1/+1
| | | | | | We don't always want to install in the site-packages directory. Allow the directory to be chosen using a configure option. Rename the variable PYTHON_INSTALLDIR to reflect its true purpose.
* python: Combine tests to reduce number of launches.Richard W.M. Jones2010-11-302-30/+2
|
* 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-245-0/+231
|
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-221-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove guestfs_wait_ready (turn it into a no-op).Richard Jones2009-09-212-2/+0
| | | | | | | | | | | | | | This commit changes guestfs_launch so that it both launches the appliance and waits until it is ready (ie. the daemon communicates back to us). Since we removed the pretence that we could implement a low-level asynchronous API, the need to call launch() followed by wait_ready() has looked a bit silly. Now guestfs_wait_ready() is basically a no-op. It is left in the API for backwards compatibility. Any calls to guestfs_wait_ready() can be removed from client code.