713 Commits

Author SHA1 Message Date
Richard W.M. Jones
e3df223a5a fish: Fix guestfish so it can recognize sheepdog://... as a valid URI.
Because "sheepdog" is 8 characters, it wasn't recognized before.
2013-07-30 16:13:24 +01:00
Richard W.M. Jones
4d7c14fdbb fish: Split off URI handling (for -a argument) from general options parsing.
This is so we will be able to reuse the same code in the OCaml tools.

This is just code motion.
2013-07-30 15:37:16 +01:00
Richard W.M. Jones
671be806ae fish: options: Fix optarg -> arg.
Don't read the global variable optarg.  Read arg instead.
(In all cases they are the same, so this bug made no difference).
2013-07-30 13:49:49 +01:00
Richard W.M. Jones
a3891430bc fish: Don't store xmlURIPtr directly in the drive struct.
Original drv_uri fields:

      xmlURIPtr uri;        /* URI */
      char *socket;         /* ?socket parameter from URI. */
      const char *format;   /* format (NULL == autodetect) */

New drv_uri fields:

      char *path;           /* disk path */
      char *protocol;       /* protocol (eg. "nbd") */
      char **server;        /* server(s) - can be NULL */
      char *username;       /* username - can be NULL */
      const char *format;   /* format (NULL == autodetect) */
      const char *orig_uri; /* original URI (for error messages etc.) */

This is just code motion.
2013-07-30 12:17:22 +01:00
Richard W.M. Jones
4180abcc1f tests: Use unique or temporary names for temporary files.
Review every test(!) to ensure that it:

 - Doesn't use a generic name (eg. "test1.img", "test.out") for any
   temporary file it needs.

 - Does instead use a unique name or a temporary name (eg. a name like
   "name-of-the-test.img", or a scratch disk).

 - Does not use 'rm -f' to clean up its temporary files (so we can
   detect errors if the wrong temporary file is created or removed).

This allows tests to be run in parallel, so they don't stomp on each
other's temporary files.
2013-07-23 10:16:00 +01:00
Richard W.M. Jones
ccd069f859 fish: For -N option, add drive with explicit format = "raw".
Although autodetecting is safe (we always have just created a drive),
it saves a little bit of time if we don't have to run qemu-img to
detect the disk format with the libvirt backend.

Note that for prepared drives the format is always raw and we don't
anticipate creating drives in other formats.
2013-07-23 09:44:32 +01:00
Richard W.M. Jones
7c8c6e0760 fish: Allow -N filename=type to use 'filename' instead of 'test1.img' (etc.)
So:

  guestfish -N fs

is equivalent to:

  guestfish -N test1.img=fs
2013-07-22 15:45:06 +01:00
Richard W.M. Jones
3c94f02456 fish: Split up long line in --help output. 2013-07-22 15:24:52 +01:00
Richard W.M. Jones
a8b03201f0 fish: Clarify documentation.
It's not "the guest" which is launched, but the libguestfs appliance.
2013-07-22 15:16:39 +01:00
Richard W.M. Jones
e52a6b56f4 fish: Check for out of memory failure.
(Found by Coverity)
2013-05-28 15:48:42 +01:00
Richard W.M. Jones
5c80f22b64 syntax-check: Remove unused ``#includes''. 2013-05-24 14:20:51 +01:00
Hilko Bengen
40a0e08619 fish/test-events.sh: ignore "trace get_path" line
The test would fail when LIBGUESTFS_PATH was not set.
2013-05-19 21:55:29 +02:00
Richard W.M. Jones
83f74f5c56 Add support for qemu's curl driver (ie. FTP, FTPS, HTTP, HTTPS, TFTP). 2013-05-11 18:49:15 +01:00
Richard W.M. Jones
0a065c4574 drives: ceph/gluster/iscsi/sheepdog/ssh: Force the disk name to begin with a '/'.
This avoids confusion when using URIs in guestfish, since the path
will always start with a '/', and we don't otherwise know if we should
remove it or not.  By forcing the '/' to always be there, we deal with
this problem in the API instead.
2013-05-11 13:33:36 +01:00
Richard W.M. Jones
8b271101a1 Add support for iSCSI. 2013-05-10 22:24:24 +01:00
Richard W.M. Jones
3287f177e0 fish/options.c: Whitespace changes. 2013-05-09 08:52:40 +01:00
Dave Vasilevsky
a820e9e3bd fuse: Document the fstype parameter 2013-05-09 08:42:55 +01:00
Dave Vasilevsky
f83df69bec fuse: Allow specifying the fstype of a mount 2013-05-09 08:42:55 +01:00
Richard W.M. Jones
a9c81f1919 fish: Add $srcdir in several places where test files exist in the source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
3b0e432875 fish: options: Allow Unix domain sockets to be specified in --add URIs.
You can now use a URI such as:

 guestfish -a nbd://?socket=/tmp/sock

(a NBD connection to Unix domain socket /tmp/sock).
2013-04-16 23:25:36 +01:00
Richard W.M. Jones
44092e06ce fish: options: Format server name as "tcp:host[:port]".
This is safer, because otherwise a URI could contain some clever
"unix:..." string as the hostname, tricking qemu into opening a Unix
domain socket at an uncontrolled location.

This fixes commit 349300af08.
2013-04-16 19:37:20 +01:00
Richard W.M. Jones
2f0a4d7c18 Require libxml2.
libxml2 is very commonly available on Linux distros and has also been
ported (and is widely available) on Mac OS X and Windows.  Therefore
simply require libxml2, and remove a lot of conditional code.
2013-04-16 16:46:01 +01:00
Richard W.M. Jones
349300af08 fish: Add -a URI (add remote storage) to options.
Add a remote drive by doing:

 guestfish -a ssh://example.com/path/to/disk.img

There are several different protocols supported, as explained in the
man page.

This affects all virt-* tools that use the common guestfish options
parsing code.
2013-04-16 15:28:31 +01:00
Richard W.M. Jones
b48e416d27 fish: options: Whitespace change. 2013-04-16 13:57:01 +01:00
Richard W.M. Jones
142b874ce8 Remove use of gnulib progname module.
It's simpler to use the glibc 'program_invocation_short_name(3)'
feature, and fall back to a generic solution.  Also remove risky
assignments to argv[0].
2013-04-11 14:42:54 +01:00
Richard W.M. Jones
1a06ac25f5 fish: Add help for prepared disk images to the man page.
Also the long description for each prepared disk image can now contain
Perl POD markup.
2013-04-10 12:28:14 +01:00
Richard W.M. Jones
2cf0b5c19b fish: welcome message: guestfish can edit disk images. 2013-04-09 23:26:39 +01:00
Richard W.M. Jones
abe07ce2ca "guestfish" now means the "guest filesystem shell".
Remove the word "interactive" which implies that guestfish can only
(or often) be used interactively.
2013-04-09 23:21:42 +01:00
Richard W.M. Jones
1cb38ab924 New API: feature-available.
This API is an easier to use version of the existing guestfs_available,
because the new API returns true/false instead of throwing an error
when a feature from the list is not available.

In truth we've had this implementation internally in the library
and several tools and in Sys::Guestfs::Lib for a long time.  This
change just turns it into a publicly consumable API.
2013-04-02 12:38:50 +01:00
Richard W.M. Jones
68990840b6 "attach method" is from now on known as "backend".
This large, but mainly mechanical commit, renames "attach method"
everywhere to "backend".

Backwards compatibility of the API (guestfs_{set,get}_attach_method)
and environment (LIBGUESTFS_ATTACH_METHOD) is maintained, but in new
code use guestfs_{set,get}_backend and LIBGUESTFS_BACKEND instead.

The default backend (launching qemu directly) is now called 'direct'
instead of 'appliance', although you can still use 'appliance' as a
synonym.
2013-04-01 11:16:18 +01:00
Richard W.M. Jones
3c34db9808 Use new-style demand-loaded bash-completion scripts. 2013-03-28 18:46:06 +00:00
Richard W.M. Jones
924aa44c1f bash completion: Extend this script to work with other virt tools. 2013-03-28 15:15:45 +00:00
Richard W.M. Jones
6c9a7fe561 Add --long-options option to most tools.
For example:

$ guestfish --long-options
--add
--cmd-help
--connect
--csh
--domain
--echo-keys
[etc.]

The idea of this is to make it easier to write a bash completion
script that accurately expands --<TAB> options for each command.
2013-03-28 14:46:20 +00:00
Richard W.M. Jones
b98de580c9 fish: Better tab completion for guestfish. 2013-03-28 14:00:42 +00:00
Richard W.M. Jones
1b644ad64e utils: Fix error messages for external commands that fail (RHBZ#921040).
This adds a common utility function (guestfs___exit_status_to_string)
and a common error function (guestfs___external_command_failed), and
uses them all over the library and tools when converting exit status
in error messages etc.
2013-03-13 18:34:17 +00:00
Richard W.M. Jones
c64e99782f docs: Note that $PATH affects libguestfs.
If $PATH is not set, libguestfs and/or libvirt tend to break.
2013-03-11 14:28:40 +00:00
Richard W.M. Jones
3e9e40aee3 fuse: Add guestunmount program to handle unmounting (RHBZ#916780). 2013-03-05 13:12:25 +00:00
Richard W.M. Jones
0b7acf50b6 fish: Use guestfs___{free_string_list,count_strings} utility functions.
Instead of custom-coded versions.
2013-02-20 19:32:11 +00:00
Richard W.M. Jones
04723b4dd1 lib: Create libutils convenience library.
The libutils convenience library is a place for code shared between
the main library, language bindings and virt tools.  Note that the
code is statically linked into both the library, each binding and each
tool, but this is an improvement because (a) the source is shared and
(b) libguestfs.so can export fewer private functions.

Currently it contains the cleanup functions, and the functions
guestfs___free_string_list function and guestfs___for_each_disk.

guestfs___for_each_disk has changed so that it no longer
unconditionally sets the error in the guestfs handle.  Instead callers
can control error handling.
2013-02-20 19:15:05 +00:00
Richard W.M. Jones
2a8de9001e fish: Use guestfs_event_to_string instead of guestfish-specific generated functions. 2013-02-19 13:41:57 +00:00
Richard W.M. Jones
09c4f94c9d build: Separate out *_CPPFLAGS from *_CFLAGS.
This is pretty pointless.
2013-02-11 21:36:27 +00:00
Richard W.M. Jones
e527aed895 getline: Rename &n parameter as &allocsize.
The second parameter passed into getline(3) is the size of the
allocated buffer, *NOT* the length of the returned line.  This can be
confusing, so rename this parameter as 'allocsize' consistently
throughout the code.

This is just code motion.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
59b296fecc tools, tests: Use "guestfs-internal-frontend.h" header.
Instead of redefining STREQ, etc.
2013-02-08 16:15:25 +00:00
Richard W.M. Jones
a0a4ee5245 Use 'supermin' and 'supermin-helper' in preference to febootstrap.
Febootstrap has been renamed upstream to 'supermin':
https://www.redhat.com/archives/libguestfs/2013-February/msg00004.html

This commit changes libguestfs so it can use either program to build
the supermin appliance.
2013-02-05 15:31:05 +00:00
Richard W.M. Jones
4940bd9a9e fish: Be stricter about boolean values.
Previously I noticed that bfan used this command without any error:

><fs> hivex-open /WINDOWS/system32/config/software write:ture
                                                   ^^^^^^^^^^

This was because the code allowed any string to be evaluated as a
boolean.

The new code is stricter.  It allows the following strings only case
insensitive (everything else is an error):

  1
  true
  t
  yes
  y
  on

  0
  false
  f
  no
  n
  off
2013-02-04 12:45:02 +00:00
Richard W.M. Jones
0d18a8b407 Update copyright dates for 2013. 2013-02-02 13:56:19 +00:00
Richard W.M. Jones
791ad3e9e6 fish: Use CLEANUP_* macros in a lot of places. 2013-02-01 16:18:42 +00:00
Richard W.M. Jones
6c1aca5ae2 fish: Use CLEANUP_FREE in parse_config. 2013-02-01 15:54:13 +00:00
Richard W.M. Jones
4b20a20d33 Remove TMP_TEMPLATE_ON_STACK macro. 2013-02-01 14:48:35 +00:00
Richard W.M. Jones
42bffcd00a Remove all occurrences of the bad_cast (lowercase) function.
Not to be confused with the libxml2 macro 'BAD_CAST' which converts
from 'signed char *' to 'unsigned char *'.

The 'bad_cast' function was defined and used all over the place as a
replacement for a '(char *)' cast.  I think it is better to make these
casts explicit, instead of hiding them in an obscure function.
2013-02-01 14:16:51 +00:00