summaryrefslogtreecommitdiffstats
path: root/daemon/lvm.c
Commit message (Collapse)AuthorAgeFilesLines
* ubuntu: deactivate LVs and VGs before removing them.Richard W.M. Jones2010-12-071-0/+10
| | | | | | | | Even with the '-f' option, LVM on Ubuntu sometimes cannot remove active LVs and VGs. Change lvm-remove-all so it deactivates each LV and VG before removing them.
* daemon: Fix /dev/mapper paths from mounts and mountpoints (RHBZ#646432).Richard W.M. Jones2010-10-281-34/+32
| | | | Make the LV paths returned by these two commands canonical.
* New API: lvm-canonical-lv-name: make LV name canonical.Richard W.M. Jones2010-10-271-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When logical volume names appear in places like /etc/fstab files they can have the form "/dev/mapper/foo-bar". This function takes such names and makes them canonical. Note that this operation cannot be performed using the current API, because 'guestfs_stat' does not work on device names, and we don't really want to make a 'stat-device' call since that exposes too much non-useful detail about the appliance. With this patch you can do this: ><fs> debug ll /dev/mapper total 8 drwxrwxr-x 2 root root 4096 Oct 25 12:51 . drwxr-xr-x 16 root root 4096 Oct 25 12:51 .. crw------- 1 root root 10, 62 Oct 25 12:51 control lrwxrwxrwx 1 root root 7 Oct 25 12:51 vg_f13x64-lv_root -> ../dm-0 lrwxrwxrwx 1 root root 7 Oct 25 12:51 vg_f13x64-lv_swap -> ../dm-1 ><fs> lvm-canonical-lv-name /dev/mapper/vg_f13x64-lv_root /dev/vg_f13x64/lv_root ><fs> lvm-canonical-lv-name /dev/mapper/vg_f13x64-lv_swap /dev/vg_f13x64/lv_swap ><fs> lvm-canonical-lv-name /dev/mapper/foo libguestfs: error: lvm_canonical_lv_name: lvm_canonical_lv_name_stub: /dev/mapper/foo: No such file or directory ><fs> lvm-canonical-lv-name /dev/mapper/control libguestfs: error: lvm_canonical_lv_name: /dev/mapper/control: not a logical volume ><fs> lvm-canonical-lv-name /dev/vg_f13x64/lv_root /dev/vg_f13x64/lv_root
* New API: is-lv: check if a block device is a logical volume (RHBZ#619793)Richard Jones2010-07-301-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new API, guestfs_is_lv (g, device), which returns true iff the named device is an LVM2 logical volume. A sample guestfish session: ><fs> lvs /dev/vg_f13x64/lv_root /dev/vg_f13x64/lv_swap ><fs> list-devices /dev/vda ><fs> list-partitions /dev/vda1 /dev/vda2 ><fs> is-lv /dev/vg_f13x64/lv_root true ><fs> is-lv /dev/vg_f13x64/lv_swap true ><fs> is-lv /dev/vda false ><fs> is-lv /dev/vda1 false ><fs> is-lv /dev/vda2 false
* New API: pvresize-size to allow shrinking PVs (RHBZ#585222).Richard Jones2010-05-211-0/+24
|
* lvresize: Use --force so it can make LVs smaller (RHBZ#587484).Richard Jones2010-04-301-1/+1
| | | | This also adds a regression test for this bug.
* New API: lvresize-free to extend LVs into percentage of free space.Richard Jones2010-04-121-0/+26
|
* New API: vgscanRichard Jones2010-04-101-0/+18
| | | | | Implement vgscan to allow for a full rescan of all LVM PVs, VGs and LVs.
* appliance: Set $PATH instead of hard-coding paths to binaries everywhere.Richard Jones2010-03-261-21/+20
| | | | | | Change the appliance so PATH includes common directories. Thus we don't need to hard-code paths to binaries (eg. "/sbin/fdisk") everywhere.
* New APIs: Query the relationship between LVM objects.Richard Jones2010-03-181-0/+83
| | | | | | | | | These calls allow you to query the relationship between LVM objects, for example, which PVs contain a VG, or which LVs are contained in a VG. See the example / test program 'regressions/test-lvm-mapping.pl' for an example of how to do this from Perl.
* daemon: Don't need to prefix error messages with the command name.Richard Jones2010-02-121-4/+4
| | | | | | | | | | | | | | | | | | | | The RPC stubs already prefix the command name to error messages. The daemon doesn't have to do this. As a (small) benefit this also makes the daemon slightly smaller. Code in the daemon such as: if (argv[0] == NULL) { reply_with_error ("passed an empty list"); return NULL; } now results in error messages like this: ><fs> command "" libguestfs: error: command: passed an empty list (whereas previously you would have seen ..command: command:..)
* Implement 'vgrename' and 'lvrename' APIs.Richard Jones2010-01-281-0/+44
|
* availability: Add optional groups and implement guestfs_available call.Richard Jones2009-11-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current groups are defined very conservatively using the following criteria: (a) Would be impossible to implement on Windows because of sheer architectural differences (eg: mknod). (b) Already optional (augeas, inotify). (c) Not currently optional but not implemented on older RHEL and Debian releases (ntfs-3g.probe, scrub, zerofree). The optional groups I've defined according to these criteria are: . augeas . inotify . linuxfsuuid . linuxmodules . linuxxattrs . lvm2 . mknod . ntfs3g . scrub . selinux . zerofree (Note that these choices don't prevent us from adding more optional groups in future. On the other hand to avoid breaking ABIs we would not wish to change the above groups). The rest of this large commit is really just implementation: Each optional function is classified using Optional "group" flag in the generator. The daemon has to implement a function int optgroup_<name>_available (void); for each optional group. Some of these functions are fixed at compile time, and some do simple run-time tests. The do_available implementation in the daemon looks up the correct function in a table and runs it. We document the optional groups in the guestfs(3) man page. Also: I added a NOT_AVAILABLE macro in order to unify all the existing places where we had a message equivalent to "function __func__ is not available".
* Fix prototype of commandv to match prototype of commandrv.Richard Jones2009-11-091-2/+2
|
* avoid use of all ctype macrosJim Meyering2009-09-241-3/+3
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
* adjust const "**" pointers to avoid warningsJim Meyering2009-08-171-8/+4
| | | | | | Also, ... * src/generator.ml: Add DeviceList type, and propagate that change out to all calling/interface code.
* generator.ml: use new "Pathname" designationJim Meyering2009-08-131-11/+9
| | | | | | | | | | Nearly every file-related function in daemons/*.c is affected: Remove this pair of statements from each affected do_* function: - NEED_ROOT (return -1); - ABS_PATH (dir, return -1); and change the type of the corresponding parameter to "const char *". * src/generator.ml: Emit NEED_ROOT just once, even when there are two or more Pathname args.
* * src/generator.ml: Change all `String "device"' to `Device "device"'.Jim Meyering2009-08-131-8/+0
| | | | | | | | | | | | | | | | | | | | | Then update each affected function, removing each uses of RESOLVE_DEVICE, now that it's generated in caller from stub.c. * daemon/blockdev.c (call_blockdev): Remove use of RESOLVE_DEVICE. * daemon/devsparts.c (do_mkfs): Likewise. * daemon/ext2.c (do_e2fsck_f, do_get_e2label, do_get_e2uuid): Likewise. (do_resize2fs, do_set_e2label, do_set_e2uuid, do_tune2fs_l): Likewise. * daemon/fsck.c (do_fsck): Likewise. * daemon/grub.c (do_grub_install): Likewise. * daemon/lvm.c (do_lvremove, do_pvcreate, do_pvremove): Likewise. (do_pvresize): Likewise. * daemon/mount.c (do_mount_vfs): Likewise. * daemon/ntfs.c (do_ntfs_3g_probe): Likewise. * daemon/scrub.c (do_scrub_device): Likewise. * daemon/sfdisk.c (sfdisk, sfdisk_flag): Likewise. * daemon/swap.c (do_mkswap, do_mkswap_L, do_mkswap_U): Likewise. (do_swapoff_device, do_swapon_device): Likewise. * daemon/zero.c (do_zero): Likewise. * daemon/zerofree.c (do_zerofree): Likewise.
* change almost all uses: s/IS_DEVICE/RESOLVE_DEVICE/Jim Meyering2009-08-131-6/+6
| | | | | | Use this command: git grep -l -w IS_DEVICE|xargs perl -pi -e \ 's/\b(?:IS_DEVICE)\b( \(.*?,) (.*?)\)/RESOLVE_DEVICE$1 return $2)/'
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-14/+14
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Generate structs and struct lists generically.Richard Jones2009-07-071-3/+3
| | | | | | | | | | | This modifies the way that struct and struct lists are generated (for return values) so that there is no need to add an explicit new type when adding a new structure. All tests pass, and the C API should be compatible. I have also inspected the changes that are made to the generated code by hand.
* remove trailing blanksJim Meyering2009-07-031-1/+1
|
* Call 'udevadm settle' after operations which add/remove device nodes.Richard W.M. Jones2009-07-011-0/+23
| | | | | | | | | | | | | Because udev operates asynchronously, we found errors which were caused by a previous command (eg. sfdisk or pvremove) creating or removing a device, and that change not having happened by the time the next command was run. This patch adds calls to '/sbin/udevadm settle' after any commands which can add or remove device nodes. If udev is not being used or not available, this should have no effect. The command fails and this is silently ignored.
* In the daemon, change all const char * parameters to char *.Richard Jones2009-06-101-12/+12
|
* Add IS_DEVICE checks for all calls which take a device parameter.Richard Jones2009-06-101-0/+12
|
* Add: lvresize, resize2fs commands.Richard Jones2009-05-181-0/+24
|
* Add vg-activate{,-all} commands, and resize recipe.Richard Jones2009-05-181-0/+39
|
* Add: pvresize, sfdisk-N, sfdisk-l, sfdisk-kernel-geomtry, ↵Richard W.M. Jones2009-05-151-0/+18
| | | | sfdisk-disk-geometry commands. Pass --no-reread flag to sfdisk.
* Fix unchecked malloc (Jim Meyering).Richard Jones2009-04-301-0/+4
|
* Implement lvremove, vgremove, pvremove.Richard Jones2009-04-251-0/+54
|
* Added test suite.Richard Jones2009-04-111-0/+131
|
* Bug fix: Trailing whitespace from 'pvs' command.Richard Jones2009-04-081-0/+6
|
* Implement simple lvs/vgs/pvs commands.Richard Jones2009-04-071-0/+115
|
* Rename pvs -> pvs-full (etc), so we can add simple pvs (etc) commands.Richard Jones2009-04-071-3/+3
|
* pvs/vgs/lvs commands working now.Richard Jones2009-04-071-0/+50