summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* launch: appliance is optionalOlaf Hering2012-10-091-8/+14
| | | | | | | | | | | | | | | | | # virt-filesystems -v -d 6326ad4e-5805-2ab4-1338-d1dad8c76162 --all libguestfs: libvirt version = 10002 libguestfs: [00000ms] connect to libvirt libguestfs: [00001ms] get libvirt capabilities libguestfs: [00234ms] build appliance libguestfs: [00234ms] create libvirt XML libguestfs: error: error constructing libvirt XML at "xmlTextWriterWriteAttribute (xo, BAD_CAST "file", BAD_CAST appliance)": No such file or directory libguestfs: closing guestfs handle 0x656270 (state 0) # ls -lh /usr/lib64/guestfs/* -rw-r--r-- 1 root root 13M Oct 8 16:15 /usr/lib64/guestfs/initramfs.x86_64.img -rw-r--r-- 1 root root 3.7M Oct 6 09:25 /usr/lib64/guestfs/vmlinuz.x86_64 Signed-off-by: Olaf Hering <olaf@aepfle.de>
* Add support for hotplugging (removing disks).Richard W.M. Jones2012-10-095-4/+98
| | | | | | | | New API: remove-drive. Note because of a bug in fuser, this only works with psmisc >= 22.20. This also updates the hotplugging tests.
* Add support for hotplugging (adding disks) to the libvirt attach-method.Richard W.M. Jones2012-10-085-20/+202
| | | | | | | | | | | | | When libvirt is used, we can allow disks to be hotplugged. guestfs_add_drive can be called after launch to hot-add a disk. When a disk is hot-added, we first ask libvirt to add the disk to the appliance, then we make an internal call into the appliance to get it to wait for the disk to appear (ie. udev_settle ()). Hot-added disks are tracked in the g->drives array. This also adds a test.
* launch: Add add_drive 'label' option.Richard W.M. Jones2012-10-086-7/+70
| | | | | | | | | | | | | | | | | | | | | New API: list-disk-labels Allow the user to pass an optional disk label when adding a drive. This is passed through to qemu / libvirt using the disk serial field, and from there to the appliance which exposes it through udev, creating a special alias of the device /dev/disk/guestfs/<label>. Partitions are named /dev/disk/guestfs/<label><partnum>. virtio-blk and virtio-scsi limit the serial field to 20 bytes. We further limit the name to maximum 20 ASCII characters in [a-zA-Z]. list-devices and list-partitions are not changed: these calls still return raw block device names. However a new call, list-disk-labels, returns a hash table allowing callers to map between disk labels, and block device and partition names. This commit also includes a test.
* launch: libvirt: Create qcow2 overlays for read-only drives and the appliance.Richard W.M. Jones2012-10-081-79/+219
| | | | | | | | | | | | | Instead of adding the snapshot=on option via <qemu:arg>, create qcow2 overlays for any read-only drives and the appliance using 'qemu-img create' + a temporary file. This is a workaround for missing support for <transient/> in libvirt's qemu driver. Also for the unpredictable way that libvirtd handles $TMPDIR: we want to control where the temporary disk is created. Currently it is also much slower, because qemu-img is slow. However we hope to fix qemu upstream.
* launch: Make g->drives into an array (was a linked list).Richard W.M. Jones2012-10-087-89/+113
| | | | Using an array simplifies the implementation of hotplugging.
* launch: Add private data pointer to the struct drive.Richard W.M. Jones2012-10-062-0/+6
| | | | This can be used by the attach-method, eg. for libvirt-only data.
* launch: add_null_drive: Force null drive to be writable.Richard W.M. Jones2012-10-061-0/+5
| | | | | Because we create a special file, there is no point forcing qemu to create an overlay as well. Save time by setting readonly = 0.
* launch: Rearrange code for adding drives to the g->drives list in the handle.Richard W.M. Jones2012-10-062-42/+62
| | | | This is just code motion.
* launch: libvirt: The drive 'iface' parameter is not yet supported.Richard W.M. Jones2012-10-031-0/+6
| | | | | We could add support, but at the moment return an error if the user tries to use the iface parameter.
* syntax: Use __PATTERNS__ instead of @PATTERNS@ in podwrapper man pages.Richard W.M. Jones2012-10-032-6/+6
| | | | | It is slightly dangerous to use @PATTERNS@, since these might be substituted by autoconf when they appear in Makefile.am files.
* inspection: Fix calls to case_sensitive_path (RHBZ#858126).Richard W.M. Jones2012-09-282-19/+29
| | | | | | | | | | | | | | | | | | | | | 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.
* run: Label tmp directory.Richard W.M. Jones2012-09-261-5/+0
| | | | | | | | | There's not really any point just documenting that people should label the tmp directory, when we can just label it. So change the ./run script so it calls chcon. However it's not a failure if chcon doesn't work. If SELinux is not installed or is disabled, then labelling will fail.
* docs: Link to guestfs-recipes(1) from intro in guestfs(3).Richard W.M. Jones2012-09-251-0/+2
|
* libvirt >= 0.10.2 required for libvirt backend.Richard W.M. Jones2012-09-241-1/+1
|
* NEW API:ext:mke2fsWanlong Gao2012-09-241-1/+1
| | | | | | | | | | | New api mke2fs for full configuration of filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Update description. - Run and fix the tests. - Remove bogus filename from po/POTFILES.
* launch: Handle guestfs_config qemu_value == NULL.Richard W.M. Jones2012-09-212-6/+8
| | | | | | | | | | | | | The second parameter to 'config' may be NULL. In commit 52fa23d74f6308daf804c2330b0b27e0b4412594 (refactoring of guestfs_config) the code this got lost, and guestfs_config would segfault if qemu_value was NULL. Also this fixes the libvirt method to handle the same case. I checked libguestfs-1.18 and -1.16 branches, and this problem does NOT affect them.
* Update SuSE Linux detection.Olaf Hering2012-09-215-4/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update SuSE Linux detection. Up to now everything with a /etc/SuSE-release file was treated as openSuSE. With this change SLES based distributions such as "SUSE Linux Enterprise Server", "SUSE Linux Enterprise Desktop" and "Novell Linux Desktop" will show up as "sles". The 'opensuse' detection was updated to handle older openSuSE releases as well as the well known SuSE Linux releases, starting from 6.0. Everything else with a /etc/SuSE-release file will show up as "suse-based". Here is a collection of release files: ==> Dist/6.0/etc/SuSE-release <== SuSE Linux 6.0 (i386) VERSION = 6.0 ==> Dist/6.1/etc/SuSE-release <== SuSE Linux 6.1 (i386) VERSION = 6.1 ==> Dist/6.2/etc/SuSE-release <== SuSE Linux 6.2 (i386) VERSION = 6.2 ==> Dist/6.3/etc/SuSE-release <== SuSE Linux 6.3 (i386) VERSION = 6.3 ==> Dist/6.4/etc/SuSE-release <== SuSE Linux 6.4 (i386) VERSION = 6.4 ==> Dist/7.0/etc/SuSE-release <== SuSE Linux 7.0 (i386) VERSION = 7.0 ==> Dist/7.1/etc/SuSE-release <== SuSE Linux 7.1 (i386) VERSION = 7.1 ==> Dist/7.2/etc/SuSE-release <== SuSE Linux 7.2 (i386) VERSION = 7.2 ==> Dist/7.3/etc/SuSE-release <== SuSE Linux 7.3 (i386) VERSION = 7.3 ==> Dist/8.0/etc/SuSE-release <== SuSE Linux 8.0 (i386) VERSION = 8.0 ==> Dist/8.1/etc/SuSE-release <== SuSE Linux 8.1 (i386) VERSION = 8.1 ==> Dist/8.2/etc/SuSE-release <== SuSE Linux 8.2 (x86-64) VERSION = 8.2 ==> Dist/9.0/etc/SuSE-release <== SuSE Linux 9.0 (x86-64) VERSION = 9.0 ==> Dist/9.1/etc/SuSE-release <== SuSE Linux 9.1 (x86-64) VERSION = 9.1 ==> Dist/9.2/etc/SuSE-release <== SuSE Linux 9.2 (x86-64) VERSION = 9.2 ==> Dist/9.3/etc/SuSE-release <== SuSE Linux 9.3 (x86-64) VERSION = 9.3 ==> Dist/10.0/etc/SuSE-release <== SUSE LINUX 10.0 (X86-64) OSS VERSION = 10.0 ==> Dist/10.1-remastered/etc/SuSE-release <== SUSE LINUX 10.1 (X86-64) VERSION = 10.1 ==> Dist/10.1/etc/SuSE-release <== SUSE Linux 10.1 (X86-64) Beta8 VERSION = 10.1 ==> Dist/10.2/etc/SuSE-release <== openSUSE 10.2 (X86-64) VERSION = 10.2 ==> Dist/10.3/etc/SuSE-release <== openSUSE 10.3 (X86-64) VERSION = 10.3 ==> Dist/11.0/etc/SuSE-release <== openSUSE 11.0 (X86-64) VERSION = 11.0 ==> Dist/11.1/etc/SuSE-release <== openSUSE 11.1 (x86_64) VERSION = 11.1 ==> Dist/11.2/etc/SuSE-release <== openSUSE 11.2 (x86_64) VERSION = 11.2 ==> Dist/11.3/etc/SuSE-release <== openSUSE 11.3 (x86_64) VERSION = 11.3 ==> Dist/11.4/etc/SuSE-release <== openSUSE 11.4 (x86_64) VERSION = 11.4 CODENAME = Celadon ==> Dist/12.1/etc/SuSE-release <== openSUSE 12.1 (x86_64) VERSION = 12.1 CODENAME = Asparagus ==> Dist/12.2/etc/SuSE-release <== openSUSE 12.2 (x86_64) VERSION = 12.2 CODENAME = Mantis ==> Dist/sles8/etc/SuSE-release <== SuSE SLES-8 (AMD64) VERSION = 8.1 ==> Dist/sles9/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 ==> Dist/sles9sp2/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 2 ==> Dist/sles9sp3/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 3 ==> Dist/sles9sp4/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 4 ==> Dist/sled10/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 ==> Dist/sled10sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sled10sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sled10sp3/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sled10sp4/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sled11/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sled11sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sled11sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 ==> Dist/sles10/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 ==> Dist/sles10sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sles10sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sles10sp3/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sles10sp4/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sles11/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sles11sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sles11sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 Signed-off-by: Olaf Hering <olaf@aepfle.de>
* rename local variable to avoid clash with match macroOlaf Hering2012-09-201-3/+3
| | | | | | match will expand to guestfs___match, rename the local variable to avoid clash. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* docs: Add links to various guestfs-* man pages from guestfs(3).Richard W.M. Jones2012-09-201-0/+5
|
* launch: Make the "launched failed" message more explanatory.Richard W.M. Jones2012-09-204-4/+21
| | | | | | | Since this is the most common error seen by people who have installation problems, buggy qemu, etc, and since no one reads the FAQ, describe in this error message what resources are available to debug launch problems.
* launch: libvirt: Pass TMPDIR to qemu subprocess.Richard W.M. Jones2012-09-171-0/+14
|
* New API: rm-f: remove a file, ignoring errors if it doesn't exist.Richard W.M. Jones2012-09-171-1/+1
|
* inspect: Fix segfault and error caused by earlier code cleanups.Richard W.M. Jones2012-09-172-2/+5
| | | | This fixes commit e128a627fb8f39f4f4c11b782cef895bd79f0282.
* launch: libvirt: Disable sVirt if using a custom qemu (ie. setting <emulator>).Richard W.M. Jones2012-09-171-4/+34
| | | | | | See: https://bugzilla.redhat.com/show_bug.cgi?id=857659 especially Dan's comment 4.
* Fix multiple errors where jump skips variable initialization.Richard W.M. Jones2012-09-178-30/+35
| | | | | | | <file>: error: jump skips variable initialization [-Werror=jump-misses-init] This has only just appeared, possibly related to previous gnulib update. In any case, this is just code motion / cleanup.
* syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim ↵Richard W.M. Jones2012-09-172-8/+0
| | | | | | | Meyering). The gnulib <fcntl.h> replacement header will now define this symbol if it's not defined already.
* syntax: Use STREQ/STRNEQ in place of strcmp.Richard W.M. Jones2012-09-151-1/+1
| | | | Found by 'make syntax-check'.
* syntax: Remove include <signal.h> in file that doesn't use it.Richard W.M. Jones2012-09-151-1/+0
| | | | Found by 'make syntax-check'.
* syntax: Remove PATH_MAX-sized buffers allocated on the stack.Richard W.M. Jones2012-09-151-2/+3
| | | | | | | | | | | | | | On Linux PATH_MAX is 4096, but on some platforms it can be much larger or even not defined (ie. unlimited). Therefore using a PATH_MAX-sized stack buffer is not a great idea for portable programs. This change removes use of PATH_MAX-sized stack-allocated buffers. This change only applies to the library and standalone programs. Inside the daemon, memory allocation is much more complicated so I have not changed those (yet). Found by 'make syntax-check'.
* syntax: Remove gnulib "ignore-value.h" in files that don't use it.Richard W.M. Jones2012-09-156-7/+0
| | | | Found by 'make syntax-check'.
* syntax: Remove gnulib c-ctype.h in files that don't use it.Richard W.M. Jones2012-09-154-4/+0
| | | | Found by 'make syntax-check'.
* syntax: Remove include <assert.h> where assert is not used.Richard W.M. Jones2012-09-151-1/+0
| | | | Found by 'make syntax-check'.
* lib: Rearrange headers.Richard W.M. Jones2012-09-152-10/+8
| | | | This is just code motion.
* lib: Remove unused headers <arpa/inet.h> and <netinet/in.h>Richard W.M. Jones2012-09-152-4/+0
| | | | | These were used back in the day when we used TCP for the communications channel with the guest.
* syntax: Remove HAVE_*_H tests which are always true.Richard W.M. Jones2012-09-153-42/+7
| | | | | Gnulib supplies replacements for these headers, so there is no need to test.
* lib: These optargs structures are not modified, hence const.Richard W.M. Jones2012-09-151-3/+3
|
* docs: Fix documentation of syntax-check target, add extra-tests.Richard W.M. Jones2012-09-151-2/+7
|
* launch: libvirt: Enable sVirt.Richard W.M. Jones2012-09-141-21/+0
|
* build: Create new 'tmp' directory for tests.Richard W.M. Jones2012-09-141-0/+12
| | | | | | | | | | | | Having a separate directory means: (1) It's easy to clean up orphaned temporary files, the appliance, etc. (2) You can put an SELinux label on this directory so that qemu can write to it when you're using sVirt and SELinux is enforcing: chcon --reference=/tmp tmp
* launch: libvirt: Mark appliance disk as <shareable/> (thanks Dan Berrange).Richard W.M. Jones2012-09-141-0/+3
| | | | | | | | | | | This is a fix for multiprogramming: If two instances of libguestfs share the same appliance disk, then libvirt would unlabel the disk when one of the instances closes the handle, resulting in the other qemu being unable to continue accessing the appliance. Adding the flag makes libvirt understand that the disk is shared so it doesn't do this, and it apparently handles locking correctly too if we were using sanlock.
* lib: guestfs_disk_format: Set LC_ALL=C instead of LANG=C.Richard W.M. Jones2012-09-121-1/+1
| | | | | | LC_ALL takes precedence over LANG. See: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html
* shutdown: Add 'check_for_errors' hint along the shutdown path.Richard W.M. Jones2012-09-046-10/+26
| | | | | | | | This hint tells the backend whether anyone cares about errors when the appliance is shut down. Currently this only has any effect on the libvirt backend, where it controls whether or not we use the VIR_DOMAIN_DESTROY_GRACEFUL flag.
* launch: libvirt: Add VIR_DOMAIN_DESTROY_GRACEFUL flag.Richard W.M. Jones2012-09-041-2/+1
| | | | | | We want libvirt to report failures when destroying the guest. See: https://bugzilla.redhat.com/show_bug.cgi?id=853369#c12
* proto: Don't set g->fd[] to /dev/null in direct mode, fixing virt-rescue ↵Richard W.M. Jones2012-09-041-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (RHBZ#853159). https://bugzilla.redhat.com/show_bug.cgi?id=853159 git bisect pointed to the following commit: commit ec8e3b6cad170d08ac18b580792dfb137eb171dc Author: Richard W.M. Jones <rjones@redhat.com> Date: Fri Jul 20 14:24:10 2012 +0100 launch: Abstract attach method operations. g->attach_ops points to a structure which contains the operations supported by each attach method backend (ie. appliance, unix, etc.). Since that commit was essentially just code motion, it wasn't clear why virt-rescue should be affected by it. In fact the reason is as follows: (1) In direct mode, we don't need g->fd[] (which would normally be connected to the stdin/stdout of qemu). So we opened them on /dev/null so they had some value. (2) accept_from_daemon / read_log_message_or_eof reads from g->fd[1]. Since this is connected to /dev/null, it always reads EOF. (3) This would cause child_cleanup to be called. This is completely unintentional: we don't want to cleanup the child at this point, even in direct mode. (4) Prior to the commit above, child_cleanup first waited for the process to exit (ie. waitpid). This happened to work, since we are effectively waiting for the user to exit virt-rescue. (5) After the commit above, the order of operations was changed so that we first killed qemu before waiting for it. This broke virt-rescue. The fix is to change direct mode so that it leaves g->fd[]'s as -1. The rest of the protocol code can deal with this situation -- it ignores the log fd instead of trying to read from it.
* launch: libvirt: Direct mode flag is not (yet) supported, so give an error ↵Richard W.M. Jones2012-09-041-0/+6
| | | | | | in this case. We definitely intend to support this in future.
* New APIs: disk-virtual-size and disk-has-backing-file.Richard W.M. Jones2012-09-041-0/+63
|
* lib: Reimplement qemu-img info parser for flexibility.Richard W.M. Jones2012-09-041-24/+52
| | | | | | | This allows other fields from the output of 'qemu-img info' to be parsed out. This updates commit 20902e7ce02fa375d5d336e6b984f615472ad1b1.
* Fix guestfs_disk_image API to work with relative paths.Richard W.M. Jones2012-09-041-1/+12
| | | | | | | | guestfs_disk_image makes a symbolic link to the real filename in order to sanitize the filename. However this fails if the filename is a relative path. Call realpath(3) to make the filename canonical. This fixes commit 20902e7ce02fa375d5d336e6b984f615472ad1b1.
* launch: libvirt: Use guestfs_disk_format API to autodetect input format.Richard W.M. Jones2012-09-031-85/+19
|