Commit Graph

96 Commits

Author SHA1 Message Date
Richard W.M. Jones
e494a59921 build: Set TMPDIR for local testing.
This avoids conflicts with the globally installed libguestfs
appliance, or lets us build in multiple local directories at the same
time without conflicts.

Cherry picked from commit f7d18c84dd
and backported to stable-1.8.
2011-08-17 13:10:19 +01:00
Richard W.M. Jones
830a2d29d9 virt-tar test: Stable ordering of test output.
The files could be listed in any order, resulting in the test failing
for no reason.  Sort the output of tar.
(cherry picked from commit 995b3fecb9)
2011-08-07 22:03:39 +01:00
Richard W.M. Jones
3bc613e925 edit: Move 'exit 0' to end of file.
This is just code motion.
(cherry picked from commit 60cdf44606)
2011-04-11 11:09:27 +01:00
Richard W.M. Jones
b40f442f41 edit: Let $root == $roots[0].
This is just code motion.
(cherry picked from commit aed8f220d2)
2011-04-11 11:09:20 +01:00
Richard W.M. Jones
ee993d1a4d cat, edit: Reference guestfish equivalent commands in the manual pages.
(cherry picked from commit 4de124debf)
2011-04-11 11:09:10 +01:00
Richard W.M. Jones
739431339b tests: Don't fail when compiled without support for NTFS.
(cherry picked from commit edb7501d60)
2011-04-11 11:01:45 +01:00
Richard W.M. Jones
edffc79f70 virt-make-fs: Round disk size to integer, fix for qemu-img 0.14.
qemu-img used to allow you to specify a fractional image size in bytes
(or at least, it used to ignore the part after the decimal place).  In
qemu-img 0.14 it no longer does this so we round down the size to a
whole number of bytes.
(cherry picked from commit eda9826d25)
2011-03-08 14:57:42 +00:00
Richard W.M. Jones
93d9d50ac8 virt-make-fs: In debug mode, print qemu-img command line.
(cherry picked from commit 29b3ffdad5)
2011-03-08 14:57:36 +00:00
Richard W.M. Jones
f72a3c4742 virt-make-fs: Fix typo in man page.
(cherry picked from commit 0089575d4b)
2011-03-08 14:54:58 +00:00
Richard W.M. Jones
0309719307 resize: Fix typo in man page (thanks avesh@IRC).
(cherry picked from commit 7e1114445e)
2011-01-10 09:41:54 +00:00
Richard W.M. Jones
8d8dc4c107 win-reg: Add Windows Tips to documentation. 2010-12-10 15:12:02 +00:00
Richard W.M. Jones
bc484e99c2 win-reg: Move documentation after options, combine shell quote sections. 2010-12-10 14:36:18 +00:00
Richard W.M. Jones
6f09e4774c docs: Fix small inaccuracies in virt-resize(1). 2010-11-27 18:52:51 +00:00
Richard W.M. Jones
a6054bf90f rescue: Rewrite virt-rescue in C. 2010-11-26 15:12:25 +00:00
Richard W.M. Jones
18374b5b7d df: Rewrite virt-df in C.
I have diffed the output from the original virt-df with this
new version, and they agree very closely.  Some differences:

 - Old virt-df have a divide-by-zero error in cases where the
   number of used inodes was 0.  New virt-df fixes this.

 - New virt-df uses gnulib human_readable library which displays
   numbers to 3 significant figures for -h output (old version
   used an ad hoc function).
2010-11-25 18:58:13 +00:00
Richard W.M. Jones
e1aca6323e build: Centralize all POD manipulation in 'podwrapper.sh' script. 2010-11-24 20:12:08 +00:00
Richard W.M. Jones
fbc2555903 New tool: virt-filesystems
This tool replaces virt-list-filesystems and virt-list-partitions with
a new tool written in C with a more uniform command line structure
and output.

This existing Perl tools are deprecated but remain indefinitely.
2010-11-23 10:22:08 +00:00
Richard W.M. Jones
f6d3d56771 ls: Rewrite virt-ls in C. 2010-11-23 09:48:05 +00:00
Richard W.M. Jones
f33d899fd0 resize: Fix canonical device function (RHBZ#655554). 2010-11-23 09:48:04 +00:00
Richard W.M. Jones
4ac3124760 rescue: Fix typo in documentation of --network option. 2010-11-16 23:34:07 +00:00
Richard W.M. Jones
6d4815d3a4 images: Make a better phony Fedora image.
This now includes a product string, major and minor version,
hostname and even some applications.
2010-11-16 18:36:29 +00:00
Richard W.M. Jones
d29e9a552f Rewrite virt-cat in C.
With changes in the core API since 1.5, virt-cat was little
more than a Perl wrapper which did some command line argument
processing.  Thus it could easily be rewritten in C.

This version also shares core command line argument processing
with guestfish and guestmount, so the options have changed
slightly (old-style command line *is* supported).

 virt-cat -a disk.img file [file ...]
 virt-cat -d domname file [file ...]

Several other guestfish options are supported including encryption,
and with the new style multiple files can be downloaded.  See the
man page for details.
2010-11-11 16:56:43 +00:00
Richard W.M. Jones
4d900cdac8 Generate a dummy 'Fedora' fedora.img in images directory for use by tests.
We were generating this dummy 'Fedora' image already in the
tools directory.  It contains just enough Fedora-like files
to fool our inspection code and thus to test the tools.

This is general enough that we can use it everywhere.
2010-11-11 16:56:11 +00:00
Richard W.M. Jones
bfeffeb1e4 virt-win-reg: Current is the control set Windows chooses at boot. 2010-11-03 23:17:51 +00:00
Richard W.M. Jones
0353688577 list-filesystems: Use core list-filesystems API (RHBZ#642933).
Change virt-list-filesystems to use the core inspection API
instead of the deprecated Sys::Guestfs::Lib::get_partitions
function.
2010-10-28 15:48:16 +01:00
Richard W.M. Jones
ca7e941329 tools: Use C API for inspection (RHBZ#642930).
Update the following tools to use the C API for inspection:

 - virt-cat
 - virt-edit
 - virt-ls
 - virt-tar
 - virt-win-reg

None of the tools in the tools/ directory now use the deprecated
Perl inspection APIs.
2010-10-28 15:16:15 +01:00
Richard W.M. Jones
2f52a40bed edit: Clean up tmp file handling in virt-edit.
This was probably not a security issue, but this change
makes the code cleaner by not opening the tmp file twice.

Also be more careful about error checking in close syscall.
2010-10-28 15:16:14 +01:00
Richard W.M. Jones
e3851914de virt-ls: Small fix to documentation. 2010-10-28 15:16:14 +01:00
Richard W.M. Jones
d600342b7d df: Add --uuid option to print guest UUIDs instead of names (RHBZ#646821). 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
504c3de9fe rescue: Add --network option.
This enables networking in the rescue shell.
2010-10-27 10:59:44 +01:00
Richard W.M. Jones
4b0e7f5c6a resize: Specify format of input, output disk (RHBZ#642934,CVE-2010-3851).
This adds two new options: --format specifies the format of the
input disk, and --output-format specified the format of the output
disk.

Requiring the format of the output disk seems a bit strange at first:
after all, this is the disk that the virt-resize user has to create.
However it is needed because we sometimes reopen this disk, after
copying data over the first sector, and in theory a raw-format guest
could write a qcow2 header here and have it copied to the output
disk, which we would subsequently reopen.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
38bc7c98df virt-make-fs: Specify format of disk (RHBZ#642934,CVE-2010-3851). 2010-10-22 17:45:06 +01:00
Richard W.M. Jones
1250d553f1 df: Specify format of disks (RHBZ#642934,CVE-2010-3851).
The format parameter is taken from libvirt if available, else
the user should supply the '--format' parameter (eg. for local
disk files).
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
641ccab6c3 tools: Specify format of disks (RHBZ#642934,CVE-2010-3851).
Sys::Guestfs::Lib is changed in two ways: firstly we take the format
string from libvirt and pass it to add_drive_opts.  Secondly we allow
an extra format =>  parameter to open_guest which allows the
format to be specified for disk images.

All the tools are changed to add an extra --format parameter allowing
the format to be specified for direct disk images.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
7d746ba691 virt-resize: Document guest boot stops at "GRUB" (RHBZ#640961). 2010-10-18 14:34:28 +01:00
Richard W.M. Jones
f7475ec577 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.
2010-10-18 14:18:58 +01:00
Richard W.M. Jones
4d88a74532 virt-resize: Document qcow2 output format (RHBZ#642826). 2010-10-18 13:35:06 +01:00
Richard W.M. Jones
94fa736b64 virt-resize: List truncate(1) in SEE ALSO section. 2010-10-18 13:33:02 +01:00
Richard W.M. Jones
a80177cc84 tools: Add section describing quoting libvirt domain names to docs (RHBZ#643624) 2010-10-18 13:18:20 +01:00
Richard W.M. Jones
887a79d1d1 test-virt-resize: Skip this test on 32 bit hosts. 2010-10-02 09:07:42 +01:00
Richard W.M. Jones
c6c030b64b Add test for virt-resize.
This tests a number of things which have caused problems for us:

 - resizing PVs and LV content
 - handling GPT format disks
 - using qcow2 as a target disk format
 - shrinking disk images

Note that the disk content is empty (not a real VM), but this is
adequate since all we want to test are the operations and calculations
done by virt-resize.  We are not interested here in whether e2fsprogs
and LVM actually works.
2010-09-27 18:28:34 +01:00
Richard W.M. Jones
0dc1f8e7ae resize: Fix handling of GPT and qcow2 (RHBZ#633766, RHBZ#633096).
Previously we copied the bootloader data directly from the
source disk image to the target disk image using host file
operations (before launching libguestfs).  This has two problems:
firstly it has no chance of working with qcow2, and secondly
it didn't behave properly with GPT.

This changes the code so that everything is done through
libguestfs.  Block device sizes are now calculated properly
for qcow2 (RHBZ#633096) because this is done using the libguestfs
blockdev_getsize64 call.  The partition table is still created
by parted, but to workaround a bug in parted this is done before
copying the bootloader.  Finally the bootloader copy is done
using the new APIs pread-device and pwrite-device.

Shrinking now works, at least for simple cases (RHBZ#633766).
2010-09-27 18:28:30 +01:00
Richard W.M. Jones
832864922a df: Add --one-per-guest option for using one appliance per guest. 2010-09-20 16:03:09 +01:00
Richard Jones
c9bc865a7a resize: Add progress bar to virt-resize.
With this commit you will see a plain progress bar during the
lengthy copy operations, similar to below:

Summary of changes:
/dev/sda1: partition will be left alone
/dev/sda2: partition will be resized from 7.5G to 9.5G
/dev/sda2: content will be expanded using the 'pvresize' method
Copying /dev/sda1 ...
[############################################################################]
Copying /dev/sda2 ...
[########################################------------------------------------]
2010-09-01 14:20:22 +01:00
Richard Jones
daead56fae rescue: Fix typo in comment. 2010-08-26 15:55:34 +01:00
Matthew Booth
c3194e4d37 Ignore launch() error in virt-rescue. (RHBZ#618556)
launch() expects guestfsd to start, which it never does in virt-rescue, so it
always returns an error about the appliance shutting down unexpectedly.
2010-08-26 15:53:25 +01:00
Richard Jones
45a4cd7921 df: Minimize the number of times we launch the libguestfs appliance.
This commit greatly improves the performance of the 'virt-df'
command by batching as many disks as possible onto a single appliance.
In many situations this means the appliance is launched only once,
versus one launch per domain as before.

However doing it this way is a lot more complex:

(1) Because of limits in Linux and virtio-blk, we can only attach
26 disks maximum at a time to the appliance.

(2) We have to use LVM filters (lvm-set-filter) to confine LVM to
the disks of a single guest.
2010-07-16 18:22:09 +01:00
Richard Jones
70d27f6e79 tar: Remove redundant use statement. 2010-07-11 23:11:45 +01:00
Richard Jones
10ea14a3f1 edit: Clean up temporary files.
Note to self: The 'tempfile' function does *not* default to
removing files with the program exits!
2010-07-11 23:11:08 +01:00
Richard Jones
fed8714b92 edit: Add -b (backup) option and make uploading more robust. 2010-07-11 23:09:07 +01:00