| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Make the LV paths returned by these two commands canonical.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
This also adds a regression test for this bug.
|
| |
|
|
|
|
|
| |
Implement vgscan to allow for a full rescan of all LVM
PVs, VGs and LVs.
|
|
|
|
|
|
| |
Change the appliance so PATH includes common directories. Thus
we don't need to hard-code paths to binaries (eg. "/sbin/fdisk")
everywhere.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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:..)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
Also, ...
* src/generator.ml: Add DeviceList type, and propagate that change
out to all calling/interface code.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Use this command:
git grep -l -w IS_DEVICE|xargs perl -pi -e \
's/\b(?:IS_DEVICE)\b( \(.*?,) (.*?)\)/RESOLVE_DEVICE$1 return $2)/'
|
|
|
|
|
|
|
|
|
|
|
| |
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 : $_'
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
sfdisk-disk-geometry commands. Pass --no-reread flag to sfdisk.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|