├── .gitignore ├── COPYING ├── COPYING.LIB ├── INSTALL ├── Makefile.in ├── README ├── VERSION ├── VERSION_DM ├── WHATS_NEW ├── WHATS_NEW_DM ├── aclocal.m4 ├── autoconf ├── config.guess ├── config.sub └── install-sh ├── configure ├── configure.in ├── daemons ├── Makefile.in ├── clvmd │ ├── Makefile.in │ ├── clvm.h │ ├── clvmd-cman.c │ ├── clvmd-command.c │ ├── clvmd-common.h │ ├── clvmd-comms.h │ ├── clvmd-corosync.c │ ├── clvmd-openais.c │ ├── clvmd-singlenode.c │ ├── clvmd.c │ ├── clvmd.h │ ├── lvm-functions.c │ ├── lvm-functions.h │ ├── refresh_clvmd.c │ └── refresh_clvmd.h ├── cmirrord │ ├── Makefile.in │ ├── clogd.c │ ├── cluster.c │ ├── cluster.h │ ├── common.h │ ├── compat.c │ ├── compat.h │ ├── functions.c │ ├── functions.h │ ├── link_mon.c │ ├── link_mon.h │ ├── local.c │ ├── local.h │ ├── logging.c │ └── logging.h ├── dmeventd │ ├── .exported_symbols │ ├── Makefile.in │ ├── dmeventd.c │ ├── dmeventd.h │ ├── libdevmapper-event.c │ ├── libdevmapper-event.h │ ├── libdevmapper-event.pc.in │ └── plugins │ │ ├── Makefile.in │ │ ├── lvm2 │ │ ├── .exported_symbols │ │ ├── Makefile.in │ │ ├── dmeventd_lvm.c │ │ └── dmeventd_lvm.h │ │ ├── mirror │ │ ├── .exported_symbols │ │ ├── Makefile.in │ │ └── dmeventd_mirror.c │ │ ├── raid │ │ ├── .exported_symbols │ │ ├── Makefile.in │ │ └── dmeventd_raid.c │ │ ├── snapshot │ │ ├── .exported_symbols │ │ ├── Makefile.in │ │ └── dmeventd_snapshot.c │ │ └── thin │ │ ├── .exported_symbols │ │ ├── Makefile.in │ │ └── dmeventd_thin.c └── lvmetad │ ├── Makefile.in │ ├── lvmetad-client.h │ ├── lvmetad-core.c │ ├── test.sh │ └── testclient.c ├── doc ├── .gitignore ├── Makefile.in ├── example.conf.in ├── example_cmdlib.c ├── kernel │ ├── crypt.txt │ ├── delay.txt │ ├── flakey.txt │ ├── io.txt │ ├── kcopyd.txt │ ├── linear.txt │ ├── log.txt │ ├── persistent-data.txt │ ├── queue-length.txt │ ├── raid.txt │ ├── service-time.txt │ ├── snapshot.txt │ ├── striped.txt │ ├── thin-provisioning.txt │ ├── uevent.txt │ ├── verity.txt │ └── zero.txt ├── lvm2-raid.txt ├── lvm_fault_handling.txt ├── lvmetad_design.txt ├── pvmove_outline.txt ├── tagging.txt ├── testing.txt └── udev_assembly.txt ├── include ├── .gitignore ├── .symlinks.in └── Makefile.in ├── lib ├── Makefile.in ├── activate │ ├── activate.c │ ├── activate.h │ ├── dev_manager.c │ ├── dev_manager.h │ ├── fs.c │ ├── fs.h │ └── targets.h ├── cache │ ├── lvmcache.c │ ├── lvmcache.h │ ├── lvmetad.c │ └── lvmetad.h ├── commands │ ├── errors.h │ ├── toolcontext.c │ └── toolcontext.h ├── config │ ├── config.c │ ├── config.h │ └── defaults.h ├── datastruct │ ├── btree.c │ ├── btree.h │ ├── lvm-types.h │ ├── str_list.c │ └── str_list.h ├── device │ ├── dev-cache.c │ ├── dev-cache.h │ ├── dev-io.c │ ├── dev-luks.c │ ├── dev-md.c │ ├── dev-swap.c │ ├── device.c │ └── device.h ├── display │ ├── display.c │ └── display.h ├── error │ └── errseg.c ├── filters │ ├── device-types.h │ ├── filter-composite.c │ ├── filter-composite.h │ ├── filter-md.c │ ├── filter-md.h │ ├── filter-mpath.c │ ├── filter-mpath.h │ ├── filter-persistent.c │ ├── filter-persistent.h │ ├── filter-regex.c │ ├── filter-regex.h │ ├── filter-sysfs.c │ ├── filter-sysfs.h │ ├── filter.c │ └── filter.h ├── format1 │ ├── .exported_symbols │ ├── Makefile.in │ ├── disk-rep.c │ ├── disk-rep.h │ ├── format1.c │ ├── format1.h │ ├── import-export.c │ ├── import-extents.c │ ├── layout.c │ ├── lvm1-label.c │ ├── lvm1-label.h │ └── vg_number.c ├── format_pool │ ├── .exported_symbols │ ├── Makefile.in │ ├── disk_rep.c │ ├── disk_rep.h │ ├── format_pool.c │ ├── format_pool.h │ ├── import_export.c │ ├── pool_label.c │ ├── pool_label.h │ └── sptype_names.h ├── format_text │ ├── archive.c │ ├── archiver.c │ ├── archiver.h │ ├── export.c │ ├── flags.c │ ├── format-text.c │ ├── format-text.h │ ├── import-export.h │ ├── import.c │ ├── import_vsn1.c │ ├── layout.h │ ├── tags.c │ ├── text_export.h │ ├── text_import.h │ └── text_label.c ├── freeseg │ └── freeseg.c ├── label │ ├── label.c │ └── label.h ├── locking │ ├── .exported_symbols │ ├── Makefile.in │ ├── cluster_locking.c │ ├── external_locking.c │ ├── file_locking.c │ ├── locking.c │ ├── locking.h │ ├── locking_types.h │ └── no_locking.c ├── log │ ├── log.c │ ├── log.h │ └── lvm-logging.h ├── metadata │ ├── lv.c │ ├── lv.h │ ├── lv_alloc.h │ ├── lv_manip.c │ ├── merge.c │ ├── metadata-exported.h │ ├── metadata.c │ ├── metadata.h │ ├── mirror.c │ ├── pv.c │ ├── pv.h │ ├── pv_alloc.h │ ├── pv_manip.c │ ├── pv_map.c │ ├── pv_map.h │ ├── raid_manip.c │ ├── replicator_manip.c │ ├── segtype.c │ ├── segtype.h │ ├── snapshot_manip.c │ ├── thin_manip.c │ ├── vg.c │ └── vg.h ├── mirror │ ├── .exported_symbols │ ├── Makefile.in │ └── mirrored.c ├── misc │ ├── .gitignore │ ├── configure.h.in │ ├── crc.c │ ├── crc.h │ ├── crc_gen.c │ ├── intl.h │ ├── last-path-component.h │ ├── lib.h │ ├── lvm-exec.c │ ├── lvm-exec.h │ ├── lvm-file.c │ ├── lvm-file.h │ ├── lvm-globals.c │ ├── lvm-globals.h │ ├── lvm-percent.c │ ├── lvm-percent.h │ ├── lvm-string.c │ ├── lvm-string.h │ ├── lvm-version.h.in │ ├── lvm-wrappers.c │ ├── lvm-wrappers.h │ ├── sharedlib.c │ ├── sharedlib.h │ ├── timestamp.c │ ├── timestamp.h │ └── util.h ├── mm │ ├── memlock.c │ ├── memlock.h │ └── xlate.h ├── raid │ ├── .exported_symbols │ ├── Makefile.in │ └── raid.c ├── replicator │ ├── .exported_symbols │ ├── Makefile.in │ └── replicator.c ├── report │ ├── columns.h │ ├── properties.c │ ├── properties.h │ ├── report.c │ └── report.h ├── snapshot │ ├── .exported_symbols │ ├── Makefile.in │ └── snapshot.c ├── striped │ └── striped.c ├── thin │ ├── .exported_symbols │ ├── Makefile.in │ └── thin.c ├── unknown │ └── unknown.c ├── uuid │ ├── uuid.c │ └── uuid.h └── zero │ └── zero.c ├── libdaemon ├── Makefile.in ├── client │ ├── Makefile.in │ ├── config-util.c │ ├── config-util.h │ ├── daemon-client.c │ ├── daemon-client.h │ ├── daemon-io.c │ └── daemon-io.h └── server │ ├── Makefile.in │ ├── daemon-log.c │ ├── daemon-log.h │ ├── daemon-server.c │ └── daemon-server.h ├── libdm ├── .exported_symbols ├── Makefile.in ├── datastruct │ ├── bitset.c │ ├── hash.c │ └── list.c ├── ioctl │ ├── libdm-iface.c │ └── libdm-targets.h ├── libdevmapper.h ├── libdevmapper.pc.in ├── libdm-common.c ├── libdm-common.h ├── libdm-config.c ├── libdm-deptree.c ├── libdm-file.c ├── libdm-report.c ├── libdm-string.c ├── misc │ ├── dm-ioctl.h │ ├── dm-log-userspace.h │ ├── dm-logging.h │ ├── dmlib.h │ └── kdev_t.h ├── mm │ ├── dbg_malloc.c │ ├── pool-debug.c │ ├── pool-fast.c │ └── pool.c └── regex │ ├── matcher.c │ ├── parse_rx.c │ ├── parse_rx.h │ ├── ttree.c │ └── ttree.h ├── liblvm ├── .exported_symbols ├── Doxyfile ├── Makefile.in ├── liblvm2app.pc.in ├── lvm2app.h ├── lvm_base.c ├── lvm_lv.c ├── lvm_misc.c ├── lvm_misc.h ├── lvm_pv.c └── lvm_vg.c ├── make.tmpl.in ├── man ├── Makefile.in ├── blkdeactivate.8.in ├── clvmd.8.in ├── cmirrord.8.in ├── dmeventd.8.in ├── dmsetup.8.in ├── fsadm.8.in ├── lvchange.8.in ├── lvconvert.8.in ├── lvcreate.8.in ├── lvdisplay.8.in ├── lvextend.8.in ├── lvm.8.in ├── lvm.conf.5.in ├── lvmchange.8.in ├── lvmconf.8.in ├── lvmdiskscan.8.in ├── lvmdump.8.in ├── lvmetad.8.in ├── lvmsadc.8.in ├── lvmsar.8.in ├── lvreduce.8.in ├── lvremove.8.in ├── lvrename.8.in ├── lvresize.8.in ├── lvs.8.in ├── lvscan.8.in ├── pvchange.8.in ├── pvck.8.in ├── pvcreate.8.in ├── pvdisplay.8.in ├── pvmove.8.in ├── pvremove.8.in ├── pvresize.8.in ├── pvs.8.in ├── pvscan.8.in ├── vgcfgbackup.8.in ├── vgcfgrestore.8.in ├── vgchange.8.in ├── vgck.8.in ├── vgconvert.8.in ├── vgcreate.8.in ├── vgdisplay.8.in ├── vgexport.8.in ├── vgextend.8.in ├── vgimport.8.in ├── vgimportclone.8.in ├── vgmerge.8.in ├── vgmknodes.8.in ├── vgreduce.8.in ├── vgremove.8.in ├── vgrename.8.in ├── vgs.8.in ├── vgscan.8.in └── vgsplit.8.in ├── old-tests ├── config │ ├── .gitignore │ ├── Makefile │ ├── config_t.c │ ├── empty_array.conf │ └── vg0 ├── datastruct │ └── hash_t.c ├── dev-mgr │ └── dev_cache_t.c ├── device │ ├── Makefile.in │ ├── dev_cache_t.c │ ├── fill_device.c │ ├── random.c │ └── random.h ├── filters │ ├── Makefile.in │ ├── pfilter_t.c │ ├── rfilter_t.c │ └── sample.cfg ├── format1 │ ├── Makefile.in │ ├── get_pvs_t.c │ ├── get_vgs_t.c │ ├── pretty_print.c │ ├── pretty_print.h │ ├── read_pv_t.c │ ├── read_vg_t.c │ └── write_vg_t.c └── mm │ ├── Makefile.in │ └── dbg_malloc_t.c ├── po ├── Makefile.in ├── de.po ├── lvm2.po └── pogen.h ├── python ├── Makefile.in ├── example.py ├── liblvm.c └── setup.py.in ├── report-generators ├── lib │ ├── log.rb │ ├── report_templates.rb │ ├── reports.rb │ ├── schedule_file.rb │ └── string-store.rb ├── memcheck.rb ├── templates │ ├── boiler_plate.rhtml │ ├── index.rhtml │ ├── memcheck.rhtml │ ├── unit_detail.rhtml │ └── unit_test.rhtml ├── test │ ├── example.schedule │ ├── strings │ │ ├── more_strings │ │ │ └── test3.txt │ │ ├── test1.txt │ │ └── test2 │ ├── tc_log.rb │ ├── tc_schedule_file.rb │ ├── tc_string_store.rb │ └── ts.rb ├── title_page.rb └── unit_test.rb ├── reports └── stylesheet.css ├── scripts ├── .gitignore ├── Makefile.in ├── VolumeGroup.ocf ├── blk_availability_init_red_hat.in ├── blk_availability_systemd_red_hat.service.in ├── blkdeactivate.sh.in ├── clvmd_fix_conf.sh ├── clvmd_init_red_hat.in ├── cmirrord_init_red_hat.in ├── dm_event_systemd_red_hat.service.in ├── dm_event_systemd_red_hat.socket.in ├── fsadm.sh ├── gdbinit ├── lvm2_activation_generator_systemd_red_hat.c ├── lvm2_lvmetad_init_red_hat.in ├── lvm2_lvmetad_systemd_red_hat.service.in ├── lvm2_lvmetad_systemd_red_hat.socket.in ├── lvm2_monitoring_init_red_hat.in ├── lvm2_monitoring_init_rhel4 ├── lvm2_monitoring_systemd_red_hat.service.in ├── lvm2_tmpfiles_red_hat.conf.in ├── lvm2create_initrd │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── lvm2create_initrd │ ├── lvm2create_initrd.8 │ ├── lvm2create_initrd.pod │ └── lvm2udev ├── lvmconf.sh ├── lvmconf_lockingtype2.sh ├── lvmdump.sh ├── relpath.awk ├── vg_convert └── vgimportclone.sh ├── test ├── .gitignore ├── Makefile.in ├── api │ ├── Makefile.in │ ├── lvtest.c │ ├── lvtest.sh │ ├── pe_start.c │ ├── pe_start.sh │ ├── percent.c │ ├── percent.sh │ ├── test.c │ ├── thin_percent.c │ ├── thin_percent.sh │ ├── vgtest.c │ └── vgtest.sh ├── lib │ ├── aux.sh │ ├── check.sh │ ├── get.sh │ ├── harness.c │ ├── lvm-wrapper.sh │ ├── not.c │ ├── test.sh │ └── utils.sh ├── shell │ ├── 000-basic.sh │ ├── activate-minor.sh │ ├── activate-missing-segment.sh │ ├── activate-missing.sh │ ├── activate-partial.sh │ ├── clvmd-restart.sh │ ├── covercmd.sh │ ├── discards-thin.sh │ ├── dmeventd-restart.sh │ ├── dumpconfig.sh │ ├── fsadm.sh │ ├── inconsistent-metadata.sh │ ├── listings.sh │ ├── lock-blocking.sh │ ├── lvchange-mirror.sh │ ├── lvchange-partial.sh │ ├── lvconvert-mirror-basic-0.sh │ ├── lvconvert-mirror-basic-1.sh │ ├── lvconvert-mirror-basic-2.sh │ ├── lvconvert-mirror-basic-3.sh │ ├── lvconvert-mirror-basic.sh │ ├── lvconvert-mirror.sh │ ├── lvconvert-raid.sh │ ├── lvconvert-raid10.sh │ ├── lvconvert-repair-dmeventd.sh │ ├── lvconvert-repair-policy.sh │ ├── lvconvert-repair-replace.sh │ ├── lvconvert-repair-snapshot.sh │ ├── lvconvert-repair-transient-dmeventd.sh │ ├── lvconvert-repair-transient.sh │ ├── lvconvert-repair.sh │ ├── lvconvert-thin.sh │ ├── lvconvert-twostep.sh │ ├── lvcreate-large-raid.sh │ ├── lvcreate-large-raid10.sh │ ├── lvcreate-large.sh │ ├── lvcreate-mirror.sh │ ├── lvcreate-operation.sh │ ├── lvcreate-pvtags.sh │ ├── lvcreate-raid.sh │ ├── lvcreate-raid10.sh │ ├── lvcreate-repair.sh │ ├── lvcreate-small-snap.sh │ ├── lvcreate-striped-mirror.sh │ ├── lvcreate-thin-power2.sh │ ├── lvcreate-thin-snap.sh │ ├── lvcreate-thin.sh │ ├── lvcreate-usage.sh │ ├── lvextend-percent-extents.sh │ ├── lvextend-snapshot-dmeventd.sh │ ├── lvextend-snapshot-policy.sh │ ├── lvm-init.sh │ ├── lvmcache-exercise.sh │ ├── lvmetad-disabled.sh │ ├── lvmetad-dump.sh │ ├── lvmetad-lvm1.sh │ ├── lvmetad-pvs.sh │ ├── lvmetad-pvscan-cache.sh │ ├── lvmetad-restart.sh │ ├── lvmetad-test.sh │ ├── lvmetad-warning.sh │ ├── lvresize-mirror.sh │ ├── lvresize-raid.sh │ ├── lvresize-raid10.sh │ ├── lvresize-rounding.sh │ ├── lvresize-usage.sh │ ├── mdata-strings.sh │ ├── metadata-balance.sh │ ├── metadata-dirs.sh │ ├── metadata.sh │ ├── mirror-names.sh │ ├── mirror-vgreduce-removemissing.sh │ ├── name-mangling.sh │ ├── nomda-missing.sh │ ├── pool-labels.sh │ ├── pv-duplicate.sh │ ├── pv-min-size.sh │ ├── pv-range-overflow.sh │ ├── pvchange-usage.sh │ ├── pvcreate-metadata0.sh │ ├── pvcreate-operation-md.sh │ ├── pvcreate-operation.sh │ ├── pvcreate-usage.sh │ ├── pvmove-basic.sh │ ├── pvremove-usage.sh │ ├── read-ahead.sh │ ├── snapshot-autoumount-dmeventd.sh │ ├── snapshot-merge.sh │ ├── snapshots-of-mirrors.sh │ ├── tags.sh │ ├── test-partition.sh │ ├── thin-autoumount-dmeventd.sh │ ├── topology-support.sh │ ├── unknown-segment.sh │ ├── unlost-pv.sh │ ├── vgcfgbackup-usage.sh │ ├── vgchange-maxlv.sh │ ├── vgchange-partial.sh │ ├── vgchange-sysinit.sh │ ├── vgchange-usage.sh │ ├── vgcreate-usage.sh │ ├── vgextend-restoremissing.sh │ ├── vgextend-usage.sh │ ├── vgimportclone.sh │ ├── vgmerge-operation.sh │ ├── vgmerge-usage.sh │ ├── vgreduce-removemissing-snapshot.sh │ ├── vgreduce-usage.sh │ ├── vgrename-usage.sh │ ├── vgsplit-operation.sh │ ├── vgsplit-stacked.sh │ └── vgsplit-usage.sh └── unit │ ├── Makefile.in │ ├── bitset_t.c │ ├── config_t.c │ ├── matcher_data.h │ ├── matcher_t.c │ ├── run.c │ └── string_t.c ├── tools ├── .exported_symbols ├── .gitignore ├── Makefile.in ├── args.h ├── cmdnames.h ├── commands.h ├── dmsetup.c ├── dumpconfig.c ├── formats.c ├── lvchange.c ├── lvconvert.c ├── lvcreate.c ├── lvdisplay.c ├── lvextend.c ├── lvm-static.c ├── lvm.c ├── lvm2cmd-static.c ├── lvm2cmd.c ├── lvm2cmd.h ├── lvm2cmdline.h ├── lvmchange.c ├── lvmcmdlib.c ├── lvmcmdline.c ├── lvmdiskscan.c ├── lvreduce.c ├── lvremove.c ├── lvrename.c ├── lvresize.c ├── lvscan.c ├── polldaemon.c ├── polldaemon.h ├── pvchange.c ├── pvck.c ├── pvcreate.c ├── pvdisplay.c ├── pvmove.c ├── pvremove.c ├── pvresize.c ├── pvscan.c ├── reporter.c ├── segtypes.c ├── stub.h ├── toollib.c ├── toollib.h ├── tools.h ├── vgcfgbackup.c ├── vgcfgrestore.c ├── vgchange.c ├── vgck.c ├── vgconvert.c ├── vgcreate.c ├── vgdisplay.c ├── vgexport.c ├── vgextend.c ├── vgimport.c ├── vgmerge.c ├── vgmknodes.c ├── vgreduce.c ├── vgremove.c ├── vgrename.c ├── vgscan.c └── vgsplit.c ├── udev ├── 10-dm.rules.in ├── 11-dm-lvm.rules.in ├── 12-dm-permissions.rules ├── 13-dm-disk.rules.in ├── 69-dm-lvm-metad.rules.in ├── 95-dm-notify.rules.in └── Makefile.in └── unit-tests ├── datastruct ├── Makefile.in ├── TESTS └── bitset_t.c ├── mm ├── Makefile.in ├── TESTS ├── check_results └── pool_valgrind_t.c └── regex ├── Makefile.in ├── TESTS ├── dev_patterns ├── devices.list ├── matcher_t.c ├── matcher_t.expected ├── matcher_t.expected2 ├── matcher_t.expected3 ├── nonprint_input ├── nonprint_regexes ├── parse_t.c └── random_regexes /.gitignore: -------------------------------------------------------------------------------- 1 | *.5 2 | *.8 3 | *.a 4 | *.d 5 | *.o 6 | *.pc 7 | *.pot 8 | *.so 9 | *.so.* 10 | *.swp 11 | *~ 12 | 13 | .export.sym 14 | .exported_symbols_generated 15 | .gdb_history 16 | 17 | Makefile 18 | make.tmpl 19 | 20 | configure.h 21 | version.h 22 | 23 | /autom4te.cache/ 24 | /config.log 25 | /config.status 26 | /cscope.out 27 | /tmp/ 28 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | 1) Generate custom makefiles. 5 | 6 | Run the 'configure' script from the top directory. 7 | 8 | If you don't want to include the LVM1 backwards-compatibility code use: 9 | ./configure --with-lvm1=none 10 | 11 | To separate the LVM1 support into a shared library loaded by lvm.conf use: 12 | ./configure --with-lvm1=shared 13 | 14 | Use ./configure --help to see other options. 15 | 16 | 2) Build and install. 17 | 18 | Run 'make' from the top directory to build everything you configured. 19 | Run 'make install' to build and install everything you configured. 20 | 21 | If you only want the device-mapper libraries and tools use 22 | 'make device-mapper' or 'make install_device-mapper'. 23 | 24 | 3) If using LVM2, create a configuration file. 25 | 26 | The tools will work fine without a configuration file being 27 | present, but you ought to review the example file in doc/example.conf. 28 | 29 | Please also refer to the WHATS_NEW file and the manual pages for the 30 | individual commands. 31 | 32 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This tree contains the LVM2 and device-mapper tools and libraries. 2 | 3 | For more information about LVM2 read the changelog in the WHATS_NEW file. 4 | Installation instructions are in INSTALL. 5 | 6 | There is no warranty - see COPYING and COPYING.LIB. 7 | 8 | Tarballs are available from: 9 | ftp://sources.redhat.com/pub/lvm2/ 10 | 11 | The source code is stored in git: 12 | http://git.fedorahosted.org/git/lvm2.git 13 | git clone git://git.fedorahosted.org/git/lvm2.git 14 | 15 | Mailing list for general discussion related to LVM2: 16 | linux-lvm@redhat.com 17 | Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm 18 | 19 | Mailing lists for LVM2 development, patches and commits: 20 | lvm-devel@redhat.com 21 | Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm 22 | 23 | lvm2-commits@lists.fedorahosted.org (Read-only archive of commits) 24 | Subscribe from https://fedorahosted.org/mailman/listinfo/lvm2-commits 25 | 26 | Mailing list for device-mapper development, including kernel patches 27 | and multipath-tools: 28 | dm-devel@redhat.com 29 | Subscribe from https://www.redhat.com/mailman/listinfo/dm-devel 30 | 31 | The source code repository used until 7th June 2012 is accessible here: 32 | http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/?cvsroot=lvm2. 33 | 34 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.02.98(2)-git (2012-10-15) 2 | -------------------------------------------------------------------------------- /VERSION_DM: -------------------------------------------------------------------------------- 1 | 1.02.77-git (2012-10-15) 2 | -------------------------------------------------------------------------------- /daemons/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | ifeq ("@BUILD_LVMETAD@", "yes") 19 | SUBDIRS += lvmetad 20 | endif 21 | 22 | .PHONY: dmeventd clvmd cmirrord lvmetad 23 | 24 | ifneq ("@CLVMD@", "none") 25 | SUBDIRS += clvmd 26 | endif 27 | 28 | ifeq ("@BUILD_CMIRRORD@", "yes") 29 | SUBDIRS += cmirrord 30 | endif 31 | 32 | ifeq ("@BUILD_DMEVENTD@", "yes") 33 | SUBDIRS += dmeventd 34 | ifneq ("$(CFLOW_CMD)", "") 35 | daemons.cflow: dmeventd.cflow 36 | endif 37 | endif 38 | 39 | ifeq ($(MAKECMDGOALS),distclean) 40 | SUBDIRS = clvmd cmirrord dmeventd lvmetad 41 | endif 42 | 43 | include $(top_builddir)/make.tmpl 44 | 45 | ifeq ("@BUILD_DMEVENTD@", "yes") 46 | device-mapper: dmeventd.device-mapper 47 | endif 48 | -------------------------------------------------------------------------------- /daemons/clvmd/clvmd-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | /* 16 | * This file must be included first by every clvmd source file. 17 | */ 18 | #ifndef _LVM_CLVMD_COMMON_H 19 | #define _LVM_CLVMD_COMMON_H 20 | 21 | #include "configure.h" 22 | 23 | #define _GNU_SOURCE 24 | #define _FILE_OFFSET_BITS 64 25 | 26 | #include "libdevmapper.h" 27 | 28 | #include "lvm-logging.h" 29 | 30 | #include 31 | #include 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /daemons/clvmd/refresh_clvmd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU General Public License v.2. 9 | * 10 | * You should have received a copy of the GNU General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | 16 | int refresh_clvmd(int all_nodes); 17 | int restart_clvmd(int all_nodes); 18 | int debug_clvmd(int level, int clusterwide); 19 | 20 | -------------------------------------------------------------------------------- /daemons/cmirrord/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009-2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | CPG_LIBS = @CPG_LIBS@ 19 | CPG_CFLAGS = @CPG_CFLAGS@ 20 | SACKPT_LIBS = @SACKPT_LIBS@ 21 | SACKPT_CFLAGS = @SACKPT_CFLAGS@ 22 | 23 | SOURCES = clogd.c cluster.c compat.c functions.c link_mon.c local.c logging.c 24 | 25 | TARGETS = cmirrord 26 | 27 | include $(top_builddir)/make.tmpl 28 | 29 | LIBS += -ldevmapper 30 | LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS) 31 | CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) 32 | 33 | cmirrord: $(OBJECTS) $(top_builddir)/lib/liblvm-internal.a 34 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) \ 35 | $(LVMLIBS) $(LMLIBS) $(LIBS) 36 | 37 | install: $(TARGETS) 38 | $(INSTALL_PROGRAM) -D cmirrord $(usrsbindir)/cmirrord 39 | -------------------------------------------------------------------------------- /daemons/cmirrord/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. 3 | * 4 | * This copyrighted material is made available to anyone wishing to use, 5 | * modify, copy, or redistribute it subject to the terms and conditions 6 | * of the GNU Lesser General Public License v.2.1. 7 | * 8 | * You should have received a copy of the GNU Lesser General Public License 9 | * along with this program; if not, write to the Free Software Foundation, 10 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | */ 12 | #ifndef _LVM_CLOG_COMMON_H 13 | #define _LVM_CLOG_COMMON_H 14 | 15 | /* 16 | * If there are problems when forking off to become a daemon, 17 | * the child will exist with one of these codes. This allows 18 | * the parent to know the reason for the failure and print it 19 | * to the launching terminal. 20 | * 21 | * #define EXIT_SUCCESS 0 (from stdlib.h) 22 | * #define EXIT_FAILURE 1 (from stdlib.h) 23 | */ 24 | #define EXIT_LOCKFILE 2 25 | #define EXIT_KERNEL_SOCKET 3 /* Failed netlink socket create */ 26 | #define EXIT_KERNEL_BIND 4 27 | #define EXIT_KERNEL_SETSOCKOPT 5 28 | #define EXIT_CLUSTER_CKPT_INIT 6 /* Failed to init checkpoint */ 29 | #define EXIT_QUEUE_NOMEM 7 30 | 31 | #define DM_ULOG_REQUEST_SIZE 1024 32 | 33 | #endif /* _LVM_CLOG_COMMON_H */ 34 | -------------------------------------------------------------------------------- /daemons/cmirrord/compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This copyrighted material is made available to anyone wishing to use, 5 | * modify, copy, or redistribute it subject to the terms and conditions 6 | * of the GNU Lesser General Public License v.2.1. 7 | */ 8 | #ifndef _LVM_CLOG_COMPAT_H 9 | #define _LVM_CLOG_COMPAT_H 10 | 11 | /* 12 | * The intermachine communication structure version are: 13 | * 0: Unused 14 | * 1: Never in the wild 15 | * 2: RHEL 5.2 16 | * 3: RHEL 5.3 17 | * 4: RHEL 5.4, RHEL 5.5 18 | * 5: RHEL 6, Current Upstream Format 19 | */ 20 | #define CLOG_TFR_VERSION 5 21 | 22 | int clog_request_to_network(struct clog_request *rq); 23 | int clog_request_from_network(void *data, size_t data_len); 24 | 25 | #endif /* _LVM_CLOG_COMPAT_H */ 26 | -------------------------------------------------------------------------------- /daemons/cmirrord/functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. 3 | * 4 | * This copyrighted material is made available to anyone wishing to use, 5 | * modify, copy, or redistribute it subject to the terms and conditions 6 | * of the GNU Lesser General Public License v.2.1. 7 | * 8 | * You should have received a copy of the GNU Lesser General Public License 9 | * along with this program; if not, write to the Free Software Foundation, 10 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | */ 12 | #ifndef _LVM_CLOG_FUNCTIONS_H 13 | #define _LVM_CLOG_FUNCTIONS_H 14 | 15 | #include "dm-log-userspace.h" 16 | #include "cluster.h" 17 | 18 | #define LOG_RESUMED 1 19 | #define LOG_SUSPENDED 2 20 | 21 | int local_resume(struct dm_ulog_request *rq); 22 | int cluster_postsuspend(char *, uint64_t); 23 | 24 | int do_request(struct clog_request *rq, int server); 25 | int push_state(const char *uuid, uint64_t luid, 26 | const char *which, char **buf, uint32_t debug_who); 27 | int pull_state(const char *uuid, uint64_t luid, 28 | const char *which, char *buf, int size); 29 | 30 | int log_get_state(struct dm_ulog_request *rq); 31 | int log_status(void); 32 | void log_debug(void); 33 | 34 | #endif /* _LVM_CLOG_FUNCTIONS_H */ 35 | -------------------------------------------------------------------------------- /daemons/cmirrord/link_mon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. 3 | * 4 | * This copyrighted material is made available to anyone wishing to use, 5 | * modify, copy, or redistribute it subject to the terms and conditions 6 | * of the GNU Lesser General Public License v.2.1. 7 | * 8 | * You should have received a copy of the GNU Lesser General Public License 9 | * along with this program; if not, write to the Free Software Foundation, 10 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | */ 12 | #ifndef _LVM_CLOG_LINK_MON_H 13 | #define _LVM_CLOG_LINK_MON_H 14 | 15 | int links_register(int fd, const char *name, int (*callback)(void *data), void *data); 16 | int links_unregister(int fd); 17 | int links_monitor(void); 18 | int links_issue_callbacks(void); 19 | 20 | #endif /* _LVM_CLOG_LINK_MON_H */ 21 | -------------------------------------------------------------------------------- /daemons/cmirrord/local.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. 3 | * 4 | * This copyrighted material is made available to anyone wishing to use, 5 | * modify, copy, or redistribute it subject to the terms and conditions 6 | * of the GNU Lesser General Public License v.2.1. 7 | * 8 | * You should have received a copy of the GNU Lesser General Public License 9 | * along with this program; if not, write to the Free Software Foundation, 10 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | */ 12 | #ifndef _LVM_CLOG_LOCAL_H 13 | #define _LVM_CLOG_LOCAL_H 14 | 15 | int init_local(void); 16 | void cleanup_local(void); 17 | 18 | int kernel_send(struct dm_ulog_request *rq); 19 | 20 | #endif /* _LVM_CLOG_LOCAL_H */ 21 | -------------------------------------------------------------------------------- /daemons/dmeventd/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_fifos 2 | fini_fifos 3 | daemon_talk 4 | dm_event_get_version 5 | -------------------------------------------------------------------------------- /daemons/dmeventd/libdevmapper-event.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: devmapper-event 7 | Description: device-mapper event library 8 | Version: @DM_LIB_PATCHLEVEL@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -ldevmapper-event 11 | Requires.private: devmapper 12 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2005, 2011 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SUBDIRS += lvm2 20 | 21 | ifneq ("@MIRRORS@", "none") 22 | SUBDIRS += mirror 23 | endif 24 | 25 | ifneq ("@SNAPSHOTS@", "none") 26 | SUBDIRS += snapshot 27 | endif 28 | 29 | ifneq ("@RAID@", "none") 30 | SUBDIRS += raid 31 | endif 32 | 33 | ifneq ("@THIN@", "none") 34 | SUBDIRS += thin 35 | endif 36 | 37 | ifeq ($(MAKECMDGOALS),distclean) 38 | SUBDIRS = lvm2 mirror snapshot raid thin 39 | endif 40 | 41 | include $(top_builddir)/make.tmpl 42 | 43 | snapshot: lvm2 44 | mirror: lvm2 45 | raid: lvm2 46 | thin: lvm2 47 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/lvm2/.exported_symbols: -------------------------------------------------------------------------------- 1 | dmeventd_lvm2_init 2 | dmeventd_lvm2_exit 3 | dmeventd_lvm2_lock 4 | dmeventd_lvm2_unlock 5 | dmeventd_lvm2_pool 6 | dmeventd_lvm2_run 7 | dmeventd_lvm2_command 8 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/lvm2/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2010-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | CLDFLAGS += -L$(top_builddir)/tools 19 | 20 | SOURCES = dmeventd_lvm.c 21 | 22 | LIB_SHARED = libdevmapper-event-lvm2.$(LIB_SUFFIX) 23 | LIB_VERSION = $(LIB_VERSION_LVM) 24 | 25 | include $(top_builddir)/make.tmpl 26 | 27 | LIBS += @LVM2CMD_LIB@ -ldevmapper $(PTHREAD_LIBS) $(DAEMON_LIBS) 28 | 29 | install_lvm2: install_lib_shared 30 | 31 | install: install_lvm2 32 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/mirror/.exported_symbols: -------------------------------------------------------------------------------- 1 | process_event 2 | register_device 3 | unregister_device 4 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/mirror/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2005, 2008-2011 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2 20 | CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2 21 | 22 | SOURCES = dmeventd_mirror.c 23 | 24 | LIB_NAME = libdevmapper-event-lvm2mirror 25 | LIB_SHARED = $(LIB_NAME).$(LIB_SUFFIX) 26 | LIB_VERSION = $(LIB_VERSION_LVM) 27 | 28 | CFLOW_LIST = $(SOURCES) 29 | CFLOW_LIST_TARGET = $(LIB_NAME).cflow 30 | 31 | include $(top_builddir)/make.tmpl 32 | 33 | LIBS += -ldevmapper-event-lvm2 -ldevmapper $(DAEMON_LIBS) 34 | 35 | install_lvm2: install_dm_plugin 36 | 37 | install: install_lvm2 38 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/raid/.exported_symbols: -------------------------------------------------------------------------------- 1 | process_event 2 | register_device 3 | unregister_device 4 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/raid/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2 19 | CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2 20 | 21 | SOURCES = dmeventd_raid.c 22 | 23 | LIB_NAME = libdevmapper-event-lvm2raid 24 | LIB_SHARED = $(LIB_NAME).$(LIB_SUFFIX) 25 | LIB_VERSION = $(LIB_VERSION_LVM) 26 | 27 | CFLOW_LIST = $(SOURCES) 28 | CFLOW_LIST_TARGET = $(LIB_NAME).cflow 29 | 30 | include $(top_builddir)/make.tmpl 31 | 32 | LIBS += -ldevmapper-event-lvm2 -ldevmapper 33 | 34 | install_lvm2: install_dm_plugin 35 | 36 | install: install_lvm2 37 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/snapshot/.exported_symbols: -------------------------------------------------------------------------------- 1 | process_event 2 | register_device 3 | unregister_device 4 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/snapshot/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of the LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2 20 | CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2 21 | 22 | SOURCES = dmeventd_snapshot.c 23 | 24 | LIB_SHARED = libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX) 25 | LIB_VERSION = $(LIB_VERSION_LVM) 26 | 27 | include $(top_builddir)/make.tmpl 28 | 29 | LIBS += -ldevmapper-event-lvm2 -ldevmapper $(DAEMON_LIBS) 30 | 31 | install_lvm2: install_dm_plugin 32 | 33 | install: install_lvm2 34 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/thin/.exported_symbols: -------------------------------------------------------------------------------- 1 | process_event 2 | register_device 3 | unregister_device 4 | -------------------------------------------------------------------------------- /daemons/dmeventd/plugins/thin/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2 19 | CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2 20 | 21 | SOURCES = dmeventd_thin.c 22 | 23 | LIB_NAME = libdevmapper-event-lvm2thin 24 | LIB_SHARED = $(LIB_NAME).$(LIB_SUFFIX) 25 | LIB_VERSION = $(LIB_VERSION_LVM) 26 | 27 | CFLOW_LIST = $(SOURCES) 28 | CFLOW_LIST_TARGET = $(LIB_NAME).cflow 29 | 30 | include $(top_builddir)/make.tmpl 31 | 32 | LIBS += -ldevmapper-event-lvm2 -ldevmapper 33 | 34 | install_lvm2: install_dm_plugin 35 | 36 | install: install_lvm2 37 | -------------------------------------------------------------------------------- /daemons/lvmetad/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export LD_LIBRARY_PATH="$1" 4 | 5 | test -n "$2" && { 6 | rm -f /var/run/lvmetad.{socket,pid} 7 | chmod +rx lvmetad 8 | valgrind ./lvmetad -f & 9 | PID=$! 10 | sleep 1 11 | ./testclient 12 | kill $PID 13 | exit 0 14 | } 15 | 16 | sudo ./test.sh "$1" . 17 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | example.conf 2 | -------------------------------------------------------------------------------- /doc/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | CONFSRC=example.conf 19 | CONFDEST=lvm.conf 20 | 21 | include $(top_builddir)/make.tmpl 22 | 23 | install_lvm2: $(CONFSRC) 24 | @if [ ! -e $(confdir)/$(CONFDEST) ]; then \ 25 | echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \ 26 | $(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \ 27 | fi 28 | 29 | install: install_lvm2 30 | 31 | DISTCLEAN_TARGETS += $(CONFSRC) 32 | -------------------------------------------------------------------------------- /doc/example_cmdlib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU General Public License v.2. 9 | * 10 | * You should have received a copy of the GNU General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #include "lvm2cmd.h" 16 | #include 17 | 18 | /* All output gets passed to this function line-by-line */ 19 | void test_log_fn(int level, const char *file, int line, 20 | int dm_errno, const char *format) 21 | { 22 | /* Extract and process output here rather than printing it */ 23 | 24 | if (level != 4) 25 | return; 26 | 27 | printf("%s\n", format); 28 | return; 29 | } 30 | 31 | int main(int argc, char **argv) 32 | { 33 | void *handle; 34 | int r; 35 | 36 | lvm2_log_fn(test_log_fn); 37 | 38 | handle = lvm2_init(); 39 | 40 | lvm2_log_level(handle, 1); 41 | r = lvm2_run(handle, "vgs --noheadings vg1"); 42 | 43 | /* More commands here */ 44 | 45 | lvm2_exit(handle); 46 | 47 | return r; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /doc/kernel/delay.txt: -------------------------------------------------------------------------------- 1 | dm-delay 2 | ======== 3 | 4 | Device-Mapper's "delay" target delays reads and/or writes 5 | and maps them to different devices. 6 | 7 | Parameters: 8 | [ ] 9 | 10 | With separate write parameters, the first set is only used for reads. 11 | Delays are specified in milliseconds. 12 | 13 | Example scripts 14 | =============== 15 | [[ 16 | #!/bin/sh 17 | # Create device delaying rw operation for 500ms 18 | echo "0 `blockdev --getsize $1` delay $1 0 500" | dmsetup create delayed 19 | ]] 20 | 21 | [[ 22 | #!/bin/sh 23 | # Create device delaying only write operation for 500ms and 24 | # splitting reads and writes to different devices $1 $2 25 | echo "0 `blockdev --getsize $1` delay $1 0 0 $2 0 500" | dmsetup create delayed 26 | ]] 27 | -------------------------------------------------------------------------------- /doc/kernel/queue-length.txt: -------------------------------------------------------------------------------- 1 | dm-queue-length 2 | =============== 3 | 4 | dm-queue-length is a path selector module for device-mapper targets, 5 | which selects a path with the least number of in-flight I/Os. 6 | The path selector name is 'queue-length'. 7 | 8 | Table parameters for each path: [] 9 | : The number of I/Os to dispatch using the selected 10 | path before switching to the next path. 11 | If not given, internal default is used. To check 12 | the default value, see the activated table. 13 | 14 | Status for each path: 15 | : 'A' if the path is active, 'F' if the path is failed. 16 | : The number of path failures. 17 | : The number of in-flight I/Os on the path. 18 | 19 | 20 | Algorithm 21 | ========= 22 | 23 | dm-queue-length increments/decrements 'in-flight' when an I/O is 24 | dispatched/completed respectively. 25 | dm-queue-length selects a path with the minimum 'in-flight'. 26 | 27 | 28 | Examples 29 | ======== 30 | In case that 2 paths (sda and sdb) are used with repeat_count == 128. 31 | 32 | # echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \ 33 | dmsetup create test 34 | # 35 | # dmsetup table 36 | test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128 37 | # 38 | # dmsetup status 39 | test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0 40 | -------------------------------------------------------------------------------- /doc/testing.txt: -------------------------------------------------------------------------------- 1 | Here's how I test new LVM2 builds without interfering with the stable 2 | LVM2 that is running the LV's on my development box. 3 | 4 | 1) Create a set of loopback devices. 5 | 6 | 2) Create a new directory to contain the LVM2 configuration files for 7 | this setup. (I use /etc/lvm_loops) 8 | 9 | 3) Write a suitable lvm.conf file, this goes in the directory you just 10 | created. eg, my /etc/lvm_loops/lvm.conf looks like: 11 | 12 | log { 13 | file="/tmp/lvm2_loop.log" 14 | level=9 15 | verbose=0 16 | overwrite=1 17 | } 18 | 19 | devices { 20 | scan = "/dev" 21 | filter = ["a/loop/", "r/.*/"] 22 | } 23 | 24 | 25 | The important thing to note is the devices section which makes sure 26 | that only the loopback devices are considered for LVM2 operations. 27 | 28 | 4) When you want to use this test setup just set the environment 29 | variable LVM_SYSTEM_DIR to point to your config directory 30 | (/etc/lvm_loops in my case). 31 | 32 | 5) It's a good idea to do a vgscan to initialise the filters: 33 | 34 | export LVM_SYSTEM_DIR=/etc/lvm_loops 35 | ./lvm vgscan 36 | 37 | where ./lvm is the new build of LVM2 that I'm trying out. 38 | 39 | 7) Test away. Make sure that you are explicit about which lvm 40 | executable you want to execute (eg, ./lvm if you are in 41 | LVM2/tools). 42 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | .symlinks 2 | .symlinks_created 3 | 4 | *.h 5 | -------------------------------------------------------------------------------- /include/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | include $(top_builddir)/make.tmpl 20 | 21 | all: .symlinks_created 22 | 23 | .symlinks_created: .symlinks 24 | find . -maxdepth 1 -type l -exec $(RM) \{\} \; 25 | for i in `cat $<`; do $(LN_S) $$i ; done 26 | touch $@ 27 | 28 | pofile: all 29 | 30 | device-mapper: all 31 | 32 | cflow: all 33 | 34 | DISTCLEAN_TARGETS += $(shell find . -maxdepth 1 -type l) 35 | DISTCLEAN_TARGETS += .include_symlinks .symlinks_created .symlinks 36 | -------------------------------------------------------------------------------- /lib/activate/targets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_TARGETS_H 17 | #define _LVM_TARGETS_H 18 | 19 | struct dev_manager; 20 | struct lv_segment; 21 | 22 | int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg, 23 | char *params, size_t paramsize, int *pos, 24 | int start_area, int areas); 25 | 26 | int add_areas_line(struct dev_manager *dm, struct lv_segment *seg, 27 | struct dm_tree_node *node, uint32_t start_area, uint32_t areas); 28 | 29 | int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf, 30 | size_t bufsize, const char *desc); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lib/commands/errors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_ERRORS_H 17 | #define _LVM_ERRORS_H 18 | 19 | #define ECMD_PROCESSED 1 20 | #define ENO_SUCH_CMD 2 21 | #define EINVALID_CMD_LINE 3 22 | #define ECMD_FAILED 5 23 | 24 | /* FIXME Also returned by cmdlib. */ 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lib/datastruct/btree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_BTREE_H 17 | #define _LVM_BTREE_H 18 | 19 | struct btree; 20 | 21 | struct btree *btree_create(struct dm_pool *mem); 22 | 23 | void *btree_lookup(const struct btree *t, uint32_t k); 24 | int btree_insert(struct btree *t, uint32_t k, void *data); 25 | 26 | struct btree_iter; 27 | void *btree_get_data(const struct btree_iter *it); 28 | 29 | struct btree_iter *btree_first(const struct btree *t); 30 | struct btree_iter *btree_next(const struct btree_iter *it); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lib/datastruct/lvm-types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_TYPES_H 17 | #define _LVM_TYPES_H 18 | 19 | #include 20 | #include 21 | 22 | /* Define some portable printing types */ 23 | #define PRIsize_t "zu" 24 | #define PRIptrdiff_t "td" 25 | #define PRIpid_t PRId32 26 | 27 | struct str_list { 28 | struct dm_list list; 29 | const char *str; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lib/datastruct/str_list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_STR_LIST_H 17 | #define _LVM_STR_LIST_H 18 | 19 | struct dm_list *str_list_create(struct dm_pool *mem); 20 | int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str); 21 | void str_list_del(struct dm_list *sll, const char *str); 22 | int str_list_match_item(const struct dm_list *sll, const char *str); 23 | int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, const char **tag_matched); 24 | int str_list_lists_equal(const struct dm_list *sll, const struct dm_list *sll2); 25 | int str_list_dup(struct dm_pool *mem, struct dm_list *sllnew, 26 | const struct dm_list *sllold); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lib/device/dev-luks.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #include "lib.h" 16 | #include "metadata.h" 17 | 18 | #define LUKS_SIGNATURE "LUKS\xba\xbe" 19 | #define LUKS_SIGNATURE_SIZE 6 20 | 21 | int dev_is_luks(struct device *dev, uint64_t *signature) 22 | { 23 | char buf[LUKS_SIGNATURE_SIZE]; 24 | int ret = -1; 25 | 26 | if (!dev_open_readonly(dev)) { 27 | stack; 28 | return -1; 29 | } 30 | 31 | *signature = 0; 32 | 33 | if (!dev_read(dev, 0, LUKS_SIGNATURE_SIZE, buf)) 34 | goto_out; 35 | 36 | ret = memcmp(buf, LUKS_SIGNATURE, LUKS_SIGNATURE_SIZE) ? 0 : 1; 37 | 38 | out: 39 | if (!dev_close(dev)) 40 | stack; 41 | 42 | return ret; 43 | } 44 | -------------------------------------------------------------------------------- /lib/filters/filter-composite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_FILTER_COMPOSITE_H 17 | #define _LVM_FILTER_COMPOSITE_H 18 | 19 | #include "dev-cache.h" 20 | 21 | struct dev_filter *composite_filter_create(int n, struct dev_filter **filters); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/filters/filter-md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Luca Berra 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_FILTER_MD_H 16 | #define _LVM_FILTER_MD_H 17 | 18 | #include "dev-cache.h" 19 | 20 | struct dev_filter *md_filter_create(void); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /lib/filters/filter-mpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_FILTER_MPATH_H 16 | #define _LVM_FILTER_MPATH_H 17 | 18 | #include "dev-cache.h" 19 | 20 | struct dev_filter *mpath_filter_create(const char *sysfs_dir); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /lib/filters/filter-persistent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_FILTER_PERSISTENT_H 17 | #define _LVM_FILTER_PERSISTENT_H 18 | 19 | #include "dev-cache.h" 20 | 21 | struct dev_filter *persistent_filter_create(struct dev_filter *f, 22 | const char *file); 23 | 24 | int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out); 25 | int persistent_filter_dump(struct dev_filter *f, int merge_existing); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /lib/filters/filter-regex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_FILTER_REGEX_H 17 | #define _LVM_FILTER_REGEX_H 18 | 19 | #include "config.h" 20 | #include "dev-cache.h" 21 | 22 | /* 23 | * patterns must be an array of strings of the form: 24 | * [ra], eg, 25 | * r/cdrom/ - reject cdroms 26 | * a|loop/[0-4]| - accept loops 0 to 4 27 | * r|.*| - reject everything else 28 | */ 29 | 30 | struct dev_filter *regex_filter_create(const struct dm_config_value *patterns); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lib/filters/filter-sysfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_FILTER_SYSFS_H 16 | #define _LVM_FILTER_SYSFS_H 17 | 18 | #include "config.h" 19 | #include "dev-cache.h" 20 | 21 | struct dev_filter *sysfs_filter_create(const char *sysfs_dir); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/format1/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_format 2 | -------------------------------------------------------------------------------- /lib/format1/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES =\ 20 | disk-rep.c \ 21 | format1.c \ 22 | import-export.c \ 23 | import-extents.c \ 24 | layout.c \ 25 | lvm1-label.c \ 26 | vg_number.c 27 | 28 | LIB_SHARED = liblvm2format1.$(LIB_SUFFIX) 29 | LIB_VERSION = $(LIB_VERSION_LVM) 30 | 31 | include $(top_builddir)/make.tmpl 32 | 33 | install: install_lvm2_plugin 34 | -------------------------------------------------------------------------------- /lib/format1/format1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_FORMAT1_H 17 | #define _LVM_FORMAT1_H 18 | 19 | #include "metadata.h" 20 | #include "lvmcache.h" 21 | 22 | #define FMT_LVM1_NAME "lvm1" 23 | #define FMT_LVM1_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_LVM1_NAME) 24 | 25 | #ifdef LVM1_INTERNAL 26 | struct format_type *init_lvm1_format(struct cmd_context *cmd); 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /lib/format1/lvm1-label.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_LVM1_LABEL_H 17 | #define _LVM_LVM1_LABEL_H 18 | 19 | #include "metadata.h" 20 | 21 | struct labeller *lvm1_labeller_create(struct format_type *fmt); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/format_pool/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_format 2 | -------------------------------------------------------------------------------- /lib/format_pool/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES =\ 20 | disk_rep.c \ 21 | format_pool.c \ 22 | import_export.c \ 23 | pool_label.c 24 | 25 | LIB_SHARED = liblvm2formatpool.$(LIB_SUFFIX) 26 | LIB_VERSION = $(LIB_VERSION_LVM) 27 | 28 | include $(top_builddir)/make.tmpl 29 | 30 | install: install_lvm2_plugin 31 | -------------------------------------------------------------------------------- /lib/format_pool/format_pool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_FORMAT_POOL_H 17 | #define _LVM_FORMAT_POOL_H 18 | 19 | #include "metadata.h" 20 | 21 | #define FMT_POOL_NAME "pool" 22 | #define FMT_POOL_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_POOL_NAME) 23 | 24 | #ifdef POOL_INTERNAL 25 | struct format_type *init_pool_format(struct cmd_context *cmd); 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lib/format_pool/pool_label.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_POOL_LABEL_H 17 | #define _LVM_POOL_LABEL_H 18 | 19 | #include "metadata.h" 20 | 21 | struct labeller *pool_labeller_create(struct format_type *fmt); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/format_pool/sptype_names.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef SPTYPE_NAMES_H 17 | #define SPTYPE_NAMES_H 18 | 19 | /* This must be kept up to date with sistina/pool/module/pool_sptypes.h */ 20 | 21 | /* Generic Labels */ 22 | #define SPTYPE_DATA (0x00000000) 23 | 24 | /* GFS specific labels */ 25 | #define SPTYPE_GFS_DATA (0x68011670) 26 | #define SPTYPE_GFS_JOURNAL (0x69011670) 27 | 28 | struct sptype_name { 29 | const char *name; 30 | uint32_t label; 31 | }; 32 | 33 | static const struct sptype_name sptype_names[] = { 34 | {"data", SPTYPE_DATA}, 35 | 36 | {"gfs_data", SPTYPE_GFS_DATA}, 37 | {"gfs_journal", SPTYPE_GFS_JOURNAL}, 38 | 39 | {"", 0x0} /* This must be the last flag. */ 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /lib/format_text/text_import.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_TEXT_IMPORT_H 17 | #define _LVM_TEXT_IMPORT_H 18 | 19 | struct lv_segment; 20 | struct dm_config_node; 21 | 22 | int text_import_areas(struct lv_segment *seg, const struct dm_config_node *sn, 23 | const struct dm_config_value *cv, struct dm_hash_table *pv_hash, 24 | uint64_t status); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lib/locking/.exported_symbols: -------------------------------------------------------------------------------- 1 | locking_init 2 | locking_end 3 | lock_resource 4 | query_resource 5 | reset_locking 6 | -------------------------------------------------------------------------------- /lib/locking/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES = cluster_locking.c 20 | 21 | LIB_SHARED = liblvm2clusterlock.$(LIB_SUFFIX) 22 | LIB_VERSION = $(LIB_VERSION_LVM) 23 | 24 | include $(top_builddir)/make.tmpl 25 | 26 | install install_cluster: install_lvm2_plugin 27 | -------------------------------------------------------------------------------- /lib/metadata/segtype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "lib.h" 17 | #include "toolcontext.h" 18 | #include "segtype.h" 19 | 20 | struct segment_type *get_segtype_from_string(struct cmd_context *cmd, 21 | const char *str) 22 | { 23 | struct segment_type *segtype; 24 | 25 | dm_list_iterate_items(segtype, &cmd->segtypes) { 26 | if (!strcmp(segtype->name, str)) 27 | return segtype; 28 | } 29 | 30 | if (!(segtype = init_unknown_segtype(cmd, str))) 31 | return_NULL; 32 | 33 | segtype->library = NULL; 34 | dm_list_add(&cmd->segtypes, &segtype->list); 35 | log_warn("WARNING: Unrecognised segment type %s", str); 36 | return segtype; 37 | } 38 | -------------------------------------------------------------------------------- /lib/mirror/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_segtype 2 | -------------------------------------------------------------------------------- /lib/mirror/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES = mirrored.c 20 | 21 | LIB_SHARED = liblvm2mirror.$(LIB_SUFFIX) 22 | LIB_VERSION = $(LIB_VERSION_LVM) 23 | 24 | include $(top_builddir)/make.tmpl 25 | 26 | install: install_lvm2_plugin 27 | -------------------------------------------------------------------------------- /lib/misc/.gitignore: -------------------------------------------------------------------------------- 1 | lvm-version.h 2 | -------------------------------------------------------------------------------- /lib/misc/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_CRC_H 17 | #define _LVM_CRC_H 18 | 19 | #define INITIAL_CRC 0xf597a6cf 20 | 21 | uint32_t calc_crc(uint32_t initial, const uint8_t *buf, uint32_t size); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/misc/crc_gen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | /* 16 | * Helper program to generate table included in crc.c. 17 | */ 18 | #include "lib.h" 19 | 20 | int main(int argc, char **argv) 21 | { 22 | uint32_t crc, i, j; 23 | 24 | printf("\t/* CRC-32 byte lookup table generated by crc_gen.c */\n"); 25 | printf("\tstatic const uint32_t crctab[] = {"); 26 | 27 | for (i = 0; i < 256; i++) { 28 | crc = i; 29 | for (j = 0; j < 8; j++) { 30 | if (crc & 1) 31 | crc = 0xedb88320L ^ (crc >> 1); 32 | else 33 | crc = crc >> 1; 34 | } 35 | 36 | if (i % 8) 37 | printf(" "); 38 | else 39 | printf("\n\t\t"); 40 | 41 | printf("0x%08.8x,", crc); 42 | } 43 | 44 | printf("\n\t};\n"); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /lib/misc/intl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_INTL_H 17 | #define _LVM_INTL_H 18 | 19 | #ifdef INTL_PACKAGE 20 | # include 21 | # define _(String) dgettext(INTL_PACKAGE, (String)) 22 | #else 23 | # define _(String) (String) 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lib/misc/last-path-component.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | /* 16 | * Return the address of the last file name component of NAME. 17 | * If NAME ends in a slash, return the empty string. 18 | */ 19 | 20 | #include 21 | 22 | static inline const char *last_path_component(char const *name) 23 | { 24 | char const *slash = strrchr(name, '/'); 25 | 26 | return (slash) ? slash + 1 : name; 27 | } 28 | -------------------------------------------------------------------------------- /lib/misc/lib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | /* 17 | * This file must be included first by every library source file. 18 | */ 19 | #ifndef _LVM_LIB_H 20 | #define _LVM_LIB_H 21 | 22 | #include "configure.h" 23 | 24 | #define _REENTRANT 25 | #define _GNU_SOURCE 26 | #define _FILE_OFFSET_BITS 64 27 | 28 | #include "intl.h" 29 | #include "libdevmapper.h" 30 | #include "lvm-globals.h" 31 | #include "lvm-wrappers.h" 32 | #include "lvm-types.h" 33 | #include "util.h" 34 | 35 | #ifdef DM 36 | # include "dm-logging.h" 37 | #else 38 | # include "lvm-logging.h" 39 | #endif 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /lib/misc/lvm-exec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_EXEC_H 17 | #define _LVM_EXEC_H 18 | 19 | #include "lib.h" 20 | 21 | struct cmd_context; 22 | 23 | /** 24 | * Execute command with paramaters and return status 25 | * 26 | * \param rstatus 27 | * Returns command's exit status code. 28 | * 29 | * \param sync_needed 30 | * Bool specifying whether local devices needs to be synchronized 31 | * before executing command. 32 | * Note: You cannot synchronize devices within activation context. 33 | * 34 | * \return 35 | * 0 (success) or -1 (failure). 36 | */ 37 | int exec_cmd(struct cmd_context *cmd, const char *const argv[], 38 | int *rstatus, int sync_needed); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /lib/misc/lvm-percent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #include "lvm-percent.h" 16 | 17 | float percent_to_float(percent_t v) 18 | { 19 | return (float)v / PERCENT_1; 20 | } 21 | 22 | percent_t make_percent(uint64_t numerator, uint64_t denominator) 23 | { 24 | percent_t percent; 25 | if (!denominator) 26 | return PERCENT_100; /* FIXME? */ 27 | if (!numerator) 28 | return PERCENT_0; 29 | if (numerator == denominator) 30 | return PERCENT_100; 31 | switch (percent = PERCENT_100 * ((double) numerator / (double) denominator)) { 32 | case PERCENT_100: 33 | return PERCENT_100 - 1; 34 | case PERCENT_0: 35 | return PERCENT_0 + 1; 36 | default: 37 | return percent; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /lib/misc/lvm-string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_STRING_H 17 | #define _LVM_STRING_H 18 | 19 | #include 20 | #include 21 | 22 | #define NAME_LEN 128 23 | #define UUID_PREFIX "LVM-" 24 | 25 | struct pool; 26 | 27 | int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...) 28 | __attribute__ ((format(printf, 3, 4))); 29 | 30 | char *build_dm_uuid(struct dm_pool *mem, const char *lvid, 31 | const char *layer); 32 | 33 | int validate_name(const char *n); 34 | int validate_tag(const char *n); 35 | 36 | int apply_lvname_restrictions(const char *name); 37 | int is_reserved_lvname(const char *name); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /lib/misc/lvm-version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_VERSION_H 17 | /** 18 | * The LVM version number 19 | * 20 | * LVM_MAJOR.LVM_MINOR.LVM_PATCHLEVEL(LVM_LIBAPI)[-LVM_RELEASE] 21 | */ 22 | 23 | #define LVM_VERSION @LVM_VERSION@ 24 | #define LVM_MAJOR @LVM_MAJOR@ 25 | #define LVM_MINOR @LVM_MINOR@ 26 | #define LVM_PATCHLEVEL @LVM_PATCHLEVEL@ 27 | #define LVM_LIBAPI @LVM_LIBAPI@ 28 | #define LVM_RELEASE @LVM_RELEASE@ 29 | #define LVM_RELEASE_DATE @LVM_RELEASE_DATE@ 30 | #endif 31 | -------------------------------------------------------------------------------- /lib/misc/sharedlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_SHAREDLIB_H 17 | #define _LVM_SHAREDLIB_H 18 | 19 | #include "config.h" 20 | #include 21 | 22 | void get_shared_library_path(struct cmd_context *cmd, const char *libname, 23 | char *path, size_t path_len); 24 | void *load_shared_library(struct cmd_context *cmd, const char *libname, 25 | const char *what, int silent); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /lib/misc/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Rackable Systems All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_TIMESTAMP_H 16 | #define _LVM_TIMESTAMP_H 17 | 18 | struct timestamp; 19 | 20 | struct timestamp *get_timestamp(void); 21 | 22 | /* cmp_timestamp: Compare two timestamps 23 | * 24 | * Return: -1 if t1 is less than t2 25 | * 0 if t1 is equal to t2 26 | * 1 if t1 is greater than t2 27 | */ 28 | int cmp_timestamp(struct timestamp *t1, struct timestamp *t2); 29 | 30 | void destroy_timestamp(struct timestamp *t); 31 | 32 | #endif /* _LVM_TIMESTAMP_H */ 33 | 34 | -------------------------------------------------------------------------------- /lib/misc/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_UTIL_H 16 | #define _LVM_UTIL_H 17 | 18 | #define min(a, b) ({ typeof(a) _a = (a); \ 19 | typeof(b) _b = (b); \ 20 | (void) (&_a == &_b); \ 21 | _a < _b ? _a : _b; }) 22 | 23 | #define max(a, b) ({ typeof(a) _a = (a); \ 24 | typeof(b) _b = (b); \ 25 | (void) (&_a == &_b); \ 26 | _a > _b ? _a : _b; }) 27 | 28 | #if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) 29 | #define uninitialized_var(x) x 30 | #else 31 | #define uninitialized_var(x) x = x 32 | #endif 33 | 34 | #define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release)) 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /lib/raid/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_multiple_segtypes 2 | -------------------------------------------------------------------------------- /lib/raid/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES = raid.c 20 | 21 | LIB_SHARED = liblvm2raid.$(LIB_SUFFIX) 22 | LIB_VERSION = $(LIB_VERSION_LVM) 23 | 24 | include $(top_builddir)/make.tmpl 25 | 26 | install: install_lvm2_plugin 27 | -------------------------------------------------------------------------------- /lib/replicator/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_segtype 2 | -------------------------------------------------------------------------------- /lib/replicator/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009-2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | SOURCES = replicator.c 19 | 20 | LIB_SHARED = liblvm2replicator.$(LIB_SUFFIX) 21 | LIB_VERSION = $(LIB_VERSION_LVM) 22 | 23 | include $(top_builddir)/make.tmpl 24 | 25 | install: install_lib_shared_plugin 26 | -------------------------------------------------------------------------------- /lib/snapshot/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_segtype 2 | -------------------------------------------------------------------------------- /lib/snapshot/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES = snapshot.c 20 | 21 | LIB_SHARED = liblvm2snapshot.$(LIB_SUFFIX) 22 | LIB_VERSION = $(LIB_VERSION_LVM) 23 | 24 | include $(top_builddir)/make.tmpl 25 | 26 | install: install_lvm2_plugin 27 | -------------------------------------------------------------------------------- /lib/thin/.exported_symbols: -------------------------------------------------------------------------------- 1 | init_segtype 2 | -------------------------------------------------------------------------------- /lib/thin/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | SOURCES = thin.c 19 | 20 | LIB_SHARED = liblvm2thin.$(LIB_SUFFIX) 21 | LIB_VERSION = $(LIB_VERSION_LVM) 22 | 23 | include $(top_builddir)/make.tmpl 24 | 25 | install: install_lib_shared_plugin 26 | -------------------------------------------------------------------------------- /libdaemon/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | .PHONY: client server 19 | 20 | SUBDIRS += client 21 | 22 | ifeq ("@BUILD_LVMETAD@", "yes") 23 | SUBDIRS += server 24 | server: client 25 | endif 26 | 27 | ifeq ($(MAKECMDGOALS),distclean) 28 | SUBDIRS = client server 29 | endif 30 | 31 | include $(top_builddir)/make.tmpl 32 | -------------------------------------------------------------------------------- /libdaemon/client/Makefile.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 2 | # 3 | # This file is part of the device-mapper userspace tools. 4 | # 5 | # This copyrighted material is made available to anyone wishing to use, 6 | # modify, copy, or redistribute it subject to the terms and conditions 7 | # of the GNU Lesser General Public License v.2.1. 8 | # 9 | # You should have received a copy of the GNU Lesser General Public License 10 | # along with this program; if not, write to the Free Software Foundation, 11 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 | 13 | srcdir = @srcdir@ 14 | top_srcdir = @top_srcdir@ 15 | top_builddir = @top_builddir@ 16 | 17 | LIB_STATIC = libdaemonclient.a 18 | SOURCES = daemon-io.c config-util.c daemon-client.c 19 | 20 | include $(top_builddir)/make.tmpl 21 | -------------------------------------------------------------------------------- /libdaemon/client/daemon-io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2012 Red Hat, Inc. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LVM_DAEMON_IO_H 16 | #define _LVM_DAEMON_IO_H 17 | 18 | #include "configure.h" 19 | #include "config-util.h" 20 | #include "libdevmapper.h" 21 | 22 | #define _REENTRANT 23 | #define _GNU_SOURCE 24 | #define _FILE_OFFSET_BITS 64 25 | 26 | /* TODO function names */ 27 | 28 | int buffer_read(int fd, struct buffer *buffer); 29 | int buffer_write(int fd, struct buffer *buffer); 30 | 31 | #endif /* _LVM_DAEMON_SHARED_H */ 32 | -------------------------------------------------------------------------------- /libdaemon/server/Makefile.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 2 | # 3 | # This file is part of the device-mapper userspace tools. 4 | # 5 | # This copyrighted material is made available to anyone wishing to use, 6 | # modify, copy, or redistribute it subject to the terms and conditions 7 | # of the GNU Lesser General Public License v.2.1. 8 | # 9 | # You should have received a copy of the GNU Lesser General Public License 10 | # along with this program; if not, write to the Free Software Foundation, 11 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 | 13 | srcdir = @srcdir@ 14 | top_srcdir = @top_srcdir@ 15 | top_builddir = @top_builddir@ 16 | 17 | LIB_STATIC = libdaemonserver.a 18 | SOURCES = daemon-server.c daemon-log.c 19 | 20 | include $(top_builddir)/make.tmpl 21 | 22 | LIBS += $(DAEMON_LIBS) 23 | -------------------------------------------------------------------------------- /libdm/.exported_symbols: -------------------------------------------------------------------------------- 1 | dm_log 2 | dm_log_with_errno 3 | -------------------------------------------------------------------------------- /libdm/libdevmapper.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: devmapper 7 | Description: device-mapper library 8 | Version: @DM_LIB_PATCHLEVEL@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -ldevmapper 11 | Requires.private: @SELINUX_PC@ @UDEV_PC@ 12 | -------------------------------------------------------------------------------- /libdm/misc/dm-logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _DM_LOGGING_H 17 | #define _DM_LOGGING_H 18 | 19 | #include "libdevmapper.h" 20 | 21 | extern dm_log_fn dm_log; 22 | extern dm_log_with_errno_fn dm_log_with_errno; 23 | 24 | #define LOG_MESG(l, f, ln, e, x...) \ 25 | do { \ 26 | if (dm_log_is_non_default()) \ 27 | dm_log(l, f, ln, ## x); \ 28 | else \ 29 | dm_log_with_errno(l, f, ln, e, ## x); \ 30 | } while (0) 31 | 32 | #define LOG_LINE(l, x...) LOG_MESG(l, __FILE__, __LINE__, 0, ## x) 33 | #define LOG_LINE_WITH_ERRNO(l, e, x...) LOG_MESG(l, __FILE__, __LINE__, e, ## x) 34 | 35 | #include "log.h" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libdm/misc/dmlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | /* 17 | * This file must be included first by every device-mapper library source file. 18 | */ 19 | #ifndef _DM_LIB_H 20 | #define _DM_LIB_H 21 | 22 | #define DM 23 | 24 | #include "lib.h" 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /libdm/misc/kdev_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #ifndef _LIBDM_KDEV_H 16 | #define _LIBDM_KDEV_H 17 | 18 | #define MAJOR(dev) ((dev & 0xfff00) >> 8) 19 | #define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00)) 20 | #define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12)) 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libdm/regex/ttree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of the device-mapper userspace tools. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _DM_TTREE_H 17 | #define _DM_TTREE_H 18 | 19 | struct ttree; 20 | 21 | struct ttree *ttree_create(struct dm_pool *mem, unsigned int klen); 22 | 23 | void *ttree_lookup(struct ttree *tt, unsigned *key); 24 | int ttree_insert(struct ttree *tt, unsigned *key, void *data); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /liblvm/.exported_symbols: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steven676/lvm2/ea6a8078b41df75344aecff4c54aab9c78b67193/liblvm/.exported_symbols -------------------------------------------------------------------------------- /liblvm/liblvm2app.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: lvm2app 7 | Description: lvm2 application library 8 | Version: @LVM_MAJOR@.@LVM_LIBAPI@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -llvm2app 11 | Requires.private: devmapper 12 | -------------------------------------------------------------------------------- /liblvm/lvm_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008,2010 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | #ifndef _LVM2APP_MISC_H 15 | #define _LVM2APP_MISC_H 16 | 17 | #include "libdevmapper.h" 18 | #include "lvm2app.h" 19 | 20 | struct dm_list *tag_list_copy(struct dm_pool *p, struct dm_list *tag_list); 21 | struct lvm_property_value get_property(const pv_t pv, const vg_t vg, 22 | const lv_t lv, const lvseg_t lvseg, 23 | const pvseg_t pvseg, const char *name); 24 | int set_property(const pv_t pv, const vg_t vg, const lv_t lv, 25 | const char *name, struct lvm_property_value *value); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /man/cmirrord.8.in: -------------------------------------------------------------------------------- 1 | .TH CMIRRORD 8 "LVM TOOLS #VERSION#" "Red Hat Inc" \" -*- nroff -*- 2 | .SH NAME 3 | cmirrord \- cluster mirror log daemon 4 | 5 | .SH SYNOPSIS 6 | .B cmirrord 7 | 8 | .SH DESCRIPTION 9 | cmirrord is the daemon that tracks mirror log information in a cluster. 10 | It is specific to device-mapper based mirrors (and by extension, LVM 11 | cluster mirrors). Cluster mirrors are not possible without this daemon 12 | running. 13 | 14 | This daemon relies on the cluster infrastructure provided by the 15 | Cluster MANager (CMAN), which must be set up and running in order for 16 | cmirrord to function. (The cluster infrastructure is also required for 17 | clvmd.) 18 | 19 | Output is logged via syslog. The USR1 signal can be issued to cmirrord 20 | to gather current status information for debugging purposes. 21 | 22 | Once started, cmirrord will run until it is shutdown via INT signal. If 23 | there are still active cluster mirrors, however, the signal will be 24 | ignored. Active cluster mirrors should be shutdown before stopping the 25 | cluster mirror log daemon. 26 | 27 | .SH SEE ALSO 28 | .BR lvm (8) 29 | .BR clvmd (8) 30 | .BR cluster.conf (5) -------------------------------------------------------------------------------- /man/lvmchange.8.in: -------------------------------------------------------------------------------- 1 | .TH LVMCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | lvmchange \- change attributes of the logical volume manager 4 | .SH SYNOPSIS 5 | .B lvmchange 6 | .SH DESCRIPTION 7 | lvmchange is not currently supported under LVM2, although 8 | \fBdmsetup\fP(8) has a \fBremove_all\fP command. 9 | .SH SEE ALSO 10 | .BR dmsetup (8) 11 | -------------------------------------------------------------------------------- /man/lvmconf.8.in: -------------------------------------------------------------------------------- 1 | .TH "LVMCONF" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\"" 2 | 3 | .SH "NAME" 4 | .B lvmconf 5 | \- LVM configuration modifier 6 | 7 | .SH "SYNOPSIS" 8 | .B lvmconf 9 | .RB [ \-\-disable-cluster ] 10 | .RB [ \-\-enable-cluster ] 11 | .RB [ \-\-file 12 | .RI < configfile >] 13 | .RB [ \-\-lockinglib 14 | .RI < lib >] 15 | .RB [ \-\-lockinglibdir 16 | .RI < dir >] 17 | 18 | .SH "DESCRIPTION" 19 | lvmconf is a script that modifies the locking configuration in 20 | an lvm configuration file. See \fBlvm.conf\fP(5). 21 | 22 | .SH "OPTIONS" 23 | .TP 24 | .BR \-\-disable-cluster 25 | Set \fBlocking_type\fR to the default non-clustered type. 26 | .TP 27 | .BR \-\-enable-cluster 28 | Set \fBlocking_type\fR to the default clustered type on this system. 29 | .TP 30 | .BR \-\-file " <" \fIconfigfile > 31 | Apply the changes to \fIconfigfile\fP instead of the default 32 | \fI#DEFAULT_SYS_DIR#/lvm.conf\fP. 33 | .TP 34 | .BR \-\-lockinglib " <" \fIlib > 35 | Set external \fBlocking_library\fR locking library to load if an external locking type is used. 36 | .TP 37 | .BR \-\-lockinglibdir " <" \fIdir > 38 | .SH FILES 39 | .I #DEFAULT_SYS_DIR#/lvm.conf 40 | 41 | .SH "SEE ALSO" 42 | .BR lvm (8), 43 | .BR lvm.conf (5) 44 | -------------------------------------------------------------------------------- /man/lvmdiskscan.8.in: -------------------------------------------------------------------------------- 1 | .TH LVMDISKSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | lvmdiskscan \- scan for all devices visible to LVM2 4 | .SH SYNOPSIS 5 | .B lvmdiskscan 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-? | \-\-help ] 8 | .RB [ \-l | \-\-lvmpartition ] 9 | .RB [ \-v | \-\-verbose ] 10 | .SH DESCRIPTION 11 | lvmdiskscan scans all SCSI, (E)IDE disks, multiple devices and a bunch 12 | of other block devices in the system looking for LVM physical volumes. 13 | The size reported is the real device size. 14 | Define a filter in \fBlvm.conf\fP(5) to restrict 15 | the scan to avoid a CD ROM, for example. 16 | .SH OPTIONS 17 | See \fBlvm\fP(8) for common options. 18 | .TP 19 | .BR \-l ", " \-\-lvmpartition 20 | Only reports Physical Volumes. 21 | .SH SEE ALSO 22 | .BR lvm (8), 23 | .BR lvm.conf (5), 24 | .BR pvscan (8), 25 | .BR vgscan (8) 26 | -------------------------------------------------------------------------------- /man/lvmsadc.8.in: -------------------------------------------------------------------------------- 1 | .TH "LVMSADC" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\"" 2 | 3 | .SH "NAME" 4 | lvmsadc \- LVM system activity data collector 5 | 6 | .SH "SYNOPSIS" 7 | .B lvmsadc 8 | 9 | .SH "DESCRIPTION" 10 | lvmsadc is not currently supported under LVM2. 11 | 12 | .SH "SEE ALSO" 13 | .BR lvm (8) 14 | -------------------------------------------------------------------------------- /man/lvmsar.8.in: -------------------------------------------------------------------------------- 1 | .TH "LVMSAR" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\"" 2 | 3 | .SH "NAME" 4 | lvmsar \- LVM system activity reporter 5 | 6 | .SH "SYNOPSIS" 7 | .B lvmsar 8 | 9 | .SH "DESCRIPTION" 10 | lvmsar is not currently supported under LVM2. 11 | 12 | .SH "SEE ALSO" 13 | .BR lvm (8) 14 | -------------------------------------------------------------------------------- /man/pvck.8.in: -------------------------------------------------------------------------------- 1 | .TH PVCK 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | pvck \- check physical volume metadata 4 | .SH SYNOPSIS 5 | .B pvck 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-\-help ] 8 | .RB [ \-v | \-\-verbose ] 9 | .RB [ \-\-labelsector 10 | .IR sector ] 11 | .I PhysicalVolume 12 | .RI [ PhysicalVolume ...] 13 | .SH DESCRIPTION 14 | pvck checks physical volume LVM metadata for consistency. 15 | .SH OPTIONS 16 | See \fBlvm\fP(8) for common options. 17 | .TP 18 | .B \-\-labelsector \fIsector 19 | By default, 4 sectors of \fBPhysicalVolume\fP are scanned for an LVM label, 20 | starting at sector 0. This parameter allows you to specify a different 21 | starting sector for the scan and is useful for recovery situations. For 22 | example, suppose the partition table is corrupted or lost on /dev/sda, 23 | but you suspect there was an LVM partition at approximately 100 MiB. This 24 | area of the disk may be scanned by using the \fB\-\-labelsector\fP parameter 25 | with a value of 204800 (100 * 1024 * 1024 / 512 = 204800): 26 | .sp 27 | .B pvck \-\-labelsector 204800 /dev/sda 28 | .sp 29 | Note that a script can be used with \fB\-\-labelsector\fP to automate the 30 | process of finding LVM labels. 31 | .SH SEE ALSO 32 | .BR lvm (8), 33 | .BR pvcreate (8), 34 | .BR pvscan (8) 35 | .BR vgck (8) 36 | -------------------------------------------------------------------------------- /man/pvremove.8.in: -------------------------------------------------------------------------------- 1 | .TH PVREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | pvremove \- remove a physical volume 4 | .SH SYNOPSIS 5 | .B pvremove 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-\-help ] 8 | .RB [ \-t | \-\-test ] 9 | .RB [ \-v | \-\-verbose ] 10 | .RB [ \-\-version ] 11 | .RB [ \-f [ f ]| \-\-force 12 | .RB [ \-\-force ]] 13 | .RB [ \-y | \-\-yes ] 14 | .I PhysicalVolume 15 | .RI [ PhysicalVolume ...] 16 | .SH DESCRIPTION 17 | pvremove wipes the label on a device so that LVM will no longer 18 | recognise it as a physical volume. 19 | .SH OPTIONS 20 | See \fBlvm\fP(8) for common options. 21 | .TP 22 | .BR \-ff ", " \-\-force " " \-\-force 23 | Force the removal of a physical volume belonging to an existing volume group. 24 | Normally \fBvgreduce\fP(8) should be used instead of this command. 25 | You cannot remove a physical volume which in use by some active logical volume. 26 | .TP 27 | .BR \-y ", " \-\-yes 28 | Answer yes to all questions. 29 | .SH SEE ALSO 30 | .BR lvm (8), 31 | .BR pvcreate (8), 32 | .BR pvdisplay (8), 33 | .BR vgreduce (8) 34 | -------------------------------------------------------------------------------- /man/vgcfgbackup.8.in: -------------------------------------------------------------------------------- 1 | .TH VGCFGBACKUP 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgcfgbackup \- backup volume group descriptor area 4 | .SH SYNOPSIS 5 | .B vgcfgbackup 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-f | \-\-file 8 | .RI < filename >] 9 | .RB [ \-h | \-\-help ] 10 | .RB [ \-\-ignorelockingfailure ] 11 | .RB [ \-P | \-\-partial ] 12 | .RB [ \-v | \-\-verbose ] 13 | .RI [ VolumeGroupName ...] 14 | .SH DESCRIPTION 15 | vgcfgbackup allows you to backup the metadata of your volume groups. 16 | If you don't name any volume groups on the command line, all of them 17 | will be backed up. 18 | .sp 19 | In a default installation, each volume group gets backed up into a separate 20 | file bearing the name of the volume group in the directory #DEFAULT_BACKUP_DIR#. 21 | You can write the backup to an alternative file using \fB-f\fP. In this case 22 | if you are backing up more than one volume group the filename is 23 | treated as a template, and %s gets replaced by the volume group name. 24 | .sp 25 | NB. This DOESN'T backup user/system data in logical 26 | volume(s)! Backup #DEFAULT_SYS_DIR# regularly too. 27 | .SH OPTIONS 28 | See \fBlvm\fP(8) for common options. 29 | .SH SEE ALSO 30 | .BR lvm (8), 31 | .BR vgcfgrestore (8) 32 | -------------------------------------------------------------------------------- /man/vgck.8.in: -------------------------------------------------------------------------------- 1 | .TH VGCK 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgck \- check volume group metadata 4 | .SH SYNOPSIS 5 | .B vgck 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-? | \-\-help ] 8 | .RB [ \-v | \-\-verbose ] 9 | .RI [ VolumeGroupName ...] 10 | .SH DESCRIPTION 11 | vgck checks LVM metadata for each named volume group for consistency. 12 | .SH OPTIONS 13 | See \fBlvm\fP(8) for common options. 14 | .SH SEE ALSO 15 | .BR lvm (8), 16 | .BR vgcreate (8), 17 | .BR vgchange (8), 18 | .BR vgscan (8) 19 | -------------------------------------------------------------------------------- /man/vgexport.8.in: -------------------------------------------------------------------------------- 1 | .TH VGEXPORT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgexport \- make volume groups unknown to the system 4 | .SH SYNOPSIS 5 | .B vgexport 6 | .RB [ \-a | \-\-all ] 7 | .RB [ \-d | \-\-debug ] 8 | .RB [ \-h | \-? | \-\-help ] 9 | .RB [ \-v | \-\-verbose ] 10 | .I VolumeGroupName 11 | .RI [ VolumeGroupName ...] 12 | .SH DESCRIPTION 13 | vgexport allows you to make the inactive 14 | .IR VolumeGroupName (s) 15 | unknown to the system. 16 | You can then move all the Physical Volumes in that Volume Group to 17 | a different system for later 18 | .BR vgimport (8). 19 | Most LVM2 tools ignore exported Volume Groups. 20 | .SH OPTIONS 21 | See \fBlvm\fP(8) for common options. 22 | .TP 23 | .BR \-a ", " \-\-all 24 | Export all inactive Volume Groups. 25 | .SH SEE ALSO 26 | .BR lvm (8), 27 | .BR pvscan (8), 28 | .BR vgimport (8), 29 | .BR vgscan (8) 30 | -------------------------------------------------------------------------------- /man/vgimport.8.in: -------------------------------------------------------------------------------- 1 | .TH VGIMPORT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgimport \- make exported volume groups known to the system 4 | .SH SYNOPSIS 5 | .B vgimport 6 | .RB [ \-a | \-\-all ] 7 | .RB [ \-d | \-\-debug ] 8 | .RB [ \-h | \-? | \-\-help ] 9 | .RB [ \-v | \-\-verbose ] 10 | .I VolumeGroupName 11 | .RI [ VolumeGroupName ...] 12 | .SH DESCRIPTION 13 | vgimport allows you to make a Volume Group that was previously 14 | exported using 15 | .BR vgexport (8) 16 | known to the system again, perhaps after moving its Physical Volumes 17 | from a different machine. 18 | .SH OPTIONS 19 | See \fBlvm\fP(8) for common options. 20 | .TP 21 | .BR \-a ", " \-\-all 22 | Import all exported Volume Groups. 23 | .SH SEE ALSO 24 | .BR lvm (8), 25 | .BR pvscan (8), 26 | .BR vgexport (8), 27 | .BR vgscan (8) 28 | -------------------------------------------------------------------------------- /man/vgmerge.8.in: -------------------------------------------------------------------------------- 1 | .TH VGMERGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgmerge \- merge two volume groups 4 | .SH SYNOPSIS 5 | .B vgmerge 6 | .RB [ \-A | \-\-autobackup 7 | .RI { y | n }] 8 | .RB [ \-d | \-\-debug ] 9 | .RB [ \-h | \-? | \-\-help ] 10 | .RB [ \-l | \-\-list ] 11 | .RB [ \-t | \-\-test ] 12 | .RB [ \-v | \-\-verbose ] 13 | .I DestinationVolumeGroupName 14 | .I SourceVolumeGroupName 15 | .SH DESCRIPTION 16 | vgmerge merges two existing volume groups. The inactive 17 | \fISourceVolumeGroupName\fP will be merged into 18 | the \fIDestinationVolumeGroupName\fP if physical extent sizes 19 | are equal and physical and logical volume summaries of both volume groups 20 | fit into \fIDestinationVolumeGroupName\fP's limits. 21 | .SH OPTIONS 22 | See \fBlvm\fP(8) for common options. 23 | .TP 24 | .BR \-l ", " \-\-list 25 | Display merged \fIDestinationVolumeGroupName\fP like \fBvgdisplay -v\fP. 26 | .TP 27 | .BR \-t ", " \-\-test 28 | Do a test run WITHOUT making any real changes. 29 | .SH Examples 30 | Merge the inactive volume group named "my_vg" 31 | into the active or inactive volume group named "databases" giving verbose 32 | runtime information: 33 | .sp 34 | .B vgmerge -v databases my_vg 35 | .SH SEE ALSO 36 | .BR lvm (8), 37 | .BR vgcreate (8), 38 | .BR vgextend (8), 39 | .BR vgreduce (8) 40 | -------------------------------------------------------------------------------- /man/vgmknodes.8.in: -------------------------------------------------------------------------------- 1 | .TH VGMKNODES 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgmknodes \- recreate volume group directory and logical volume special files 4 | .SH SYNOPSIS 5 | .B vgmknodes 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-\-help ] 8 | .RB [ \-\-refresh ] 9 | .RB [ \-v | \-\-verbose ] 10 | .RI [[ VolumeGroupName | LogicalVolumePath ]...] 11 | .SH DESCRIPTION 12 | Checks the LVM2 special files in /dev that are needed for active 13 | logical volumes and creates any missing ones and removes unused ones. 14 | .SH OPTIONS 15 | .TP 16 | See \fBlvm\fP(8) for common options. 17 | .TP 18 | .BR \-\-refresh 19 | If any logical volume in the volume group is active, reload its metadata. 20 | This is not necessary in normal operation, but may be useful 21 | if something has gone wrong or if you're doing clustering 22 | manually without a clustered lock manager. 23 | .SH SEE ALSO 24 | .BR lvm (8), 25 | .BR vgscan (8), 26 | .BR dmsetup (8) 27 | -------------------------------------------------------------------------------- /man/vgremove.8.in: -------------------------------------------------------------------------------- 1 | .TH VGREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgremove \- remove a volume group 4 | .SH SYNOPSIS 5 | .B vgremove 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-f | \-\-force ] 8 | .RB [ \-h | \-? | \-\-help ] 9 | .RB [ \-\-noudevsync ] 10 | .RB [ \-t | \-\-test ] 11 | .RB [ \-v | \-\-verbose ] 12 | .I VolumeGroupName 13 | .RI [ VolumeGroupName ...] 14 | .SH DESCRIPTION 15 | vgremove allows you to remove one or more volume groups. 16 | If one or more physical volumes in the volume group are lost, 17 | consider \fBvgreduce --removemissing\fP to make the volume group 18 | metadata consistent again. 19 | .sp 20 | If there are logical volumes that exist in the volume group, 21 | a prompt will be given to confirm removal. You can override 22 | the prompt with \fB-f\fP. 23 | .SH OPTIONS 24 | See \fBlvm\fP(8) for common options. 25 | .TP 26 | .BR \-f ", " \-\-force 27 | Force the removal of any logical volumes on the volume group 28 | without confirmation. 29 | .TP 30 | .BR \-\-noudevsync 31 | Disable udev synchronisation. The 32 | process will not wait for notification from udev. 33 | It will continue irrespective of any possible udev processing 34 | in the background. You should only use this if udev is not running 35 | or has rules that ignore the devices LVM2 creates. 36 | .SH SEE ALSO 37 | .BR lvm (8), 38 | .BR lvremove (8), 39 | .BR vgcreate (8), 40 | .BR vgreduce (8) 41 | -------------------------------------------------------------------------------- /man/vgscan.8.in: -------------------------------------------------------------------------------- 1 | .TH VGSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- 2 | .SH NAME 3 | vgscan \- scan all disks for volume groups and rebuild caches 4 | .SH SYNOPSIS 5 | .B vgscan 6 | .RB [ \-d | \-\-debug ] 7 | .RB [ \-h | \-? | \-\-help ] 8 | .RB [ \-\-ignorelockingfailure ] 9 | .RB [ \-\-mknodes ] 10 | .RB [ \-P | \-\-partial ] 11 | .RB [ \-v | \-\-verbose ] 12 | .SH DESCRIPTION 13 | vgscan scans all SCSI, (E)IDE disks, multiple devices and a bunch 14 | of other disk devices in the system looking for LVM physical volumes 15 | and volume groups. Define a filter in \fBlvm.conf\fP(5) to restrict 16 | the scan to avoid a CD ROM, for example. 17 | .LP 18 | In LVM2, vgscans take place automatically; but you might still need to 19 | run one explicitly after changing hardware. 20 | .SH OPTIONS 21 | See \fBlvm\fP(8) for common options. 22 | .TP 23 | .B \-\-mknodes 24 | Also checks the LVM special files in /dev that are needed for active 25 | logical volumes and creates any missing ones and removes unused ones. 26 | .TP 27 | .B \-\-cache 28 | Scan devices for LVM physical volumes and volume groups and instruct 29 | the lvmetad daemon to update its cached state accordingly. 30 | .SH SEE ALSO 31 | .BR lvm (8), 32 | .BR vgcreate (8), 33 | .BR vgchange (8) 34 | -------------------------------------------------------------------------------- /old-tests/config/.gitignore: -------------------------------------------------------------------------------- 1 | !Makefile 2 | -------------------------------------------------------------------------------- /old-tests/config/Makefile: -------------------------------------------------------------------------------- 1 | config_t: config_t.c 2 | gcc -g -I../../include config_t.c -L../../lib -llvm -o config_t 3 | 4 | clean: 5 | rm config_t -------------------------------------------------------------------------------- /old-tests/config/config_t.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test program that reads, then writes a config file. 3 | */ 4 | #include 5 | 6 | #include "config.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | struct config_file *cf; 11 | 12 | if (argc != 2) { 13 | fprintf(stderr, "Usage: %s \n", argv[0]); 14 | exit(1); 15 | } 16 | 17 | cf = create_config_file(); 18 | if (cf == NULL) { 19 | fprintf(stderr, "Couldn't create config_file object.\n"); 20 | exit(1); 21 | } 22 | 23 | 24 | if (!read_config(cf, argv[1])) { 25 | fprintf(stderr, "Couldn't read config file '%s'\n", argv[0]); 26 | exit(1); 27 | } 28 | 29 | if (!write_config(cf, "out")) { 30 | fprintf(stderr, "Couldn't write config file 'out'\n"); 31 | exit(1); 32 | } 33 | 34 | destroy_config_file(cf); 35 | dump_memory(); 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /old-tests/config/empty_array.conf: -------------------------------------------------------------------------------- 1 | foo = [] -------------------------------------------------------------------------------- /old-tests/device/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | VPATH = @srcdir@ 19 | 20 | SOURCES=\ 21 | dev_cache_t.c 22 | 23 | TARGETS=dev_cache_t 24 | 25 | include $(top_builddir)/make.tmpl 26 | 27 | dev_cache_t: dev_cache_t.o $(top_srcdir)/lib/liblvm.a 28 | $(CC) -o dev_cache_t dev_cache_t.o -L$(top_builddir)/lib -llvm 29 | 30 | -------------------------------------------------------------------------------- /old-tests/device/fill_device.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU General Public License v.2. 10 | * 11 | * You should have received a copy of the GNU General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "device.h" 17 | #include "random.h" 18 | 19 | #include 20 | 21 | 22 | 23 | 24 | int main(int argc, char **argv) 25 | { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /old-tests/device/random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU General Public License v.2. 10 | * 11 | * You should have received a copy of the GNU General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | /* 17 | * Random number generator snarfed from the 18 | * Stanford Graphbase. 19 | */ 20 | 21 | #ifndef _LVM_RANDOM_H 22 | #define _LVM_RANDOM_H 23 | 24 | #include "lvm-types.h" 25 | 26 | void rand_init(int32_t seed); 27 | int32_t rand_get(void); 28 | 29 | /* 30 | * Note this will reset the seed. 31 | */ 32 | int rand_check(void); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /old-tests/filters/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | VPATH = @srcdir@ 19 | 20 | SOURCES=\ 21 | rfilter_t.c \ 22 | pfilter_t.c 23 | 24 | TARGETS=\ 25 | rfilter_t \ 26 | pfilter_t 27 | 28 | include $(top_builddir)/make.tmpl 29 | 30 | rfilter_t: rfilter_t.o $(top_srcdir)/lib/liblvm.a 31 | $(CC) -o rfilter_t rfilter_t.o -L$(top_builddir)/lib -llvm 32 | 33 | pfilter_t: pfilter_t.o $(top_srcdir)/lib/liblvm.a 34 | $(CC) -o pfilter_t pfilter_t.o -L$(top_builddir)/lib -llvm 35 | 36 | -------------------------------------------------------------------------------- /old-tests/filters/sample.cfg: -------------------------------------------------------------------------------- 1 | devices { 2 | 3 | # first match is final, eg. /dev/ide/cdrom 4 | # get's rejected due to the first pattern 5 | 6 | filter=["r/cdrom/", # don't touch the music ! 7 | "a/hd[a-d][0-9]+/", 8 | "a/ide/", 9 | "a/sd/", 10 | "a/md/", 11 | "a|loop/[0-9]+|", # accept devfs style loop back 12 | "r/loop/", # and reject old style 13 | "a/dasd/", 14 | "a/dac960/", 15 | "a/nbd/", 16 | "a/ida/", 17 | "a/cciss/", 18 | "a/ubd/", 19 | "r/.*/"] # reject all others 20 | 21 | } 22 | -------------------------------------------------------------------------------- /old-tests/format1/pretty_print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU General Public License v.2. 10 | * 11 | * You should have received a copy of the GNU General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #ifndef _LVM_PRETTY_PRINT 17 | #define _LVM_PRETTY_PRINT 18 | 19 | #include "metadata.h" 20 | 21 | #include 22 | 23 | void dump_pv(struct physical_volume *pv, FILE *fp); 24 | void dump_lv(struct logical_volume *lv, FILE *fp); 25 | void dump_vg(struct volume_group *vg, FILE *fp); 26 | void dump_vg_names(struct list_head *vg_names, FILE *fp); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /old-tests/mm/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | VPATH = @srcdir@ 19 | 20 | SOURCES=\ 21 | dbg_malloc_t.c 22 | 23 | TARGETS=dbg_malloc_t 24 | 25 | include $(top_builddir)/make.tmpl 26 | 27 | dbg_malloc_t: dbg_malloc_t.o 28 | $(CC) $(CFLAGS) -o dbg_malloc_t dbg_malloc_t.o \ 29 | -L$(top_builddir)/lib -llvm 30 | 31 | pool_t: pool_t.o 32 | $(CC) $(CFLAGS) -o pool_t pool_t.o -L$(top_builddir)/lib -llvm 33 | 34 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | # Dummy test file 2 | msgid "" 3 | msgstr "" 4 | "PO-Revision-Date: 2004-02-13 20:35+0000\n" 5 | "Last-Translator: Nobody \n" 6 | "Language-Team: LANGUAGE \n" 7 | "MIME-Version: 1.0\n" 8 | "Content-Type: text/plain; charset=ISO-8859-15\n" 9 | "Content-Transfer-Encoding: 8bit\n" 10 | 11 | -------------------------------------------------------------------------------- /po/pogen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU General Public License v.2. 9 | * 10 | * You should have received a copy of the GNU General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | /* 16 | * Macros to change log messages into a format that xgettext can handle. 17 | * 18 | * Note that different PRI* definitions lead to different strings for 19 | * different architectures. 20 | */ 21 | 22 | #define print_log(level, dm_errno, file, line, format, args...) print_log(format, args) 23 | #define dm_log(level, file, line, format, args...) dm_log(format, args) 24 | #define dm_log_with_errno(level, dm_errno, file, line, format, args...) \ 25 | dm_log(level, file, line, format, args) 26 | 27 | -------------------------------------------------------------------------------- /python/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011-2012 Red Hat, Inc. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU Lesser General Public License v.2.1. 9 | # 10 | # You should have received a copy of the GNU Lesser General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | srcdir = @srcdir@ 15 | top_srcdir = @top_srcdir@ 16 | top_builddir = @top_builddir@ 17 | 18 | python_bindings: .liblvm_built 19 | 20 | .liblvm_built: liblvm_python.c 21 | $(PYTHON) setup.py build 22 | touch $@ 23 | 24 | liblvm_python.c: 25 | $(LN_S) $(srcdir)/liblvm.c $@ 26 | 27 | include $(top_builddir)/make.tmpl 28 | 29 | install_python_bindings: python_bindings 30 | $(PYTHON) setup.py install --skip-build --root $(rootdir) 31 | 32 | install_lvm2: install_python_bindings 33 | 34 | install: install_lvm2 35 | 36 | CLEAN_TARGETS += .liblvm_built liblvm_python.c 37 | 38 | DISTCLEAN_DIRS += build 39 | DISTCLEAN_TARGETS += setup.py 40 | -------------------------------------------------------------------------------- /report-generators/lib/log.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | # Merely wraps the logger library with a bit of standard policy. 12 | require 'logger' 13 | 14 | module Log 15 | $log = Logger.new(STDERR) 16 | 17 | def init(io_) 18 | $log = Logger.new(io_) 19 | end 20 | end 21 | 22 | def fatal(*args) 23 | $log.fatal(*args) 24 | end 25 | 26 | def error(*args) 27 | $log.error(*args) 28 | end 29 | 30 | def info(*args) 31 | $log.info(*args) 32 | end 33 | 34 | def warning(*args) 35 | $log.warn(*args) 36 | end 37 | 38 | def debug(*args) 39 | $log.debug(*args) 40 | end 41 | -------------------------------------------------------------------------------- /report-generators/lib/report_templates.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | # Policy for the location of report templates 12 | require 'string-store' 13 | 14 | class TemplateStringStore < StringStore 15 | def initialize() 16 | super(['report-generators/templates']) 17 | end 18 | end 19 | 20 | module ReportTemplates 21 | def generate_report(report, bs, dest_path = nil) 22 | include Reports 23 | reports = ReportRegister.new 24 | template_store = TemplateStringStore.new 25 | report = reports.get_report(report) 26 | erb = ERB.new(template_store.lookup(report.template)) 27 | body = erb.result(bs) 28 | title = report.short_desc 29 | 30 | erb = ERB.new(template_store.lookup("boiler_plate.rhtml")) 31 | txt = erb.result(binding) 32 | 33 | dest_path = dest_path.nil? ? report.path : dest_path 34 | dest_path.open("w") do |out| 35 | out.puts txt 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /report-generators/lib/string-store.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | # Provides a simple way of accessing the contents of files by a symbol 12 | # name. Useful for erb templates. 13 | 14 | require 'pathname' 15 | 16 | class StringStore 17 | attr_accessor :path 18 | 19 | def initialize(p) 20 | @paths = p.nil? ? Array.new : p # FIXME: do we need to copy p ? 21 | end 22 | 23 | def lookup(sym) 24 | files = expansions(sym) 25 | 26 | @paths.each do |p| 27 | files.each do |f| 28 | pn = Pathname.new("#{p}/#{f}") 29 | if pn.file? 30 | return pn.read 31 | end 32 | end 33 | end 34 | 35 | raise RuntimeError, "unknown string entry: #{sym}" 36 | end 37 | 38 | private 39 | def expansions(sym) 40 | ["#{sym}", "#{sym}.txt"] 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /report-generators/templates/boiler_plate.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= title %> 5 | 6 | 7 | 8 | 9 | 12 |
13 |
14 | 15 | 16 | 17 | 18 |
Generation times
Unit tests
Memory tests
19 |
20 | 21 |
22 | <%= body %> 23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /report-generators/templates/index.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% [:unit_test, :memcheck].each do |sym| %> 4 | <% r = reports.get_report(sym) %> 5 | 6 | 13 | 14 | 15 | <% end %> 16 |
ReportGeneration time
7 | <% if r.path.file? %> 8 | <%= r.short_desc %> 9 | <% else %> 10 | <%= r.short_desc %> 11 | <% end %> 12 | <%= safe_mtime(r) %>
17 | 18 | -------------------------------------------------------------------------------- /report-generators/templates/memcheck.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Tests passedTests failed
<%= total_passed %>><%= total_failed %>
5 | 6 | <% schedules.each do |s| %> 7 |

<%= s.dir.sub('./unit-tests/', '') %>

8 | 9 | 10 | 11 | <% s.schedules.each do |t| %> 12 | 13 | 16 | <% if t.status.success? %> 17 | 18 | <% else %> 19 | 20 | <% end %> 21 | 22 | <% stats = extract_stats(t) %> 23 | 24 | 25 | 26 | 27 | 28 | <% end %> 29 |
TestResultDefinitely lostindirectly lostpossibly loststill reachable
14 | <%= t.desc %> 15 | passfail<%= stats.definitely_lost %><%= stats.indirectly_lost %><%= stats.possibly_lost %><%= stats.reachable %>
30 | <% end %> 31 | -------------------------------------------------------------------------------- /report-generators/templates/unit_detail.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | <% if t.status.success? %> 8 | 9 | <% else %> 10 | 11 | <% end %> 12 | 13 |
TestResult
5 | <%= t.desc %> 6 | passfail
14 | 15 | 16 | 17 | 18 | 23 | 24 |
Command line
19 |
20 | <%= t.command_line %>
21 |   
22 |
25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 |
Output
31 |
32 | <%= t.output %>
33 |   
34 |
37 | 38 | -------------------------------------------------------------------------------- /report-generators/templates/unit_test.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Tests passedTests failed
<%= total_passed %>><%= total_failed %>
5 | 6 | <% schedules.each do |s| %> 7 |

<%= s.dir.sub('./unit-tests/', '') %>

8 | 9 | 10 | <% s.schedules.each do |t| %> 11 | 12 | 15 | <% if t.status.success? %> 16 | 17 | <% else %> 18 | 19 | <% end %> 20 | 21 | <% end %> 22 |
TestResult
13 | <%= t.desc %> 14 | passfail
23 | <% end %> 24 | -------------------------------------------------------------------------------- /report-generators/test/example.schedule: -------------------------------------------------------------------------------- 1 | # This is a comment 2 | description number 1:$TEST_TOOL ls 3 | foo bar: $TEST_TOOL du -hs . 4 | this comment is prefixed with whitespace: $TEST_TOOL date -------------------------------------------------------------------------------- /report-generators/test/strings/more_strings/test3.txt: -------------------------------------------------------------------------------- 1 | lorem 2 | -------------------------------------------------------------------------------- /report-generators/test/strings/test1.txt: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /report-generators/test/strings/test2: -------------------------------------------------------------------------------- 1 | one 2 | two 3 | three -------------------------------------------------------------------------------- /report-generators/test/tc_log.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | require 'test/unit' 12 | require 'stringio' 13 | require 'log' 14 | 15 | class TestLog < Test::Unit::TestCase 16 | include Log 17 | 18 | private 19 | def remove_timestamps(l) 20 | l.gsub(/\[[^\]]*\]/, '') 21 | end 22 | 23 | public 24 | def test_log 25 | StringIO.open do |out| 26 | init(out) 27 | 28 | info("msg1") 29 | warning("msg2") 30 | debug("msg3") 31 | 32 | assert_equal("I, INFO -- : msg1\nW, WARN -- : msg2\nD, DEBUG -- : msg3\n", 33 | remove_timestamps(out.string)) 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /report-generators/test/tc_schedule_file.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | require 'test/unit' 12 | require 'pathname' 13 | require 'schedule_file' 14 | 15 | class TestScheduleFile < Test::Unit::TestCase 16 | def test_reading 17 | p = Pathname.new("report-generators/test/example.schedule") 18 | p.open do |f| 19 | s = Schedule.read(p.dirname, f) 20 | 21 | assert_equal(3, s.schedules.size) 22 | assert_equal(s.schedules[2].desc, "this comment is prefixed with whitespace") 23 | assert_equal(s.schedules[0].command_line, "$TEST_TOOL ls") 24 | end 25 | end 26 | 27 | def test_running 28 | p = Pathname.new("report-generators/test/example.schedule") 29 | p.open do |f| 30 | s = Schedule.read(p.dirname, f) 31 | s.run 32 | 33 | s.schedules.each do |t| 34 | assert(t.status.success?) 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /report-generators/test/tc_string_store.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | require 'string-store' 12 | require 'test/unit' 13 | 14 | class TestStringStore < Test::Unit::TestCase 15 | def setup 16 | @ss = StringStore.new(['report-generators/test/strings', 17 | 'report-generators/test/strings/more_strings']) 18 | end 19 | 20 | def test_lookup 21 | assert_equal("Hello, world!\n", @ss.lookup(:test1)) 22 | assert_equal("one\ntwo\nthree", @ss.lookup(:test2)) 23 | assert_equal("lorem\n", @ss.lookup(:test3)) 24 | 25 | assert_raises(RuntimeError) do 26 | @ss.lookup(:unlikely_name) 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /report-generators/test/ts.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | require 'tc_log' 12 | require 'tc_string_store' 13 | require 'tc_schedule_file' 14 | -------------------------------------------------------------------------------- /report-generators/title_page.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 2 | # 3 | # This copyrighted material is made available to anyone wishing to use, 4 | # modify, copy, or redistribute it subject to the terms and conditions 5 | # of the GNU General Public License v.2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software Foundation, 9 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | 11 | # This generates the index for the reports, including generation 12 | # times. 13 | 14 | require 'log' 15 | require 'string-store' 16 | require 'reports' 17 | require 'erb' 18 | require 'report_templates' 19 | 20 | include Reports 21 | 22 | reports = ReportRegister.new 23 | 24 | def safe_mtime(r) 25 | r.path.file? ? r.path.mtime.to_s : "not generated" 26 | end 27 | 28 | template_store = TemplateStringStore.new 29 | 30 | # FIXME: use generate_report() method 31 | erb = ERB.new(template_store.lookup("index.rhtml")) 32 | body = erb.result(binding) 33 | title = "Generation times" 34 | 35 | erb = ERB.new(template_store.lookup("boiler_plate.rhtml")) 36 | txt = erb.result(binding) 37 | 38 | Pathname.new("reports/index.html").open("w") do |f| 39 | f.puts txt 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | clvmd_init_red_hat 2 | cmirrord_init_red_hat 3 | dm_event_systemd_red_hat.service 4 | lvm2_lvmetad_init_red_hat 5 | lvm2_lvmetad_systemd_red_hat.service 6 | lvm2_lvmetad_systemd_red_hat.socket 7 | lvm2_monitoring_init_red_hat 8 | lvm2_monitoring_systemd_red_hat.service 9 | lvm2_tmpfiles_red_hat.conf 10 | -------------------------------------------------------------------------------- /scripts/blk_availability_systemd_red_hat.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Availability of block devices 3 | After=lvm2-activation.service lvm2-lvmetad.service iscsi.service iscsid.service fcoe.service 4 | DefaultDependencies=no 5 | Conflicts=shutdown.target 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart=/usr/bin/true 10 | ExecStop=@sbindir@/blkdeactivate -u -l wholevg 11 | RemainAfterExit=yes 12 | 13 | [Install] 14 | WantedBy=sysinit.target 15 | -------------------------------------------------------------------------------- /scripts/dm_event_systemd_red_hat.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Device-mapper event daemon 3 | Documentation=man:dmeventd(8) 4 | Requires=dm-event.socket 5 | After=dm-event.socket 6 | Before=local-fs.target 7 | DefaultDependencies=no 8 | 9 | [Service] 10 | Type=forking 11 | ExecStart=@sbindir@/dmeventd 12 | ExecReload=@sbindir@/dmeventd -R 13 | Environment=SD_ACTIVATION=1 14 | PIDFile=@DMEVENTD_PIDFILE@ 15 | OOMScoreAdjust=-1000 16 | 17 | [Install] 18 | WantedBy=sysinit.target 19 | -------------------------------------------------------------------------------- /scripts/dm_event_systemd_red_hat.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Device-mapper event daemon FIFOs 3 | Documentation=man:dmeventd(8) 4 | DefaultDependencies=no 5 | 6 | [Socket] 7 | ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-server 8 | ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-client 9 | SocketMode=0600 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /scripts/lvm2_lvmetad_systemd_red_hat.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=LVM2 metadata daemon 3 | Documentation=man:lvmetad(8) 4 | Requires=lvm2-lvmetad.socket 5 | After=lvm2-lvmetad.socket 6 | DefaultDependencies=no 7 | Conflicts=shutdown.target 8 | 9 | [Service] 10 | Type=forking 11 | NonBlocking=true 12 | ExecStart=@sbindir@/lvmetad 13 | ExecReload=@sbindir@/lvmetad -R 14 | Environment=SD_ACTIVATION=1 15 | Restart=on-abort 16 | PIDFile=@LVMETAD_PIDFILE@ 17 | 18 | [Install] 19 | WantedBy=sysinit.target 20 | -------------------------------------------------------------------------------- /scripts/lvm2_lvmetad_systemd_red_hat.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=LVM2 metadata daemon socket 3 | Documentation=man:lvmetad(8) 4 | DefaultDependencies=no 5 | 6 | [Socket] 7 | ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket 8 | SocketMode=0600 9 | 10 | [Install] 11 | WantedBy=sockets.target 12 | -------------------------------------------------------------------------------- /scripts/lvm2_monitoring_systemd_red_hat.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling 3 | Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8) 4 | Requires=dm-event.socket 5 | After=dm-event.socket fedora-storage-init.service fedora-storage-init-late.service lvm2-activation.service lvm2-lvmetad.service 6 | Before=local-fs.target 7 | DefaultDependencies=no 8 | Conflicts=shutdown.target 9 | 10 | [Service] 11 | Type=oneshot 12 | Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 13 | ExecStart=@sbindir@/lvm vgchange --monitor y 14 | ExecStop=@sbindir@/lvm vgchange --monitor n 15 | RemainAfterExit=yes 16 | 17 | [Install] 18 | WantedBy=sysinit.target 19 | -------------------------------------------------------------------------------- /scripts/lvm2_tmpfiles_red_hat.conf.in: -------------------------------------------------------------------------------- 1 | d @DEFAULT_LOCK_DIR@ 0700 root root - 2 | d @DEFAULT_RUN_DIR@ 0700 root root - 3 | -------------------------------------------------------------------------------- /scripts/lvm2create_initrd/.gitignore: -------------------------------------------------------------------------------- 1 | !Makefile 2 | !lvm2create_initrd.8 3 | -------------------------------------------------------------------------------- /scripts/lvm2create_initrd/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | echo "Nothing to do for make all" 3 | 4 | manpage: 5 | pod2man --center="create LVM2 initrd" --name='lvm2create_initrd' --section=8 -r 'lvm2create_initrd' ./lvm2create_initrd.pod > lvm2create_initrd.8 6 | 7 | -------------------------------------------------------------------------------- /scripts/lvm2create_initrd/lvm2udev: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # $Id$ 4 | 5 | # simple startup script to create lvm2 devices if /dev is a mountpoint, there 6 | # are active dm- devices, and an executable /sbin/vgscan. 7 | 8 | # this script is licensed under GPLv2. 9 | # See http://www.gnu.org/licenses/gpl.html 10 | 11 | case $1 in 12 | start) 13 | # is /dev a mountpoint? 14 | mountpoint -q /dev 15 | DEVMNTPOINT=$? 16 | 17 | # check to see if there are active dm entries under /sys 18 | ls /sys/block/dm-*/dev 1>/dev/null 2>&1 19 | ACTIVEDMDEVS=$? 20 | 21 | # mknodes if conditions are right 22 | if [ $DEVMNTPOINT -eq 0 -a $ACTIVEDMDEVS -eq 0 -a -x /sbin/vgscan ]; then 23 | /sbin/vgscan --mknodes --ignorelockingfailure 24 | fi 25 | ;; 26 | stop) 27 | exit 0 28 | ;; 29 | *) 30 | echo "usage:" 31 | echo " $0 start|stop" 32 | ;; 33 | esac 34 | -------------------------------------------------------------------------------- /scripts/relpath.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/awk -f 2 | # 3 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | # relpath.awk: Script is used to calculate relative path 16 | # between two real absolute paths. 17 | # 18 | # echo /a/b/c/d /a/b/e/f | relpath.awk 19 | # -> ../../e/f/ 20 | 21 | { 22 | length_from = split($1, from, "/"); 23 | length_to = split($2, to, "/") ; 24 | l = 1; 25 | while (l <= length_from && l <= length_to && from[l] == to[l]) 26 | l++; 27 | for (i = l; i <= length_from && length(from[i]); i++) { 28 | if (i > l) 29 | p = sprintf("%s/", p); 30 | p = sprintf("%s..", p); 31 | } 32 | for (i = l; i <= length_to && length(to[i]); i++) { 33 | if (length(p) > 0) 34 | p = sprintf("%s/", p); 35 | p = sprintf("%s%s", p, to[i]); 36 | } 37 | if (length(p)) 38 | p = sprintf("%s/", p); 39 | print p 40 | } 41 | -------------------------------------------------------------------------------- /scripts/vg_convert: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | # Original script used to convert a VG from LVM1 to LVM2 metadata format. 4 | # Superceded by 'vgconvert', but left here to show how to do it step-by-step. 5 | 6 | # Takes vgname as parameter. No error checking. Uses temp file 'lvmbackup'. 7 | 8 | echo "Please use the 'vgconvert' tool instead" 9 | exit 1 10 | 11 | ./vgcfgbackup $1 || exit 1 12 | ./vgcfgbackup --file lvmbackup $1 || exit 1 13 | 14 | CMDS=`./pvscan -u | sed -ne "s/.*PV \(.*\) with UUID \(.*\) VG $1 .*/.\/pvcreate -ff -y -M lvm2 --restorefile lvmbackup -u \2 \1 ; /p"` 15 | 16 | sh -x -c "$CMDS" || exit 1 17 | 18 | ./vgcfgrestore --file lvmbackup -M lvm2 $1 || exit 1 19 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | .bin-dir-stamp 2 | bin 3 | init.sh 4 | -------------------------------------------------------------------------------- /test/api/lvtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | . lib/test 15 | 16 | aux prepare_vg 1 17 | 18 | lvcreate -n test -l 5 $vg 19 | aux apitest lvtest $vg 20 | 21 | check lv_field $vg/test lv_name test 22 | -------------------------------------------------------------------------------- /test/api/pe_start.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #undef NDEBUG 16 | 17 | #include "lvm2app.h" 18 | #include "assert.h" 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | lvm_t handle; 23 | vg_t vg = NULL; 24 | pv_t pv; 25 | struct lvm_property_value v; 26 | 27 | handle = lvm_init(NULL); 28 | assert(handle); 29 | 30 | vg = lvm_vg_create(handle, argv[1]); 31 | assert(vg); 32 | 33 | if (lvm_vg_extend(vg, argv[2])) 34 | abort(); 35 | 36 | pv = lvm_pv_from_name(vg, argv[2]); 37 | assert(pv); 38 | 39 | v = lvm_pv_get_property(pv, "pe_start"); 40 | assert(v.is_valid); 41 | fprintf(stderr, "pe_start = %d\n", (int)v.value.integer); 42 | assert(v.value.integer == 2048 * 512); 43 | 44 | lvm_vg_close(vg); 45 | lvm_quit(handle); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /test/api/pe_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | . lib/test 15 | 16 | aux prepare_devs 2 17 | 18 | aux apitest pe_start test_vg $dev1 19 | 20 | not vgs test_vg 21 | not pvs $dev1 22 | -------------------------------------------------------------------------------- /test/api/percent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | . lib/test 15 | 16 | kernel_at_least 2 6 33 || skip 17 | 18 | aux prepare_devs 2 19 | 20 | vgcreate -c n -s 4k $vg $(cat DEVICES) 21 | lvcreate -l 5 -n foo $vg 22 | lvcreate -s -n snap $vg/foo -l 2 -c 4k 23 | lvcreate -s -n snap2 $vg/foo -l 6 -c 4k 24 | dd if=/dev/urandom of="$DM_DEV_DIR/$vg/snap2" count=1 bs=1024 25 | lvcreate -m 1 -n mirr $vg -l 1 --mirrorlog core 26 | lvs $vg 27 | aux apitest percent $vg 28 | 29 | vgremove -ff $vg 30 | -------------------------------------------------------------------------------- /test/api/thin_percent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This file is part of LVM2. 5 | # 6 | # This copyrighted material is made available to anyone wishing to use, 7 | # modify, copy, or redistribute it subject to the terms and conditions 8 | # of the GNU General Public License v.2. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software Foundation, 12 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | 14 | . lib/test 15 | 16 | aux have_thin 1 0 0 || skip 17 | 18 | # disable thin_check if not present in system 19 | which thin_check || aux lvmconf 'global/thin_check_executable = ""' 20 | 21 | aux prepare_devs 2 22 | 23 | vgcreate -s 64k $vg $(cat DEVICES) 24 | 25 | lvcreate -L5M -T $vg/pool 26 | 27 | lvcreate -V1M -T $vg/pool -n thin 28 | dd if=/dev/urandom of="$DM_DEV_DIR/$vg/thin" count=2 bs=256K 29 | 30 | lvcreate -s $vg/thin -n snap 31 | dd if=/dev/urandom of="$DM_DEV_DIR/$vg/snap" count=3 bs=256K 32 | 33 | lvs $vg 34 | 35 | aux apitest thin_percent $vg 36 | 37 | vgremove -ff $vg 38 | -------------------------------------------------------------------------------- /test/api/vgtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 13 | # tests lvm2app library 14 | # 15 | 16 | . lib/test 17 | 18 | aux prepare_pvs 2 19 | 20 | aux apitest vgtest $vg1 "$dev1" "$dev2" 21 | -------------------------------------------------------------------------------- /test/lib/get.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # get.sh: get various values from volumes 13 | # 14 | # USAGE: 15 | # get pv_field PV field [pvs params] 16 | # get vg_field VG field [vgs params] 17 | # get lv_field LV field [lvs params] 18 | # 19 | # get lv_devices LV [lvs params] 20 | 21 | 22 | # trims only leading prefix, we should not need trim trailing spaces 23 | trim_() { 24 | #local var=${var%"${var##*[! ]}"} # remove trailing space characters 25 | echo ${1#"${1%%[! ]*}"} # remove leading space characters 26 | } 27 | 28 | pv_field() { 29 | trim_ "$(pvs --noheadings -o $2 ${@:3} $1)" 30 | } 31 | 32 | vg_field() { 33 | trim_ "$(vgs --noheadings -o $2 ${@:3} $1)" 34 | } 35 | 36 | lv_field() { 37 | trim_ "$(lvs --noheadings -o $2 ${@:3} $1)" 38 | } 39 | 40 | lv_devices() { 41 | lv_field $1 devices -a "${@:2}" | sed 's/([^)]*)//g; s/,/ /g' 42 | } 43 | 44 | unset LVM_VALGRIND 45 | "$@" 46 | -------------------------------------------------------------------------------- /test/lib/lvm-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011-2012 Red Hat, Inc. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/paths 13 | 14 | CMD=${0##*/} 15 | test "$CMD" != lvm || unset CMD 16 | 17 | # Multiple level of LVM_VALGRIND support 18 | # the higher level the more commands are traced 19 | if test -n "$LVM_VALGRIND"; then 20 | RUN_VALGRIND="aux run_valgrind"; 21 | case "$CMD" in 22 | lvs|pvs|vgs|vgck|vgscan) 23 | test "$LVM_VALGRIND" -gt 2 || unset RUN_VALGRIND ;; 24 | pvcreate|pvremove|lvremove|vgcreate|vgremove) 25 | test "$LVM_VALGRIND" -gt 1 || unset RUN_VALGRIND ;; 26 | *) 27 | test "$LVM_VALGRIND" -gt 0 || unset RUN_VALGRIND ;; 28 | esac 29 | fi 30 | 31 | $RUN_VALGRIND "$abs_top_builddir/tools/lvm" $CMD "$@" && \ 32 | rm -f debug.log # Remove log for successful command 33 | -------------------------------------------------------------------------------- /test/shell/000-basic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2009-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | lvm version 15 | 16 | v=$abs_top_builddir/lib/misc/lvm-version.h 17 | sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected 18 | 19 | lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual 20 | 21 | # ensure they are the same 22 | diff -u actual expected 23 | 24 | # ensure we can create devices (uses dmsetup, etc) 25 | aux prepare_devs 5 26 | 27 | # ensure we do not crash on a bug in config file 28 | aux lvmconf 'log/prefix = 1""' 29 | not lvs $(cat DEVICES) 30 | -------------------------------------------------------------------------------- /test/shell/activate-minor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 2 15 | lvcreate -a n --zero n -l 1 -n foo $vg 16 | lvchange $vg/foo -My --major=255 --minor=123 17 | lvchange $vg/foo -a y 18 | dmsetup info $vg-foo | tee info 19 | egrep "^Major, minor: *[0-9]+, 123" info 20 | -------------------------------------------------------------------------------- /test/shell/activate-missing-segment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # Test activation behaviour with devices missing. 13 | # - snapshots and their origins are only activated together; if one fails, both 14 | # fail 15 | # - partial mirrors are not activated (but maybe they should? maybe we should 16 | # instead lvconvert --repair them?) 17 | # - linear LVs with bits missing are not activated 18 | 19 | . lib/test 20 | 21 | aux prepare_vg 2 22 | 23 | lvcreate -l100%FREE -n span $vg 24 | vgchange -a n $vg 25 | 26 | aux disable_dev "$dev1" 27 | not vgchange -a y $vg 28 | vgchange -a y --partial $vg 29 | check active $vg span 30 | -------------------------------------------------------------------------------- /test/shell/activate-partial.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 3 15 | 16 | lvcreate -m 1 -l 1 -n mirror $vg 17 | lvchange -a n $vg/mirror 18 | aux disable_dev "$dev1" 19 | 20 | not vgreduce --removemissing $vg 21 | not lvchange -v -a y $vg/mirror 22 | lvchange -v --partial -a y $vg/mirror 23 | not lvchange -v --refresh $vg/mirror 24 | lvchange -v --refresh --partial $vg/mirror 25 | 26 | # also check that vgchange works 27 | vgchange -a n --partial $vg 28 | vgchange -a y --partial $vg 29 | 30 | # check vgremove 31 | vgremove -f $vg 32 | -------------------------------------------------------------------------------- /test/shell/lvchange-mirror.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_dmeventd 15 | aux prepare_vg 3 16 | 17 | # force resync 2-way active mirror 18 | lvcreate -l2 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3":0-1 19 | check mirror $vg $lv1 "$dev3" 20 | echo y | lvchange --resync $vg/$lv1 21 | check mirror $vg $lv1 "$dev3" 22 | lvremove -ff $vg 23 | 24 | # force resync 2-way inactive mirror 25 | lvcreate -l2 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3":0-1 26 | lvchange -an $vg/$lv1 27 | check mirror $vg $lv1 "$dev3" 28 | lvchange --resync $vg/$lv1 29 | check mirror $vg $lv1 "$dev3" 30 | lvremove -ff $vg 31 | -------------------------------------------------------------------------------- /test/shell/lvconvert-mirror-basic-0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . ./shell/lvconvert-mirror-basic.sh 13 | test_many 0 14 | -------------------------------------------------------------------------------- /test/shell/lvconvert-mirror-basic-1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . ./shell/lvconvert-mirror-basic.sh 13 | test_many 1 14 | -------------------------------------------------------------------------------- /test/shell/lvconvert-mirror-basic-2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . ./shell/lvconvert-mirror-basic.sh 13 | test_many 2 14 | -------------------------------------------------------------------------------- /test/shell/lvconvert-mirror-basic-3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . ./shell/lvconvert-mirror-basic.sh 13 | test_many 3 14 | -------------------------------------------------------------------------------- /test/shell/lvconvert-repair-dmeventd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | which mkfs.ext2 || skip 15 | 16 | aux prepare_vg 5 17 | aux prepare_dmeventd 18 | 19 | lvcreate -m 3 --ig -L 1 -n 4way $vg 20 | lvchange --monitor y $vg/4way 21 | aux disable_dev "$dev2" "$dev4" 22 | mkfs.ext2 $DM_DEV_DIR/$vg/4way 23 | sleep 10 # FIXME: need a "poll" utility, akin to "check" 24 | aux enable_dev "$dev2" "$dev4" 25 | check mirror $vg 4way 26 | check mirror_legs $vg 4way 2 27 | 28 | vgremove -ff $vg 29 | -------------------------------------------------------------------------------- /test/shell/lvconvert-repair-snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 5 15 | aux lvmconf 'allocation/maximise_cling = 0' 16 | aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1' 17 | 18 | lvcreate -m 3 --ig -L 2M -n 4way $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5":0 19 | lvcreate -s $vg/4way -L 2M -n snap 20 | 21 | aux disable_dev "$dev2" "$dev4" 22 | echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out 23 | lvs -a -o +devices $vg | not grep unknown 24 | vgreduce --removemissing $vg 25 | aux enable_dev "$dev2" "$dev4" 26 | lvs -a -o +devices $vg 27 | check mirror $vg 4way "$dev5" 28 | -------------------------------------------------------------------------------- /test/shell/lvconvert-repair-transient-dmeventd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 5 15 | aux prepare_dmeventd 16 | 17 | lvcreate -m 3 --ig -L 1 -n 4way $vg 18 | lvchange --monitor y $vg/4way 19 | aux disable_dev "$dev2" "$dev4" 20 | mkfs.ext3 $DM_DEV_DIR/$vg/4way 21 | aux enable_dev "$dev2" "$dev4" 22 | sleep 3 23 | lvs -a -o +devices $vg | not grep unknown 24 | check mirror $vg 4way 25 | check mirror_legs $vg 4way 2 26 | lvs -a -o +devices $vg | not grep mimage_1 27 | lvs -a -o +devices $vg | not grep mimage_3 28 | 29 | vgremove -f $vg 30 | -------------------------------------------------------------------------------- /test/shell/lvconvert-repair-transient.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 5 15 | 16 | lvcreate -m 3 --ig -L 1 -n 4way $vg 17 | aux disable_dev "$dev2" "$dev4" 18 | mkfs.ext3 $DM_DEV_DIR/$vg/4way & 19 | sleep 1 20 | aux enable_dev "$dev2" "$dev4" 21 | echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out 22 | lvs -a -o +devices | not grep unknown 23 | vgreduce --removemissing $vg 24 | check mirror $vg 4way 25 | lvchange -a n $vg/4way 26 | wait 27 | 28 | vgremove -f $vg 29 | -------------------------------------------------------------------------------- /test/shell/lvconvert-thin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 4 | # 5 | # This copyrighted material is made available to anyone wishing to use, 6 | # modify, copy, or redistribute it subject to the terms and conditions 7 | # of the GNU General Public License v.2. 8 | # 9 | # You should have received a copy of the GNU General Public License 10 | # along with this program; if not, write to the Free Software Foundation, 11 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 | 13 | . lib/test 14 | 15 | # 16 | # Main 17 | # 18 | aux have_thin 1 0 0 || skip 19 | 20 | aux prepare_pvs 4 64 21 | 22 | vgcreate $vg -s 64K $(cat DEVICES) 23 | 24 | # create mirrored LVs for data and metadata volumes 25 | lvcreate -aey -l8 -m1 --mirrorlog core -n $lv1 $vg 26 | lvcreate -aey -l4 -m1 --mirrorlog core -n $lv2 $vg 27 | 28 | lvconvert -c 64K --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 29 | 30 | lvcreate -V10M -T $vg/$lv1 --name $lv3 31 | 32 | # check lvrename work properly 33 | lvrename $vg/$lv1 $vg/pool 34 | check lv_field $vg/pool name "pool" 35 | 36 | lvrename $vg/$lv3 $vg/$lv4 37 | check lv_field $vg/$lv4 name "$lv4" 38 | 39 | # not yet supported conversions 40 | not lvconvert -m 1 $vg/pool 41 | not lvconvert -m 1 $vg/$lv3 42 | 43 | vgremove -ff $vg 44 | -------------------------------------------------------------------------------- /test/shell/lvconvert-twostep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 4 15 | 16 | lvcreate -m 1 --mirrorlog disk --ig -L 1 -n mirror $vg 17 | not lvconvert -m 2 --mirrorlog core $vg/mirror "$dev3" 2>&1 | tee errs 18 | grep "two steps" errs 19 | 20 | lvconvert -m 2 $vg/mirror "$dev3" 21 | lvconvert --mirrorlog core $vg/mirror 22 | not lvconvert -m 1 --mirrorlog disk $vg/mirror "$dev3" 2>&1 | tee errs 23 | grep "two steps" errs 24 | 25 | not lvconvert -m 1 --mirrorlog mirrored $vg/mirror "$dev3" "$dev4" 2>&1 | tee errs 26 | grep "two steps" errs 27 | -------------------------------------------------------------------------------- /test/shell/lvcreate-large.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 'Exercise some lvcreate diagnostics' 13 | 14 | . lib/test 15 | 16 | aux prepare_vg 4 17 | 18 | lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 1024T 19 | 20 | #FIXME this should be 1024T 21 | #check lv_field $vg/$lv size "128.00m" 22 | 23 | aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]' 24 | 25 | pvcreate $DM_DEV_DIR/$vg/$lv 26 | vgcreate -c n $vg1 $DM_DEV_DIR/$vg/$lv 27 | 28 | lvcreate -l 100%FREE -n $lv1 $vg1 29 | check lv_field $vg1/$lv1 size "1024.00t" 30 | lvresize -f -l 72%VG $vg1/$lv1 31 | check lv_field $vg1/$lv1 size "737.28t" 32 | lvremove -ff $vg1/$lv1 33 | 34 | lvcreate -l 100%VG -n $lv1 $vg1 35 | check lv_field $vg1/$lv1 size "1024.00t" 36 | lvresize -f -l 72%VG $vg1/$lv1 37 | check lv_field $vg1/$lv1 size "737.28t" 38 | lvremove -ff $vg1/$lv1 39 | 40 | lvremove -ff $vg/$lv 41 | -------------------------------------------------------------------------------- /test/shell/lvcreate-raid10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | ######################################################## 15 | # MAIN 16 | ######################################################## 17 | aux target_at_least dm-raid 1 3 0 || skip 18 | 19 | aux prepare_pvs 6 20 # 6 devices for RAID10 (2-mirror,3-stripe) test 20 | vgcreate -c n -s 512k $vg $(cat DEVICES) 21 | 22 | # 23 | # Create RAID10: 24 | # 25 | 26 | 27 | # Should not allow more than 2-way mirror 28 | not lvcreate --type raid10 -m 2 -i 2 -l 2 -n $lv1 $vg 29 | 30 | # 2-way mirror, 2-stripes 31 | lvcreate --type raid10 -m 1 -i 2 -l 2 -n $lv1 $vg 32 | aux wait_for_sync $vg $lv1 33 | lvremove -ff $vg 34 | 35 | # 2-way mirror, 3-stripes 36 | lvcreate --type raid10 -m 1 -i 3 -l 3 -n $lv1 $vg 37 | aux wait_for_sync $vg $lv1 38 | lvremove -ff $vg 39 | 40 | # 41 | # FIXME: Add tests that specify particular PVs to use for creation 42 | # 43 | -------------------------------------------------------------------------------- /test/shell/lvcreate-small-snap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_pvs 3 15 | 16 | vgcreate -c n -s 1k $vg $(cat DEVICES) 17 | 18 | lvcreate -n one -l 10 $vg 19 | lvcreate -s -l 8 -n snapA $vg/one 20 | lvcreate -s -c 4k -l 8 -n snapX1 $vg/one 21 | lvcreate -s -c 8k -l 16 -n snapX2 $vg/one 22 | 23 | # Check that snapshots that are too small are caught with correct error. 24 | not lvcreate -s -c 8k -l 8 -n snapX3 $vg/one 2>&1 | tee lvcreate.out 25 | not grep "suspend origin one" lvcreate.out 26 | grep "Unable to create a snapshot" lvcreate.out 27 | 28 | not lvcreate -s -l 4 -n snapB $vg/one 2>&1 | tee lvcreate.out 29 | not grep "suspend origin one" lvcreate.out 30 | grep "Unable to create a snapshot" lvcreate.out 31 | -------------------------------------------------------------------------------- /test/shell/lvcreate-thin-power2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 4 | # 5 | # This copyrighted material is made available to anyone wishing to use, 6 | # modify, copy, or redistribute it subject to the terms and conditions 7 | # of the GNU General Public License v.2. 8 | # 9 | # You should have received a copy of the GNU General Public License 10 | # along with this program; if not, write to the Free Software Foundation, 11 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 | # 13 | # test support for non-power-of-2 thin chunk size 14 | # 15 | 16 | . lib/test 17 | 18 | # 19 | # Main 20 | # 21 | aux have_thin 1 4 0 || skip 22 | 23 | aux prepare_pvs 2 64 24 | 25 | vgcreate $vg -s 64K $(cat DEVICES) 26 | 27 | # create non-power-of-2 pool 28 | lvcreate -l100 -c 192 -T $vg/pool 29 | 30 | check lv_field $vg/pool discards "ignore" 31 | 32 | # check we cannot change discards settings 33 | not lvchange --discard passdown $vg/pool 34 | not lvchange --discard nopassdown $vg/pool 35 | 36 | # must be multiple of 64KB 37 | not lvcreate -l100 -c 168 -T $vg/pool1 38 | 39 | vgremove -ff $vg 40 | -------------------------------------------------------------------------------- /test/shell/lvextend-snapshot-policy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | which mkfs.ext2 || skip 15 | 16 | extend() { 17 | lvextend --use-policies --config "activation { snapshot_autoextend_threshold = $1 }" $vg/snap 18 | } 19 | 20 | write() { 21 | mount "$DM_DEV_DIR/$vg/snap" mnt 22 | dd if=/dev/zero of="mnt/file$1" bs=1k count=$2 23 | umount mnt 24 | } 25 | 26 | percent() { 27 | get lv_field $vg/snap snap_percent | cut -d. -f1 28 | } 29 | 30 | aux prepare_dmeventd 31 | aux prepare_vg 2 32 | 33 | lvcreate -l 8 -n base $vg 34 | mkfs.ext2 "$DM_DEV_DIR/$vg/base" 35 | 36 | lvcreate -s -l 4 -n snap $vg/base 37 | mkdir mnt 38 | 39 | write 1 4096 40 | pre=$(percent) 41 | extend 50 42 | test $pre -eq $(percent) 43 | 44 | write 2 4096 45 | pre=$(percent) 46 | extend 50 47 | test $pre -gt $(percent) 48 | 49 | vgremove -f $vg 50 | -------------------------------------------------------------------------------- /test/shell/lvm-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 13 | # tests lvm initialization, and especially negative tests of error paths 14 | # 15 | 16 | . lib/test 17 | 18 | aux prepare_devs 5 19 | 20 | # invalid units 21 | not pvs --config 'global { units = "<" }' 22 | -------------------------------------------------------------------------------- /test/shell/lvmcache-exercise.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_pvs 5 15 | 16 | vgcreate $vg1 "$dev1" 17 | vgcreate $vg2 "$dev3" 18 | 19 | aux disable_dev "$dev1" 20 | pvscan 21 | vgcreate $vg1 "$dev2" 22 | aux enable_dev "$dev1" 23 | pvs 24 | -------------------------------------------------------------------------------- /test/shell/lvmetad-disabled.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | test -e LOCAL_LVMETAD || skip 15 | kill $(cat LOCAL_LVMETAD) 16 | 17 | test -e $LVMETAD_PIDFILE && skip 18 | lvmetad 19 | test -e $LVMETAD_PIDFILE 20 | cp $LVMETAD_PIDFILE LOCAL_LVMETAD 21 | pvs 2>&1 | not grep "lvmetad is running" 22 | aux lvmconf "global/use_lvmetad = 0" 23 | pvs 2>&1 | grep "lvmetad is running" 24 | 25 | kill $(cat $LVMETAD_PIDFILE) 26 | not ls $LVMETAD_PIDFILE 27 | -------------------------------------------------------------------------------- /test/shell/lvmetad-dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | test -e LOCAL_LVMETAD || skip 14 | 15 | aux prepare_pvs 2 16 | vgcreate $vg1 $dev1 $dev2 17 | lvcreate -n bar -l 1 $vg1 18 | 19 | lvmetad_talk() { 20 | if type -p socat >& /dev/null; then 21 | socat "unix-connect:$1" - 22 | elif echo | nc -U "$1"; then 23 | nc -U "$1" 24 | else 25 | echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2 26 | echo "# DUMP FAILED" 27 | return 1 28 | fi 29 | } 30 | 31 | lvmetad_dump() { 32 | (echo 'request="dump"'; echo '##') | lvmetad_talk "$@" 33 | } 34 | 35 | (echo | lvmetad_talk ./lvmetad.socket) || skip 36 | lvmetad_dump ./lvmetad.socket | tee lvmetad.txt 37 | 38 | grep $vg1 lvmetad.txt 39 | -------------------------------------------------------------------------------- /test/shell/lvmetad-lvm1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | test -e LOCAL_LVMETAD || skip 15 | aux prepare_devs 2 16 | pvcreate --metadatatype 1 $dev1 17 | vgscan --cache 18 | pvs | grep $dev1 19 | vgcreate --metadatatype 1 $vg1 $dev1 20 | vgscan --cache 21 | vgs | grep $vg1 22 | pvs | grep $dev1 23 | -------------------------------------------------------------------------------- /test/shell/lvmetad-pvs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_pvs 1 20000 15 | pvs $(cat DEVICES) | grep "$dev1" 16 | 17 | # check for PV size overflows 18 | pvs $(cat DEVICES) | grep 19.53g 19 | pvs $(cat DEVICES) | not grep 16.00e 20 | -------------------------------------------------------------------------------- /test/shell/lvmetad-pvscan-cache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | test -e LOCAL_LVMETAD || skip 15 | 16 | aux prepare_pvs 2 17 | 18 | vgcreate $vg1 $dev1 $dev2 19 | vgs | grep $vg1 20 | 21 | pvscan --cache 22 | 23 | vgs | grep $vg1 24 | -------------------------------------------------------------------------------- /test/shell/lvmetad-restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | test -e LOCAL_LVMETAD || skip 15 | aux prepare_pvs 2 16 | 17 | vgcreate $vg1 $dev1 $dev2 18 | vgs | grep $vg1 19 | 20 | kill $(cat LOCAL_LVMETAD) 21 | aux prepare_lvmetad 22 | 23 | vgs | grep $vg1 24 | -------------------------------------------------------------------------------- /test/shell/lvmetad-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_pvs 2 15 | 16 | vgcreate $vg1 $dev1 $dev2 --test 17 | vgs | not grep $vg1 18 | vgcreate $vg1 $dev1 $dev2 19 | vgs | grep $vg1 20 | 21 | lvcreate -n bar -l 1 $vg1 --test 22 | lvs | not grep bar 23 | lvcreate -n bar -l 1 $vg1 24 | lvs | grep bar 25 | 26 | lvremove $vg1/bar -f --test 27 | lvs | grep bar 28 | lvremove $vg1/bar -f 29 | lvs | not grep bar 30 | 31 | vgremove $vg1 --test 32 | vgs | grep $vg1 33 | vgremove $vg1 34 | vgs | not grep $vg1 35 | -------------------------------------------------------------------------------- /test/shell/lvmetad-warning.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | test -e LOCAL_LVMETAD || skip 15 | aux prepare_pvs 2 16 | 17 | vgcreate $vg1 $dev1 $dev2 18 | lvchange -ay $vg1 2>&1 | not grep "Failed to connect" 19 | kill $(cat LOCAL_LVMETAD) 20 | lvchange -ay $vg1 2>&1 | grep "Failed to connect" 21 | lvchange -ay $vg1 --sysinit 2>&1 | not grep "Failed to connect" 22 | aux lvmconf 'global/use_lvmetad = 0' 23 | lvchange -ay $vg1 2>&1 | not grep "Failed to connect" 24 | lvchange -ay $vg1 --sysinit 2>&1 | not grep "Failed to connect" 25 | aux prepare_lvmetad 26 | lvchange -ay $vg1 2>&1 | not grep "Failed to connect" 27 | lvchange -ay $vg1 --sysinit 2>&1 | not grep "Failed to connect" 28 | -------------------------------------------------------------------------------- /test/shell/lvresize-mirror.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 5 80 15 | 16 | # extend 2-way mirror 17 | lvcreate -l2 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3":0-1 18 | lvchange -an $vg/$lv1 19 | lvextend -l+2 $vg/$lv1 20 | check mirror $vg $lv1 "$dev3" 21 | check mirror_images_contiguous $vg $lv1 22 | lvremove -ff $vg 23 | 24 | # reduce 2-way mirror 25 | lvcreate -l4 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3":0-1 26 | lvchange -an $vg/$lv1 27 | lvreduce -l-2 $vg/$lv1 28 | check mirror $vg $lv1 "$dev3" 29 | lvremove -ff $vg 30 | 31 | # extend 2-way mirror (cling if not contiguous) 32 | lvcreate -l2 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3":0-1 33 | lvcreate -l1 -n $lv2 $vg "$dev1" 34 | lvcreate -l1 -n $lv3 $vg "$dev2" 35 | lvchange -an $vg/$lv1 36 | lvextend -l+2 $vg/$lv1 37 | check mirror $vg $lv1 "$dev3" 38 | check mirror_images_clung $vg $lv1 39 | lvremove -ff $vg 40 | -------------------------------------------------------------------------------- /test/shell/lvresize-raid10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux target_at_least dm-raid 1 3 0 || skip 15 | 16 | aux prepare_vg 5 80 17 | 18 | # Extend RAID10 (2-stripes, 2-mirror) 19 | for deactivate in true false; do 20 | lvcreate --type raid10 -m 1 -i 2 -l 2 -n $lv1 $vg 21 | 22 | if $deactivate; then 23 | lvchange -an $vg/$lv1 24 | fi 25 | 26 | lvresize -l +2 $vg/$lv1 27 | 28 | #check raid_images_contiguous $vg $lv1 29 | 30 | lvremove -ff $vg 31 | done 32 | 33 | # Reduce RAID10 (2-stripes, 2-mirror) 34 | for deactivate in true false; do 35 | lvcreate --type raid10 -m 1 -i 2 -l 4 -n $lv1 $vg 36 | 37 | if $deactivate; then 38 | lvchange -an $vg/$lv1 39 | fi 40 | 41 | should lvresize -y -l -2 $vg/$lv1 42 | 43 | #check raid_images_contiguous $vg $lv1 44 | 45 | lvremove -ff $vg 46 | done 47 | -------------------------------------------------------------------------------- /test/shell/lvresize-usage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 2 15 | 16 | lvcreate -L 10M -n lv -i2 $vg 17 | lvresize -l +4 $vg/lv 18 | lvremove -ff $vg 19 | 20 | lvcreate -L 64M -n $lv -i2 $vg 21 | not lvresize -v -l +4 xxx/$lv 22 | -------------------------------------------------------------------------------- /test/shell/pv-duplicate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 'Exercise duplicate metadata diagnostics' 13 | 14 | . lib/test 15 | 16 | aux prepare_devs 3 17 | 18 | vgcreate -c n --metadatasize 128k $vg1 "$dev1" 19 | 20 | # copy mda 21 | dd if="$dev1" of="$dev2" bs=256K count=1 22 | dd if="$dev1" of="$dev3" bs=256K count=1 23 | 24 | pvs "$dev1" 25 | vgs $vg1 26 | -------------------------------------------------------------------------------- /test/shell/pv-min-size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | # use small default size - 512KB 15 | aux lvmconf 'devices/pv_min_size = 512' 16 | 17 | aux prepare_pvs 1 8 18 | 19 | check pv_field "$dev1" pv_name "$dev1" 20 | 21 | # increase min size beyond created PV size 10MB 22 | aux lvmconf 'devices/pv_min_size = 10240' 23 | 24 | # and test device is not visible 25 | not check pv_field "$dev1" pv_name "$dev1" 26 | 27 | # set too low value errornous value 28 | aux lvmconf 'devices/pv_min_size = -100' 29 | 30 | # check the incorrect value is printed 31 | pvs "$dev1" 2>&1 | grep -- -100 32 | -------------------------------------------------------------------------------- /test/shell/pv-range-overflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 'Ensure that pvmove diagnoses PE-range values 2^32 and larger.' 13 | 14 | . lib/test 15 | 16 | aux prepare_vg 2 17 | 18 | lvcreate -L4 -n"$lv" $vg 19 | 20 | # Test for the bogus diagnostic reported in BZ 284771 21 | # http://bugzilla.redhat.com/284771. 22 | # 'run pvmove with an unrecognized LV name to show bad diagnostic' 23 | not pvmove -v -nbogus "$dev1" "$dev2" 2> err 24 | grep "Logical volume bogus not found." err 25 | 26 | # With lvm-2.02.28 and earlier, on a system with 64-bit "long int", 27 | # the PE range parsing code would accept values up to 2^64-1, but would 28 | # silently truncate them to int32_t. I.e., $dev1:$(echo 2^32|bc) would be 29 | # treated just like $dev1:0. 30 | # 'run the offending pvmove command' 31 | not pvmove -v -n$lv "$dev1":4294967296 "$dev2" 32 | 33 | -------------------------------------------------------------------------------- /test/shell/pvcreate-metadata0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 13 | # Testcase for bugzilla #450651 14 | # also checks that vgremove properly removes all lv devices in the right order 15 | # 16 | # 'Test pvcreate without metadata on all pvs' 17 | 18 | . lib/test 19 | 20 | aux prepare_devs 2 128 21 | 22 | #lv_snap=$lv2 23 | pvcreate "$dev1" 24 | pvcreate --metadatacopies 0 "$dev2" 25 | 26 | # "check lv snapshot" 27 | vgcreate -c n $vg "$dev1" "$dev2" 28 | lvcreate -n $lv -l 60%FREE $vg 29 | lvcreate -s -n $lv2 -l 10%FREE $vg/$lv 30 | pvdisplay 31 | lvdisplay 32 | vgremove -f $vg 33 | -------------------------------------------------------------------------------- /test/shell/snapshot-autoumount-dmeventd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # no automatic extensions please 13 | 14 | . lib/test 15 | 16 | which mkfs.ext2 || skip 17 | 18 | aux lvmconf "activation/snapshot_autoextend_percent = 0" \ 19 | "activation/snapshot_autoextend_threshold = 100" 20 | 21 | aux prepare_dmeventd 22 | aux prepare_vg 2 23 | mntdir="${PREFIX}mnt" 24 | 25 | lvcreate -l 8 -n base $vg 26 | mkfs.ext2 "$DM_DEV_DIR/$vg/base" 27 | 28 | lvcreate -s -l 4 -n snap $vg/base 29 | lvchange --monitor y $vg/snap 30 | 31 | mkdir "$mntdir" 32 | mount "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir" 33 | mount 34 | cat /proc/mounts | grep "$mntdir" 35 | dd if=/dev/zero of="$mntdir/file$1" bs=1M count=16 36 | sync 37 | #dmeventd only checks every 10 seconds :( 38 | for i in {1..10}; do 39 | cat /proc/mounts | grep "$mntdir" || break 40 | sleep 1 41 | done 42 | 43 | cat /proc/mounts | not grep "$mntdir" 44 | 45 | vgremove -f $vg 46 | -------------------------------------------------------------------------------- /test/shell/snapshots-of-mirrors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 4 15 | 16 | # Attempt to create snapshot of a mirror origin - should fail 17 | lvcreate -m 1 -L 10M -n lv $vg 18 | 19 | lvcreate -s $vg/lv -L 10M -n snap 20 | 21 | # Down-convert (mirror -> linear) under a snapshot 22 | lvconvert -m0 $vg/lv 23 | 24 | # Up-convert (linear -> mirror) 25 | lvconvert -m2 $vg/lv 26 | 27 | # Down-convert (mirror -> mirror) 28 | lvconvert -m1 $vg/lv 29 | 30 | # Up-convert (mirror -> mirror) -- Not supported! 31 | not lvconvert -m2 $vg/lv 32 | 33 | # Log conversion (disk -> core) 34 | lvconvert --mirrorlog core $vg/lv 35 | 36 | # Log conversion (core -> mirrored) 37 | lvconvert --mirrorlog mirrored $vg/lv 38 | 39 | # Log conversion (mirrored -> core) 40 | lvconvert --mirrorlog core $vg/lv 41 | 42 | # Log conversion (core -> disk) 43 | lvconvert --mirrorlog disk $vg/lv 44 | 45 | ## Clean-up 46 | vgremove -f $vg 47 | -------------------------------------------------------------------------------- /test/shell/test-partition.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | # 13 | # Testcase for bugzilla #621173 14 | # excercises partition table scanning code path 15 | # 16 | 17 | 18 | LVM_TEST_CONFIG_DEVICES="types = [\"device-mapper\", 142]" 19 | 20 | . lib/test 21 | 22 | which sfdisk || skip 23 | 24 | aux prepare_pvs 1 30 25 | 26 | pvs "$dev1" 27 | 28 | # create small partition table 29 | echo "1 2" | sfdisk "$dev1" 30 | 31 | pvs "$dev1" 32 | -------------------------------------------------------------------------------- /test/shell/unknown-segment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2009 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 4 15 | 16 | lvcreate -l 1 -n $lv1 $vg 17 | lvcreate -l 2 -m 1 -n $lv2 $vg 18 | 19 | vgcfgbackup -f bak0 $vg 20 | sed -e 's,striped,unstriped,;s,mirror,unmirror,' -i.orig bak0 21 | vgcfgrestore -f bak0 $vg 22 | 23 | # we have on-disk metadata with unknown segments now 24 | not lvchange -a y $vg/$lv1 # check that activation is refused 25 | 26 | vgcfgbackup -f bak1 $vg 27 | cat bak1 28 | sed -e 's,unstriped,striped,;s,unmirror,mirror,' -i.orig bak1 29 | vgcfgrestore -f bak1 $vg 30 | vgcfgbackup -f bak2 $vg 31 | 32 | egrep -v 'description|seqno|creation_time|Generated' < bak0.orig > a 33 | egrep -v 'description|seqno|creation_time|Generated' < bak2 > b 34 | diff -u a b 35 | -------------------------------------------------------------------------------- /test/shell/vgchange-maxlv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_dmeventd 15 | aux prepare_pvs 3 16 | 17 | vgcreate -c n -l 2 $vg $(cat DEVICES) 18 | lvcreate -n one -l 1 $vg 19 | lvcreate -n two -l 1 $vg 20 | not lvcreate -n three -l 1 $vg 21 | vgremove -ff $vg 22 | 23 | vgcreate -c n -l 3 $vg $(cat DEVICES) 24 | lvcreate -n one -l 1 $vg 25 | lvcreate -n snap -s -l 1 $vg/one 26 | lvcreate -n two -l 1 $vg 27 | not lvcreate -n three -l 1 $vg 28 | vgchange --monitor y $vg 29 | vgchange -an $vg 2>&1 | tee vgchange.out 30 | not grep "event server" vgchange.out 31 | -------------------------------------------------------------------------------- /test/shell/vgchange-partial.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 2 15 | 16 | aux disable_dev "$dev1" 17 | 18 | # 19 | # Test for allowable metadata changes 20 | # addtag_ARG 21 | # deltag_ARG 22 | vgchange --addtag foo $vg 23 | vgchange --deltag foo $vg 24 | 25 | # 26 | # Test for disallowed metadata changes 27 | # 28 | # maxphysicalvolumes_ARG 29 | not vgchange -p 10 $vg 30 | 31 | # resizeable_ARG 32 | not vgchange -x n $vg 33 | 34 | # uuid_ARG 35 | not vgchange -u $vg 36 | 37 | # physicalextentsize_ARG 38 | not vgchange -s 2M $vg 39 | 40 | # clustered_ARG 41 | not vgchange -c y $vg 42 | 43 | # alloc_ARG 44 | not vgchange --alloc anywhere $vg 45 | 46 | # vgmetadatacopies_ARG 47 | not vgchange --vgmetadatacopies 2 $vg 48 | 49 | # 50 | # Ensure that allowed args don't cause disallowed args to get through 51 | # 52 | not vgchange -p 10 --addtag foo $vg 53 | -------------------------------------------------------------------------------- /test/shell/vgextend-restoremissing.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_vg 3 15 | 16 | lvcreate -m 1 -l 1 -n mirror $vg 17 | lvchange -a n $vg/mirror 18 | lvcreate -l 1 -n lv1 $vg "$dev1" 19 | 20 | # try to just change metadata; we expect the new version (with MISSING_PV set 21 | # on the reappeared volume) to be written out to the previously missing PV 22 | aux disable_dev "$dev1" 23 | lvremove $vg/mirror 24 | aux enable_dev "$dev1" 25 | not vgck $vg 2>&1 | tee log 26 | grep "missing 1 physical volume" log 27 | not lvcreate -m 1 -l 1 -n mirror $vg # write operations fail 28 | vgextend --restore $vg "$dev1" # restore the missing device 29 | vgck $vg 30 | lvcreate -m 1 -l 1 -n mirror $vg 31 | -------------------------------------------------------------------------------- /test/shell/vgreduce-removemissing-snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | exit 0 15 | 16 | # 17 | # Snapshots of 'mirrors' are not supported. They can no longer be created. 18 | # This file could be used to test some aspect of vgreduce, snapshot, and 19 | # RAID at some point though... 20 | # 21 | 22 | aux prepare_vg 5 23 | 24 | lvcreate -m 3 --ig -L 2M -n 4way $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5":0 25 | lvcreate -s $vg/4way -L 2M -n snap 26 | lvcreate -i 2 -L 2M $vg "$dev1" "$dev2" -n stripe 27 | 28 | aux disable_dev "$dev2" "$dev4" 29 | echo n | lvconvert --repair $vg/4way 30 | aux enable_dev "$dev2" "$dev4" 31 | #not vgreduce --removemissing $vg 32 | vgreduce -v --removemissing --force $vg # "$dev2" "$dev4" 33 | lvs -a -o +devices $vg | not grep unknown 34 | lvs -a -o +devices $vg 35 | check mirror $vg 4way "$dev5" 36 | -------------------------------------------------------------------------------- /test/shell/vgrename-usage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux prepare_devs 4 15 | pvcreate "$dev1" "$dev2" 16 | pvcreate --metadatacopies 0 "$dev3" "$dev4" 17 | 18 | # vgrename normal operation - rename vg1 to vg2 19 | # vgrename normal operation - rename vg2 to vg1 20 | # ensure name ordering does not matter 21 | vgcreate $vg1 "$dev1" "$dev2" 22 | vgrename $vg1 $vg2 23 | check vg_field $vg2 vg_name $vg2 24 | vgrename $vg2 $vg1 25 | check vg_field $vg1 vg_name $vg1 26 | vgremove $vg1 27 | 28 | # vgrename by uuid (bz231187) 29 | vgcreate $vg1 "$dev1" "$dev3" 30 | UUID=$(vgs --noheading -o vg_uuid $vg1) 31 | check vg_field $vg1 vg_uuid $UUID 32 | vgrename $UUID $vg2 33 | check vg_field $vg2 vg_name $vg2 34 | vgremove $vg2 35 | 36 | # vgrename fails - new vg already exists 37 | vgcreate $vg1 "$dev1" 38 | vgcreate $vg2 "$dev2" 39 | not vgrename $vg1 $vg2 40 | vgremove $vg1 $vg2 41 | -------------------------------------------------------------------------------- /test/shell/vgsplit-stacked.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Red Hat, Inc. All rights reserved. 3 | # 4 | # This copyrighted material is made available to anyone wishing to use, 5 | # modify, copy, or redistribute it subject to the terms and conditions 6 | # of the GNU General Public License v.2. 7 | # 8 | # You should have received a copy of the GNU General Public License 9 | # along with this program; if not, write to the Free Software Foundation, 10 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 | 12 | . lib/test 13 | 14 | aux lvmconf 'devices/filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]' 15 | aux prepare_pvs 3 16 | 17 | vgcreate $vg1 "$dev1" "$dev2" 18 | lvcreate -n $lv1 -l 100%FREE $vg1 19 | 20 | #top VG 21 | pvcreate $DM_DEV_DIR/$vg1/$lv1 22 | vgcreate $vg $DM_DEV_DIR/$vg1/$lv1 "$dev3" 23 | 24 | vgchange -a n $vg $vg1 25 | 26 | # this should fail but not segfault, RHBZ 481793. 27 | not vgsplit $vg $vg1 "$dev3" 28 | -------------------------------------------------------------------------------- /test/unit/Makefile.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved. 2 | # 3 | # This file is part of LVM2. 4 | # 5 | # This copyrighted material is made available to anyone wishing to use, 6 | # modify, copy, or redistribute it subject to the terms and conditions 7 | # of the GNU General Public License v.2. 8 | # 9 | # You should have received a copy of the GNU General Public License 10 | # along with this program; if not, write to the Free Software Foundation, 11 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 | 13 | srcdir = @srcdir@ 14 | top_srcdir = @top_srcdir@ 15 | top_builddir = @top_builddir@ 16 | 17 | VPATH = $(srcdir) 18 | ifeq ("@TESTING@", "yes") 19 | SOURCES = bitset_t.c matcher_t.c config_t.c string_t.c run.c 20 | TARGETS = run 21 | endif 22 | 23 | include $(top_builddir)/make.tmpl 24 | ifeq ("$(TESTING)", "yes") 25 | LDLIBS += -ldevmapper @CUNIT_LIBS@ 26 | CFLAGS += @CUNIT_CFLAGS@ 27 | 28 | check: unit 29 | 30 | unit: $(TARGETS) 31 | @echo Running unit tests 32 | LD_LIBRARY_PATH=$(top_builddir)/libdm ./$(TARGETS) 33 | endif 34 | -------------------------------------------------------------------------------- /test/unit/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define DECL(n) \ 5 | extern CU_TestInfo n ## _list[]; \ 6 | int n ## _init(void); \ 7 | int n ## _fini(void); 8 | #define USE(n) { (char*) #n, n##_init, n##_fini, n##_list } 9 | 10 | DECL(bitset); 11 | DECL(regex); 12 | DECL(config); 13 | DECL(string); 14 | 15 | CU_SuiteInfo suites[] = { 16 | USE(bitset), 17 | USE(regex), 18 | USE(config), 19 | USE(string), 20 | CU_SUITE_INFO_NULL 21 | }; 22 | 23 | int main(int argc, char **argv) { 24 | CU_initialize_registry(); 25 | CU_register_suites(suites); 26 | CU_basic_set_mode(CU_BRM_VERBOSE); 27 | CU_basic_run_tests(); 28 | return CU_get_number_of_failures() != 0; 29 | } 30 | -------------------------------------------------------------------------------- /tools/.exported_symbols: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steven676/lvm2/ea6a8078b41df75344aecff4c54aab9c78b67193/tools/.exported_symbols -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | .commands 2 | dmsetup 3 | lvm 4 | -------------------------------------------------------------------------------- /tools/cmdnames.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #define xx(a, b, c...) a 17 | 18 | #include "commands.h" 19 | -------------------------------------------------------------------------------- /tools/dumpconfig.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int dumpconfig(struct cmd_context *cmd, int argc, char **argv) 19 | { 20 | const char *file = arg_str_value(cmd, file_ARG, NULL); 21 | 22 | if (!config_write(cmd->cft, file, argc, argv)) { 23 | stack; 24 | return ECMD_FAILED; 25 | } 26 | 27 | return ECMD_PROCESSED; 28 | } 29 | -------------------------------------------------------------------------------- /tools/formats.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int formats(struct cmd_context *cmd, int argc __attribute__((unused)), 19 | char **argv __attribute__((unused))) 20 | { 21 | display_formats(cmd); 22 | 23 | return ECMD_PROCESSED; 24 | } 25 | -------------------------------------------------------------------------------- /tools/lvextend.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int lvextend(struct cmd_context *cmd, int argc, char **argv) 19 | { 20 | return lvresize(cmd, argc, argv); 21 | } 22 | -------------------------------------------------------------------------------- /tools/lvm-static.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU General Public License v.2. 10 | * 11 | * You should have received a copy of the GNU General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | #include "lvm2cmdline.h" 18 | 19 | int main(int argc, char **argv) 20 | { 21 | init_is_static(1); 22 | return lvm2_main(argc, argv); 23 | } 24 | 25 | int lvm_shell(struct cmd_context *cmd __attribute__((unused)), 26 | struct cmdline_context *cmdline __attribute__((unused))) 27 | { 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tools/lvm2cmd-static.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #include "lvm2cmdline.h" 16 | #include "lvm2cmd.h" 17 | 18 | void *lvm2_init(void) 19 | { 20 | return cmdlib_lvm2_init(1); 21 | } 22 | -------------------------------------------------------------------------------- /tools/lvm2cmd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. 3 | * 4 | * This file is part of LVM2. 5 | * 6 | * This copyrighted material is made available to anyone wishing to use, 7 | * modify, copy, or redistribute it subject to the terms and conditions 8 | * of the GNU Lesser General Public License v.2.1. 9 | * 10 | * You should have received a copy of the GNU Lesser General Public License 11 | * along with this program; if not, write to the Free Software Foundation, 12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | */ 14 | 15 | #include "lvm2cmdline.h" 16 | #include "lvm2cmd.h" 17 | 18 | void *lvm2_init(void) 19 | { 20 | return cmdlib_lvm2_init(0); 21 | } 22 | 23 | int lvm_shell(struct cmd_context *cmd __attribute__((unused)), 24 | struct cmdline_context *cmdline __attribute__((unused))) 25 | { 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /tools/lvmchange.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int lvmchange(struct cmd_context *cmd __attribute__((unused)), 19 | int argc __attribute__((unused)), char **argv __attribute__((unused))) 20 | { 21 | log_error("With LVM2 and the device mapper, this program is obsolete."); 22 | return ECMD_FAILED; 23 | } 24 | -------------------------------------------------------------------------------- /tools/lvreduce.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int lvreduce(struct cmd_context *cmd, int argc, char **argv) 19 | { 20 | return lvresize(cmd, argc, argv); 21 | } 22 | -------------------------------------------------------------------------------- /tools/segtypes.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | int segtypes(struct cmd_context *cmd, int argc __attribute__((unused)), 19 | char **argv __attribute__((unused))) 20 | { 21 | display_segtypes(cmd); 22 | 23 | return ECMD_PROCESSED; 24 | } 25 | -------------------------------------------------------------------------------- /tools/vgmknodes.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 | * 5 | * This file is part of LVM2. 6 | * 7 | * This copyrighted material is made available to anyone wishing to use, 8 | * modify, copy, or redistribute it subject to the terms and conditions 9 | * of the GNU Lesser General Public License v.2.1. 10 | * 11 | * You should have received a copy of the GNU Lesser General Public License 12 | * along with this program; if not, write to the Free Software Foundation, 13 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | */ 15 | 16 | #include "tools.h" 17 | 18 | static int _vgmknodes_single(struct cmd_context *cmd, struct logical_volume *lv, 19 | void *handle __attribute__((unused))) 20 | { 21 | if (arg_count(cmd, refresh_ARG) && lv_is_visible(lv)) 22 | if (!lv_refresh(cmd, lv)) { 23 | stack; 24 | return ECMD_FAILED; 25 | } 26 | 27 | if (!lv_mknodes(cmd, lv)) { 28 | stack; 29 | return ECMD_FAILED; 30 | } 31 | 32 | return ECMD_PROCESSED; 33 | } 34 | 35 | int vgmknodes(struct cmd_context *cmd, int argc, char **argv) 36 | { 37 | if (!lv_mknodes(cmd, NULL)) { 38 | stack; 39 | return ECMD_FAILED; 40 | } 41 | 42 | return process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL, 43 | &_vgmknodes_single); 44 | } 45 | -------------------------------------------------------------------------------- /udev/69-dm-lvm-metad.rules.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 Red Hat, Inc. All rights reserved. 2 | # 3 | # This file is part of LVM2. 4 | 5 | # Udev rules for LVM. 6 | # 7 | # Scan all block devices having a PV label for LVM metadata. 8 | # Store this information in LVMetaD (the LVM metadata daemon) and maintain LVM 9 | # metadata state for improved performance by avoiding further scans while 10 | # running subsequent LVM commands or while using lvm2app library. 11 | # Also, notify LVMetaD about any relevant block device removal. 12 | # 13 | # This rule is essential for having the information in LVMetaD up-to-date. 14 | # It also requires blkid to be called on block devices before so only devices 15 | # used as LVM PVs are processed (ID_FS_TYPE="LVM2_member" or "LVM1_member"). 16 | 17 | SUBSYSTEM!="block", GOTO="lvm_end" 18 | (LVM_EXEC_RULE) 19 | 20 | # Device-mapper devices are processed only on change event or on supported synthesized event. 21 | KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end" 22 | 23 | # Only process devices already marked as a PV - this requires blkid to be called before. 24 | ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="(LVM_EXEC)/lvm pvscan --cache --activate ay --major $major --minor $minor" 25 | 26 | LABEL="lvm_end" 27 | -------------------------------------------------------------------------------- /udev/95-dm-notify.rules.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Red Hat, Inc. All rights reserved. 2 | # 3 | # This file is part of LVM2. 4 | 5 | # Udev rules for device-mapper devices. 6 | # 7 | # These rules are responsible for sending a notification to a process 8 | # waiting for completion of udev rules. The process is identified by 9 | # a cookie value sent within "change" and "remove" events (the cookie 10 | # value is set before by that process for every action requested). 11 | 12 | ENV{DM_COOKIE}=="?*", RUN+="(DM_EXEC)/dmsetup udevcomplete $env{DM_COOKIE}" 13 | -------------------------------------------------------------------------------- /unit-tests/datastruct/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES=\ 20 | bitset_t.c 21 | 22 | TARGETS=\ 23 | bitset_t 24 | 25 | include $(top_builddir)/make.tmpl 26 | 27 | INCLUDES += -I$(top_srcdir)/libdm 28 | DM_DEPS = $(top_builddir)/libdm/libdevmapper.so 29 | DM_LIBS = -ldevmapper $(LIBS) 30 | 31 | bitset_t: bitset_t.o $(DM_DEPS) 32 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ bitset_t.o $(DM_LIBS) 33 | -------------------------------------------------------------------------------- /unit-tests/datastruct/TESTS: -------------------------------------------------------------------------------- 1 | bitset iteration:$TEST_TOOL ./bitset_t -------------------------------------------------------------------------------- /unit-tests/mm/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | VPATH = @srcdir@ 19 | 20 | SOURCES=\ 21 | pool_valgrind_t.c 22 | 23 | TARGETS=\ 24 | pool_valgrind_t 25 | 26 | include $(top_builddir)/make.tmpl 27 | DM_LIBS = -ldevmapper $(LIBS) 28 | 29 | pool_valgrind_t: pool_valgrind_t.o 30 | $(CC) $(CFLAGS) -o $@ pool_valgrind_t.o $(LDFLAGS) $(DM_LIBS) 31 | 32 | -------------------------------------------------------------------------------- /unit-tests/mm/TESTS: -------------------------------------------------------------------------------- 1 | valgrind pool awareness:valgrind ./pool_valgrind_t 2>&1 | ./check_results 2 | -------------------------------------------------------------------------------- /unit-tests/mm/check_results: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby1.9 2 | 3 | require 'pp' 4 | 5 | patterns = [ 6 | /Invalid read of size 1/, 7 | /Invalid write of size 1/, 8 | /Invalid read of size 1/, 9 | /still reachable: [0-9,]+ bytes in 3 blocks/ 10 | ] 11 | 12 | lines = STDIN.readlines 13 | pp lines 14 | 15 | result = catch(:done) do 16 | patterns.each do |pat| 17 | loop do 18 | throw(:done, false) if lines.size == 0 19 | 20 | line = lines.shift 21 | if line =~ pat 22 | STDERR.puts "matched #{pat}" 23 | break; 24 | end 25 | end 26 | end 27 | 28 | throw(:done, true) 29 | end 30 | 31 | exit(result ? 0 : 1) 32 | -------------------------------------------------------------------------------- /unit-tests/regex/Makefile.in: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 3 | # Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. 4 | # 5 | # This file is part of LVM2. 6 | # 7 | # This copyrighted material is made available to anyone wishing to use, 8 | # modify, copy, or redistribute it subject to the terms and conditions 9 | # of the GNU General Public License v.2. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software Foundation, 13 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 | 15 | srcdir = @srcdir@ 16 | top_srcdir = @top_srcdir@ 17 | top_builddir = @top_builddir@ 18 | 19 | SOURCES=\ 20 | parse_t.c \ 21 | matcher_t.c 22 | 23 | TARGETS=\ 24 | parse_t \ 25 | matcher_t 26 | 27 | include $(top_builddir)/make.tmpl 28 | 29 | INCLUDES += -I$(top_srcdir)/libdm 30 | DM_DEPS = $(top_builddir)/libdm/libdevmapper.so 31 | DM_LIBS = -ldevmapper $(LIBS) 32 | 33 | parse_t: parse_t.o $(DM_DEPS) 34 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ parse_t.o $(DM_LIBS) 35 | 36 | matcher_t: matcher_t.o $(DM_DEPS) 37 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ matcher_t.o $(DM_LIBS) 38 | -------------------------------------------------------------------------------- /unit-tests/regex/TESTS: -------------------------------------------------------------------------------- 1 | dfa matching:$TEST_TOOL ./matcher_t --fingerprint dev_patterns < devices.list > matcher_t.output && diff -u matcher_t.expected matcher_t.output 2 | dfa matching:$TEST_TOOL ./matcher_t --fingerprint random_regexes < /dev/null > matcher_t.output && diff -u matcher_t.expected2 matcher_t.output 3 | dfa with non-print regex chars:$TEST_TOOL ./matcher_t nonprint_regexes < nonprint_input > matcher_t.output && diff -u matcher_t.expected3 matcher_t.output -------------------------------------------------------------------------------- /unit-tests/regex/dev_patterns: -------------------------------------------------------------------------------- 1 | "loop/[0-9]+" 2 | "hd[a-d][0-5]+" 3 | -------------------------------------------------------------------------------- /unit-tests/regex/matcher_t.expected: -------------------------------------------------------------------------------- 1 | fingerprint: 352b6c4f 2 | /dev/loop/0 : loop/[0-9]+ 3 | /dev/loop/1 : loop/[0-9]+ 4 | /dev/loop/2 : loop/[0-9]+ 5 | /dev/loop/3 : loop/[0-9]+ 6 | /dev/loop/4 : loop/[0-9]+ 7 | /dev/loop/5 : loop/[0-9]+ 8 | /dev/loop/6 : loop/[0-9]+ 9 | /dev/loop/7 : loop/[0-9]+ 10 | /dev/hda1 : hd[a-d][0-5]+ 11 | /dev/hda2 : hd[a-d][0-5]+ 12 | /dev/hda3 : hd[a-d][0-5]+ 13 | /dev/hda4 : hd[a-d][0-5]+ 14 | /dev/hda5 : hd[a-d][0-5]+ 15 | /dev/hdb1 : hd[a-d][0-5]+ 16 | /dev/hdc1 : hd[a-d][0-5]+ 17 | -------------------------------------------------------------------------------- /unit-tests/regex/matcher_t.expected2: -------------------------------------------------------------------------------- 1 | fingerprint: eed8ceb8 2 | -------------------------------------------------------------------------------- /unit-tests/regex/matcher_t.expected3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steven676/lvm2/ea6a8078b41df75344aecff4c54aab9c78b67193/unit-tests/regex/matcher_t.expected3 -------------------------------------------------------------------------------- /unit-tests/regex/nonprint_input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steven676/lvm2/ea6a8078b41df75344aecff4c54aab9c78b67193/unit-tests/regex/nonprint_input -------------------------------------------------------------------------------- /unit-tests/regex/nonprint_regexes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steven676/lvm2/ea6a8078b41df75344aecff4c54aab9c78b67193/unit-tests/regex/nonprint_regexes --------------------------------------------------------------------------------