Commit Graph

38 Commits

Author SHA1 Message Date
Richard W.M. Jones
edd5f7f737 df: Correctly quote libvirt domain and filesystem in --csv mode (RHBZ#639986).
This fixes virt-df --csv when used with libvirt domains that contain
quotes, spaces, commas and other lesser-used characters.
(cherry picked from commit f7475ec577)
2010-10-23 12:34:06 +01:00
Richard Jones
044a7d083f tar: Remove redundant use statement.
(cherry picked from commit 70d27f6e79)
2010-07-12 08:46:15 +01:00
Richard Jones
a0c41d127d edit: Clean up temporary files.
Note to self: The 'tempfile' function does *not* default to
removing files with the program exits!

For stable-1.2 branch:
 - Cherry picked from commit 10ea14a3f1
 - Rebase.
2010-07-12 08:45:31 +01:00
Richard Jones
2373ba34c2 virt-df: Disallow -h and --csv options together (RHBZ#600977).
Before this commit, if you used the -h and --csv options together
you would get these warnings from virt-df:

$ virt-df -h --csv Guest
Virtual Machine,Filesystem,Size,Used,Available,Use%
Argument "13.5G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "4.7G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "8.1G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
"/dev/vg_trick/RHEL55x64","/dev/VolGroup00/LogVol00",13,4,8,34.8%
Argument "98.7M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "18.8M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "74.9M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
"/dev/vg_trick/RHEL55x64","/dev/vda1",98,18,74,19.0%

We could fix this so that the human-readable numbers get written
into the CSV file.  However would probably be wrong for most uses
of the CSV format (databases and spreadsheets) since they would not
be able to interpret these human-readable numbers, or worse could
misinterpret, eg. thinking that "1M" and "1G" are both 1.

Therefore this commit disallows this combination of options.
(cherry picked from commit aaf03a51a2)
2010-07-12 08:34:25 +01:00
Richard Jones
51c6cc6081 resize: Refresh the examples in the documentation.
The documentation was previously very intimidating.  Bring some
common, simple examples up to the top of the page in a separate
section.

For stable-1.2 branch:
 - cherry picked from commit 0e28e4104d
 - modified instructions slightly to apply to older version of
   virt-list-partitions
 - replace 'truncate' with 'dd'
2010-06-02 19:25:50 +01:00
Richard Jones
252fe8ee2e virt-df: Display domains in sorted order.
(cherry picked from commit 5d5565ca24)
2010-05-17 11:13:32 +01:00
Richard Jones
c8e225b8e0 Improved error if virt-inspector cannot find OSes in image (RHBZ#591142).
(cherry picked from commit 94e310dcfb
and modified to apply to the stable branch)
2010-05-14 17:24:24 +01:00
Richard Jones
7f48d06d93 Reduce imported functions in virt-df to ones which are actually used.
(cherry picked from commit 5477d98548)
2010-05-14 17:23:44 +01:00
Richard Jones
ab7f296b63 virt-rescue: Refresh documentation.
(cherry picked from commit d0afef23e5)
2010-05-14 17:23:44 +01:00
Richard Jones
995a50f1fa tools: Fix documentation for CurrentControlSet (thanks Yuval Kashtan).
(cherry picked from commit 25c1526125)
2010-04-30 17:38:01 +01:00
Richard Jones
79089f73d0 virt-resize: Mention alternate tools like gparted in the documentation.
Note for stable-1.2:
Cherry picked from development commit c53e64a and rebased
against stable-1.2 tree.
2010-04-12 19:11:56 +01:00
Richard Jones
9ac3cfd1a7 Documentation updates.
Fix copyright years.
Fix URLs to point to new PRC site.
Make sure guestfish(1) and guestfs(3) manpages reference the
current list of tools.

(cherry picked from commit 9a608a1516)
2010-04-12 19:09:57 +01:00
Richard Jones
73ae773ca2 Bugfixes for virt-resize.
- copy more than 64 boot loader sectors across, since real boot
   loaders (eg. for Windows) can be much larger than this
 - copy bootable flag and ID byte to new partitions
 - start the first partition on the new disk at the same sector
   offset as on the old disk
 - sync the disks before existing
(cherry picked from commit add5e22563)
2010-04-12 19:08:21 +01:00
Richard Jones
2e47daea51 chmod +x virt-resize binary. 2010-03-30 17:49:24 +01:00
Richard Jones
855c321b59 Fix EXTRA_DIST rule. 2010-03-30 17:49:06 +01:00
Richard Jones
4b48f93ce6 Improved version of virt-win-reg, supporting exporting and merging. 2010-03-30 16:25:12 +01:00
Richard Jones
29c78cc979 virt-df: Match output with native (coreutils) 'df' command (RHBZ#578123).
This commit fixes the 'Use%' field in the output so it matches what
coreutils' 'df' command would print.

Firstly we change the calculation to use the space available to root,
not the space available to non-root.  This means it matches what 'df'
when run as root in the guest would show.

Secondly we display this rounded up to the next whole percent (ie. using
ceil), which is also what 'df' does.

Thirdly we change the regression test so it tests this.

Note that even with these changes you are not guaranteed to get precisely
the same figures from inside and outside the guest, as it depends on
how quiescent the guest is and how recently the superblock was synced.

Thanks: Rita Wu
2010-03-30 16:14:09 +01:00
Richard Jones
fc5fbd460a tools: Add basic tests for the virt-* tools. 2010-03-30 14:20:23 +01:00
Richard Jones
bbe4888cd4 tools: Sectional header for manpages in Makefile.am 2010-03-30 13:45:16 +01:00
Richard Jones
f25da97554 tools: Rearrange list of tools in Makefile.am. 2010-03-30 13:44:29 +01:00
Richard Jones
def627e4da New tools: virt-resize and virt-list-partitions.
Virt-resize is the main contribution here, a program which can
be used to expand and shrink partitions in disk images.

Virt-list-partitions is used as an ancillary tool for planning
resize operations.
2010-03-23 21:56:14 +00:00
Richard Jones
369872b91e Tab to space (whitespace fixes only). 2010-03-12 16:23:46 +00:00
Richard Jones
a8c3723e38 Spin off hivex as a separate upstream project.
This commit makes the semi-independent hivex library into a
separate upstream project.  The git repo for hivex is now:

http://git.annexia.org/?p=hivex.git;a=summary

Downloads of hivex are available here:

http://libguestfs.org/download/

All questions, patches, bugs etc should be sent to the libguestfs
mailing list and bug tracker.
2010-02-22 13:19:21 +00:00
Richard Jones
abe54abdd2 Remove unused Perl modules.
These were 'use'd but not actually used.
2010-02-19 13:50:31 +00:00
Richard Jones
15a5511e03 hivex: Add 'hivexsh' program (shell for navigating registry hives). 2010-01-29 18:23:58 +00:00
Richard Jones
582b64a7b1 virt-rescue: Freshen documentation. 2009-11-26 22:40:57 +00:00
Richard Jones
299d5b9dd2 New tool: virt-list-filesystems
Use this program as a convenient way to list the filesystems
available in a disk image or libvirt guest.

Example:

  $ virt-list-filesystems /dev/vg_trick/Debian5x64
  /dev/debian5x64/home
  /dev/debian5x64/root
  /dev/debian5x64/tmp
  /dev/debian5x64/usr
  /dev/debian5x64/var
  /dev/sda1

This is designed to make it easier for novices to use guestfish
and guestmount.  In particular with guestmount this acts as a way
to get a list of filesystems to use with the '-m' option.  ie:

  $ virt-list-filesystems unknowndisk.img
  /dev/sda1
  /dev/sda2
  $ guestmount -a unknowndisk.img -m /dev/sda1 /mnt
2009-11-24 16:01:11 +00:00
Matthew Booth
c477e2fb78 build: Fix inter-directory dependencies
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.
2009-11-19 16:40:22 +00:00
Richard Jones
dda10cd935 virt-df: Ignore domains which have ID 0.
This is the remainder of the fix for RHBZ#538041.  Domains
which have ID 0 are special domains.  libvirt defines it as
the "control plane OS".  Only Xen and HyperV have this
behaviour, and in both cases we should ignore those domains
for the purposes of virt-df (user can just run "df" if they
need that information for the dom0).
2009-11-17 14:21:54 +00:00
Richard Jones
9004f3c530 virt-df: Turn errors into warnings when listing all domains.
This is a partial fix for RHBZ#538041.  When listing all domains,
don't die just because one domain fails, but keep trying for the
rest.
2009-11-17 14:09:58 +00:00
Jim Meyering
e645763007 indent with spaces, not TABs
* HACKING: Expand indentation TABs.
* configure.ac: Likewise.
* daemon/daemon.h: Likewise.
* daemon/guestfsd.c: Likewise.
* fuse/guestmount.c: Likewise.
* hivex/LICENSE: Likewise.
* src/generator.ml: Likewise.
* tools/virt-win-reg: Likewise.
2009-11-09 20:19:42 +01:00
Richard Jones
792c528300 Support for Windows Registry.
In hivex/:  This mini-library allows us to extract Windows
Registry binary files ("hives").

There are also two tools: hivexml converts a hive to a
self-describing XML format.  hivexget can be used to extract
single subkeys from a hive.

New tool: virt-win-reg.  This is a wrapper around the library
functionality allowing you to pull out data from the registries
of Windows guests.
2009-10-29 15:58:23 +00:00
Richard Jones
de64183f3d Tab to space fixes, now passes 'make syntax-check' 2009-10-20 15:03:16 +01:00
Richard Jones
ea12489788 virt-ls: Modify to use find0 instead of find.
find0 is more scalable than find.  virt-ls will no longer
crash if asked to recursively list / on a Linux guest.
2009-10-20 10:31:54 +01:00
Richard Jones
4dd6b77ff7 New tool: virt-ls
This tool makes available the functionality of "ls", "ll", and "find"
in a slightly simpler to use form.

Examples:

  virt-ls -l myguest /tmp
2009-10-20 10:31:54 +01:00
Richard Jones
984a35cfc0 New tool: virt-tar
This adds a new tool call virt-tar which is a general purpose
archive and uploading tool.  It doesn't add any functionality
which wasn't previously possible using guestfish, but makes it
simpler to access for some users.

Examples:

 virt-tar -zx myguest /home home.tar.gz
 virt-tar -zu myguest uploadstuff.tar.gz /tmp
2009-10-20 10:31:44 +01:00
Richard Jones
5c4bf92bc2 tools: Make warnings about running on live guests more prominent.
Add prominent warnings to the man pages about how it is dangerous
to run these tools against live guests.
2009-10-19 10:45:44 +01:00
Richard Jones
945b6e0a08 Move virt tools (virt-cat, virt-edit etc) into tools/ subdirectory.
This moves the tool programs into a single directory:
  cat/* -> tools/virt-cat
  df/* -> tools/virt-df
  edit/* -> tools/virt-edit
  rescue/* -> tools/virt-rescue

This in itself simplifies the build process because we only need
one Makefile and one copy of 'run-locally'.

'run-*-locally' has become just 'run-locally' and takes an extra
parameter which is the name of the tool, eg:
  run-locally cat [virt-cat params...]

virt-inspector stays in its own directory, because this contains
more than just a single Perl script.
2009-10-19 10:18:46 +01:00