2018-05-17-put-format1-and-pool-back - format1, pool: Add support for these old formats back in.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7cd35b62b841bd04b7057a937ee210a0a5b28332 Commit: 7cd35b62b841bd04b7057a937ee210a0a5b28332 Parent: a39eaea27dcd2fd895740193e82ca6d0683eb3ad Author: Joe Thornber <[email protected]> AuthorDate: Thu May 17 11:35:33 2018 +0100 Committer: David Teigland <[email protected]> CommitterDate: Thu May 17 11:54:58 2018 -0500
format1, pool: Add support for these old formats back in.
This is not destined for upstream. RHEL7.6+ specific patch.
(Requires configure option --with-lvm1=internal)
--- configure | 93 +++++- configure.ac | 58 +++ daemons/clvmd/clvmd-command.c | 1 + daemons/clvmd/lvm-functions.c | 10 + daemons/clvmd/lvm-functions.h | 1 + daemons/lvmetad/lvmetad-client.h | 1 + daemons/lvmetad/lvmetad-core.c | 9 +- include/configure.h.in | 14 + lib/Makefile.in | 29 ++ lib/activate/activate.c | 13 + lib/activate/activate.h | 1 + lib/cache/lvmcache.c | 4 + lib/cache/lvmetad.c | 23 +- lib/commands/toolcontext.c | 24 ++ lib/config/config_settings.h | 22 +- lib/display/display.c | 9 +- lib/format1/.exported_symbols | 1 + lib/format1/Makefile.in | 33 ++ lib/format1/disk-rep.c | 761 +++++++++++++++++++++++++++++++++++++ lib/format1/disk-rep.h | 250 ++++++++++++ lib/format1/format1.c | 630 ++++++++++++++++++++++++++++++ lib/format1/format1.h | 29 ++ lib/format1/import-export.c | 680 +++++++++++++++++++++++++++++++++ lib/format1/import-extents.c | 377 ++++++++++++++++++ lib/format1/layout.c | 172 +++++++++ lib/format1/lvm1-label.c | 129 +++++++ lib/format1/lvm1-label.h | 23 ++ lib/format1/vg_number.c | 60 +++ lib/format_pool/.exported_symbols | 1 + lib/format_pool/Makefile.in | 30 ++ lib/format_pool/disk_rep.c | 409 ++++++++++++++++++++ lib/format_pool/disk_rep.h | 156 ++++++++ lib/format_pool/format_pool.c | 337 ++++++++++++++++ lib/format_pool/format_pool.h | 28 ++ lib/format_pool/import_export.c | 285 ++++++++++++++ lib/format_pool/pool_label.c | 104 +++++ lib/format_pool/pool_label.h | 23 ++ lib/format_pool/sptype_names.h | 42 ++ lib/format_text/export.c | 2 + lib/format_text/format-text.c | 4 +- lib/format_text/import_vsn1.c | 9 +- lib/locking/locking.c | 40 ++ lib/metadata/lv_manip.c | 26 ++ lib/metadata/metadata-exported.h | 10 +- lib/metadata/metadata.c | 18 +- lib/metadata/segtype.h | 2 +- lib/metadata/snapshot_manip.c | 11 + lib/metadata/vg.c | 17 +- lib/metadata/vg.h | 1 + lib/report/report.c | 4 +- lib/striped/striped.c | 2 +- man/vgconvert.8_des | 7 +- test/shell/format-lvm1.sh | 38 ++ test/shell/lvm1-basic.sh | 36 ++ test/shell/snapshot-lvm1.sh | 35 ++ tools/args.h | 3 +- tools/lvconvert.c | 5 + tools/lvmcmdline.c | 58 +++- tools/pvscan.c | 5 +- tools/stub.h | 1 + tools/toollib.c | 29 ++- tools/vals.h | 4 +- tools/vgchange.c | 10 + tools/vgconvert.c | 53 ++- tools/vgscan.c | 4 +- 65 files changed, 5253 insertions(+), 53 deletions(-)
configure +90 -1
@@ -675,6 +675,7 @@ PYTHON_BINDINGS PYTHON3 PTHREAD_LIBS M_LIBS +POOL PKGCONFIG ODIRECT OCFDIR
@@ -689,6 +690,8 @@ LVM_MINOR LVM_MAJOR LVM_LIBAPI LVM_VERSION +LVM1_FALLBACK +LVM1 LIB_SUFFIX LDDEPS JOBS
@@ -716,6 +719,7 @@ DEFAULT_RAID10_SEGTYPE DEFAULT_PROFILE_SUBDIR DEFAULT_PID_DIR DEFAULT_MIRROR_SEGTYPE +DEFAULT_FALLBACK_TO_LVM1 DEFAULT_LOCK_DIR DEFAULT_DM_RUN_DIR DEFAULT_DATA_ALIGNMENT
@@ -908,6 +912,9 @@ with_device_gid with_device_mode with_device_nodes_on with_default_name_mangling +enable_lvm1_fallback +with_lvm1 +with_pool with_cluster with_snapshots with_mirrors
@@ -1673,6 +1680,8 @@ Optional Features: speeds up one-time build. --enable-static_link use this to link the tools to their libraries statically (default is dynamic linking + --enable-lvm1_fallback use this to fall back and use LVM1 binaries if + device-mapper is missing from the kernel --disable-thin_check_needs_check required if thin_check version is < 0.3.0 --disable-cache_check_needs_check
@@ -1739,6 +1748,10 @@ Optional Packages: create nodes on resume or create [ON=resume] --with-default-name-mangling=MANGLING default name mangling: auto/none/hex [auto] + --with-lvm1=TYPE LVM1 metadata support: internal/shared/none + [internal] + --with-pool=TYPE GFS pool read-only support: internal/shared/none + [internal] --with-cluster=TYPE cluster LVM locking support: internal/shared/none [internal] --with-snapshots=TYPE snapshot support: internal/shared/none [internal]
@@ -8372,6 +8385,78 @@ _ACEOF ################################################################################ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable lvm1 fallback" >&5 +$as_echo_n "checking whether to enable lvm1 fallback... " >&6; } +# Check whether --enable-lvm1_fallback was given. +if test "${enable_lvm1_fallback+set}" = set; then : + enableval=$enable_lvm1_fallback; LVM1_FALLBACK=$enableval +else + LVM1_FALLBACK=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LVM1_FALLBACK" >&5 +$as_echo "$LVM1_FALLBACK" >&6; } + +if test "$LVM1_FALLBACK" = yes; then + DEFAULT_FALLBACK_TO_LVM1=1 + +$as_echo "#define LVM1_FALLBACK 1" >>confdefs.h + +else + DEFAULT_FALLBACK_TO_LVM1=0 +fi + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_FALLBACK_TO_LVM1 $DEFAULT_FALLBACK_TO_LVM1 +_ACEOF + + +################################################################################ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include support for lvm1 metadata" >&5 +$as_echo_n "checking whether to include support for lvm1 metadata... " >&6; } + +# Check whether --with-lvm1 was given. +if test "${with_lvm1+set}" = set; then : + withval=$with_lvm1; LVM1=$withval +else + LVM1=internal +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LVM1" >&5 +$as_echo "$LVM1" >&6; } + +case "$LVM1" in + none|shared) ;; + internal) +$as_echo "#define LVM1_INTERNAL 1" >>confdefs.h + ;; + *) as_fn_error $? "--with-lvm1 parameter invalid" "$LINENO" 5 ;; +esac + +################################################################################ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include support for GFS pool metadata" >&5 +$as_echo_n "checking whether to include support for GFS pool metadata... " >&6; } + +# Check whether --with-pool was given. +if test "${with_pool+set}" = set; then : + withval=$with_pool; POOL=$withval +else + POOL=internal +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $POOL" >&5 +$as_echo "$POOL" >&6; } + +case "$POOL" in + none|shared) ;; + internal) +$as_echo "#define POOL_INTERNAL 1" >>confdefs.h + ;; + *) as_fn_error $? "--with-pool parameter invalid" "$LINENO" 5 +esac + +################################################################################ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include support for cluster locking" >&5 $as_echo_n "checking whether to include support for cluster locking... " >&6; }
@@ -15558,8 +15643,12 @@ _ACEOF + + + + ################################################################################ -ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile device_mapper/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/locking/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/ libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_ init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat at .service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/api/python_lvm_unit.py test/unit/Makefile tools/Makefile udev/Makefile" +ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile device_mapper/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile l ibdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_sy
stemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat at .service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/api/python_lvm_unit.py test/unit/Makefile tools/Makefile udev/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -16285,6 +16374,8 @@ do
"include/.symlinks") CONFIG_FILES="$CONFIG_FILES include/.symlinks" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
+ "lib/format1/Makefile") CONFIG_FILES="$CONFIG_FILES lib/format1/Makefile" ;;
+ "lib/format_pool/Makefile") CONFIG_FILES="$CONFIG_FILES lib/format_pool/Makefile" ;;
"lib/locking/Makefile") CONFIG_FILES="$CONFIG_FILES lib/locking/Makefile" ;;
"include/lvm-version.h") CONFIG_FILES="$CONFIG_FILES include/lvm-version.h" ;;
"libdaemon/Makefile") CONFIG_FILES="$CONFIG_FILES libdaemon/Makefile" ;;configure.ac +58 -0
88 lines not on this page · raw message
daemons/clvmd/clvmd-command.c +1 -0
@@ -108,6 +108,7 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen, lock_flags = args[1 ]; lockname = &args[2 ];/* Check to see if the VG is in use by LVM1 */ + status =do_check_lvm1 (lockname);do_lock_vg (lock_cmd, lock_flags, lockname);break ;
daemons/clvmd/lvm-functions.c +10 -0
@@ -639,6 +639,16 @@ int post_lock_lv(unsigned char command, unsigned char lock_flags,return 0 ; } +/* Check if a VG is in use by LVM1 so we don't stomp on it */ +int do_check_lvm1 (const char *vgname) +{ +int status; + + status =check_lvm1_vg_inactive (cmd, vgname); + +return status ==1 ?0 :EBUSY ; +} +int do_refresh_cache (void ) {DEBUGLOG ("Refreshing context\n" );
daemons/clvmd/lvm-functions.h +1 -0
@@ -25,6 +25,7 @@ extern int do_lock_lv(unsigned char lock_cmd, unsigned char lock_flags,extern const char *do_lock_query (char *resource);extern int post_lock_lv (unsigned char lock_cmd,unsigned char lock_flags,char *resource); +extern int do_check_lvm1 (const char *vgname);extern int do_refresh_cache (void );extern int init_clvm (struct dm_hash_table *excl_uuid);extern void destroy_lvm (void );
daemons/lvmetad/lvmetad-client.h +1 -0
@@ -22,6 +22,7 @@#define LVMETAD_TOKEN_UPDATE_IN_PROGRESS "update in progress"#define LVMETAD_DISABLE_REASON_DIRECT "DIRECT" +#define LVMETAD_DISABLE_REASON_LVM1 "LVM1"#define LVMETAD_DISABLE_REASON_DUPLICATES "DUPLICATES"#define LVMETAD_DISABLE_REASON_VGRESTORE "VGRESTORE"#define LVMETAD_DISABLE_REASON_REPAIR "REPAIR"
daemons/lvmetad/lvmetad-core.c +6 -3
@@ -200,12 +200,12 @@ struct vg_info {#define GLFL_INVALID 0x00000001#define GLFL_DISABLE 0x00000002#define GLFL_DISABLE_REASON_DIRECT 0x00000004 -/* 0x00000008 */ +#define GLFL_DISABLE_REASON_LVM1 0x00000008#define GLFL_DISABLE_REASON_DUPLICATES 0x00000010#define GLFL_DISABLE_REASON_VGRESTORE 0x00000020#define GLFL_DISABLE_REASON_REPAIR 0x00000040 -#define GLFL_DISABLE_REASON_ALL (GLFL_DISABLE_REASON_DIRECT | GLFL_DISABLE_REASON_REPAIR | GLFL_DISABLE_REASON_DUPLICATES | GLFL_DISABLE_REASON_VGRESTORE) +#define GLFL_DISABLE_REASON_ALL (GLFL_DISABLE_REASON_DIRECT | GLFL_DISABLE_REASON_REPAIR | GLFL_DISABLE_REASON_LVM1 | GLFL_DISABLE_REASON_DUPLICATES | GLFL_DISABLE_REASON_VGRESTORE)#define VGFL_INVALID 0x00000001
@@ -2369,6 +2369,8 @@ static response set_global_info(lvmetad_state *s, request r) reason_flags |=GLFL_DISABLE_REASON_DIRECT ;if (strstr (reason,LVMETAD_DISABLE_REASON_REPAIR )) reason_flags |=GLFL_DISABLE_REASON_REPAIR ; +if (strstr (reason,LVMETAD_DISABLE_REASON_LVM1 )) + reason_flags |=GLFL_DISABLE_REASON_LVM1 ;if (strstr (reason,LVMETAD_DISABLE_REASON_DUPLICATES )) reason_flags |=GLFL_DISABLE_REASON_DUPLICATES ;if (strstr (reason,LVMETAD_DISABLE_REASON_VGRESTORE ))
@@ -2427,9 +2429,10 @@ static response get_global_info(lvmetad_state *s, request r) pid = (int )daemon_request_int (r,"pid" ,0 );if (s->flags &GLFL_DISABLE ) { -snprintf (reason,REASON_BUF_SIZE ,"%s%s%s%s" , +snprintf (reason,REASON_BUF_SIZE ,"%s%s%s%s%s" , (s->flags &GLFL_DISABLE_REASON_DIRECT ) ?LVMETAD_DISABLE_REASON_DIRECT "," :"" , (s->flags &GLFL_DISABLE_REASON_REPAIR ) ?LVMETAD_DISABLE_REASON_REPAIR "," :"" , + (s->flags &GLFL_DISABLE_REASON_LVM1 ) ?LVMETAD_DISABLE_REASON_LVM1 "," :"" , (s->flags &GLFL_DISABLE_REASON_DUPLICATES ) ?LVMETAD_DISABLE_REASON_DUPLICATES "," :"" , (s->flags &GLFL_DISABLE_REASON_VGRESTORE ) ?LVMETAD_DISABLE_REASON_VGRESTORE "," :"" ); }
include/configure.h.in +14 -0
@@ -72,6 +72,10 @@ /* Default system configuration directory. */ #undef DEFAULT_ETC_DIR +/* Fall back to LVM1 by default if device-mapper is missing from the kernel. + */ +#undef DEFAULT_FALLBACK_TO_LVM1 + /* Name of default locking directory. */ #undef DEFAULT_LOCK_DIR
@@ -616,6 +620,13 @@ slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK +/* Define to 1 if 'lvm' should fall back to using LVM1 binaries if + device-mapper is missing from the kernel */ +#undef LVM1_FALLBACK + +/* Define to 1 to include built-in support for LVM1 metadata. */ +#undef LVM1_INTERNAL + /* Path to lvmetad pidfile. */ #undef LVMETAD_PIDFILE
@@ -678,6 +689,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to 1 to include built-in support for GFS pool metadata. */ +#undef POOL_INTERNAL + /* Define to 1 to include built-in support for raid. */ #undef RAID_INTERNAL
lib/Makefile.in +29 -0
@@ -16,6 +16,14 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ +ifeq ("@LVM1@", "shared") + SUBDIRS = format1 +endif + +ifeq ("@POOL@", "shared") + SUBDIRS += format_pool +endif + ifeq ("@CLUSTER@", "shared") SUBDIRS += locking endif
@@ -107,6 +115,25 @@ SOURCES =\ uuid/uuid.c \ zero/zero.c +ifeq ("@LVM1@", "internal") + SOURCES +=\ + format1/disk-rep.c \ + format1/format1.c \ + format1/import-export.c \ + format1/import-extents.c \ + format1/layout.c \ + format1/lvm1-label.c \ + format1/vg_number.c +endif + +ifeq ("@POOL@", "internal") + SOURCES +=\ + format_pool/disk_rep.c \ + format_pool/format_pool.c \ + format_pool/import_export.c \ + format_pool/pool_label.c +endif + ifeq ("@CLUSTER@", "internal") SOURCES += locking/cluster_locking.c endif
@@ -143,6 +170,8 @@ LIB_STATIC = $(LIB_NAME).a ifeq ($(MAKECMDGOALS),distclean) SUBDIRS =\ + format1 \ + format_pool \ notify \ locking endif
lib/activate/activate.c +13 -0
@@ -37,6 +37,19 @@ #define _skip(fmt, args...) log_very_verbose("Skipping: " fmt , ## args) +int lvm1_present (struct cmd_context *cmd) +{ +static char path[PATH_MAX ]; + +if (dm_snprintf (path,sizeof (path),"%s/lvm/global" , cmd->proc_dir) + <0 ) { +log_error ("LVM1 proc global snprintf failed" ); +return 0 ; + } + +return (path_exists (path)) ?1 :0 ; +} +int list_segment_modules (struct dm_pool *mem,const struct lv_segment *seg,struct dm_list *modules) {
lib/activate/activate.h +1 -0
@@ -91,6 +91,7 @@ int activation(void);int driver_version (char *version,size_t size);int library_version (char *version,size_t size); +int lvm1_present (struct cmd_context *cmd);int module_present (struct cmd_context *cmd,const char *target_name); int target_present_version(struct cmd_context *cmd, const char *target_name,
lib/cache/lvmcache.c +4 -0
@@ -22,6 +22,8 @@#include "memlock.h" #include "str_list.h" #include "format-text.h" +#include "format_pool.h" +#include "format1.h" #include "config.h" #include "lvmetad.h"
@@ -538,6 +540,8 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */ if (!strcmp (vgname,VG_ORPHANS )) {_drop_metadata (FMT_TEXT_ORPHAN_VG_NAME ,0 ); +_drop_metadata (FMT_LVM1_ORPHAN_VG_NAME ,0 ); +_drop_metadata (FMT_POOL_ORPHAN_VG_NAME ,0 ); }else _drop_metadata (vgname, drop_precommitted); }
lib/cache/lvmetad.c +21 -2
@@ -37,6 +37,8 @@ static const char *_lvmetad_socket = NULL;static struct cmd_context *_lvmetad_cmd =NULL ;static int64_t _lvmetad_update_timeout; +static int _found_lvm1_metadata =0 ; +static struct volume_group *_lvmetad_pvscan_vg (struct cmd_context *cmd,struct volume_group *vg,const char *vgid,struct format_type *fmt);static uint64_t _monotonic_seconds (void )
@@ -2277,6 +2279,18 @@ int lvmetad_pvscan_single(struct cmd_context *cmd, struct device *dev,if (!baton.fid) goto_bad; +if (fmt->features &FMT_OBSOLETE ) { + fmt->ops->destroy_instance (baton.fid); +log_warn ("WARNING: Disabling lvmetad cache which does not support obsolete (lvm1) metadata." ); +lvmetad_set_disabled (cmd,LVMETAD_DISABLE_REASON_LVM1 ); + _found_lvm1_metadata =1 ; +/* +* return 1 (success) so that we'll continue to populate lvmetad +* instead of leaving the update incomplete. +*/ +return 1 ; + } +lvmcache_foreach_mda (info, _lvmetad_pvscan_single, &baton);if (!baton.vg)
@@ -2438,9 +2452,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait) }/* -* If lvmetad is disabled, and no duplicate PVs were seen, then re-enable lvmetad. +* If lvmetad is disabled, and no lvm1 metadata was seen and no +* duplicate PVs were seen, then re-enable lvmetad. */ -if (lvmetad_is_disabled (cmd, &reason) && !lvmcache_found_duplicate_pvs ()) { +if (lvmetad_is_disabled (cmd, &reason) && + !lvmcache_found_duplicate_pvs () && !_found_lvm1_metadata) {log_debug_lvmetad ("Enabling lvmetad which was previously disabled." );lvmetad_clear_disabled (cmd); }
@@ -3056,6 +3072,9 @@ int lvmetad_is_disabled(struct cmd_context *cmd, const char **reason) }else if (strstr (reply_reason,LVMETAD_DISABLE_REASON_REPAIR )) { *reason ="a repair command was run" ; + }else if (strstr (reply_reason,LVMETAD_DISABLE_REASON_LVM1 )) { + *reason ="LVM1 metadata was found" ; + }else if (strstr (reply_reason,LVMETAD_DISABLE_REASON_DUPLICATES )) { *reason ="duplicate PVs were found" ;
lib/commands/toolcontext.c +24 -0
@@ -36,6 +36,14 @@#include "sharedlib.h" #endif +#ifdef LVM1_INTERNAL +#include "format1.h" +#endif + +#ifdef POOL_INTERNAL +#include "format_pool.h" +#endif +#include <locale.h> #include <sys/stat.h> #include <sys/syscall.h>
@@ -1134,12 +1142,14 @@ static struct dev_filter *_init_lvmetad_filter_chain(struct cmd_context *cmd) } nr_filt++; +#if 0 /* signature filter. Required. */ if (!(filters[nr_filt] =signature_filter_create (cmd->dev_types))) {log_error ("Failed to create signature device filter" ); goto bad; } nr_filt++; +#endif /* md component filter. Optional, non-critical. */ if (find_config_tree_bool (cmd, devices_md_component_detection_CFG,NULL )) {
@@ -1340,6 +1350,20 @@ static int _init_formats(struct cmd_context *cmd)const struct dm_config_node *cn;#endif +#ifdef LVM1_INTERNAL +if (!(fmt =init_lvm1_format (cmd))) +return 0 ; + fmt->library =NULL ; +dm_list_add (&cmd->formats, &fmt->list); +#endif + +#ifdef POOL_INTERNAL +if (!(fmt =init_pool_format (cmd))) +return 0 ; + fmt->library =NULL ; +dm_list_add (&cmd->formats, &fmt->list); +#endif +#ifdef HAVE_LIBDL /* Load any formats in shared libs if not static */ if (!is_static() &&
lib/config/config_settings.h +17 -5
@@ -767,14 +767,26 @@ cfg(global_activation_CFG, "activation", global_CFG_SECTION, 0, CFG_TYPE_BOOL, D "is not present in the kernel, disabling this should suppress\n" "the error messages.\n") -cfg(global_fallback_to_lvm1_CFG, "fallback_to_lvm1", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(1, 0, 18), NULL, 0, NULL, - "This setting is no longer used.\n") +cfg (global_fallback_to_lvm1_CFG,"fallback_to_lvm1" , global_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_BOOL ,DEFAULT_FALLBACK_TO_LVM1 ,vsn (1 ,0 ,18 ),"@DEFAULT_FALLBACK_TO_LVM1@" ,0 ,NULL , +"Try running LVM1 tools if LVM cannot communicate with DM.\n" +"This option only applies to 2.4 kernels and is provided to help\n" +"switch between device-mapper kernels and LVM1 kernels. The LVM1\n" +"tools need to be installed with .lvm1 suffices, e.g. vgscan.lvm1.\n" + "They will stop working once the lvm2 on-disk metadata format is used.\n")cfg (global_format_CFG,"format" , global_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_STRING ,DEFAULT_FORMAT ,vsn (1 ,0 ,0 ),NULL ,0 ,NULL , - "This setting is no longer used.\n") - +"The default metadata format that commands should use.\n" +"The -M 1|2 option overrides this setting.\n" +"#\n" +"Accepted values:\n" +" lvm1\n" +" lvm2\n" + "#\n") +cfg_array (global_format_libraries_CFG,"format_libraries" , global_CFG_SECTION,CFG_DEFAULT_UNDEFINED ,CFG_TYPE_STRING ,NULL ,vsn (1 ,0 ,0 ),NULL ,0 ,NULL , - "This setting is no longer used.") +"Shared libraries that process different metadata formats.\n" +"If support for LVM1 metadata was compiled as a shared library use\n" + "format_libraries = \"liblvm2format1.so\"\n")cfg_array (global_segment_libraries_CFG,"segment_libraries" , global_CFG_SECTION,CFG_DEFAULT_UNDEFINED ,CFG_TYPE_STRING ,NULL ,vsn (1 ,0 ,18 ),NULL ,0 ,NULL ,NULL )
lib/display/display.c +6 -3
@@ -705,10 +705,13 @@ void vgdisplay_full(const struct volume_group *vg)log_print ("--- Volume group ---" );log_print ("VG Name %s" , vg->name); -log_print ("System ID %s" , (vg->system_id && *vg->system_id) ? vg->system_id :"" ); +log_print ("System ID %s" , (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? :"" );log_print ("Format %s" , vg->fid->fmt->name); -log_print ("Metadata Areas %d" ,vg_mda_count (vg)); -log_print ("Metadata Sequence No %d" , vg->seqno); +if (vg->fid->fmt->features &FMT_MDAS ) { +log_print ("Metadata Areas %d" , +vg_mda_count (vg)); +log_print ("Metadata Sequence No %d" , vg->seqno); + } access_str = vg->status & (LVM_READ |LVM_WRITE ); log_print("VG Access %s%s%s%s", access_str == (LVM_READ | LVM_WRITE) ? "read/write" : "",
lib/format1/.exported_symbols new file +1 -0
@@ -0,0 +1 @@ +init_format
lib/format1/Makefile.in new file +33 -0
@@ -0,0 +1,33 @@ +# +# Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. +# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ + +SOURCES =\ + disk-rep.c \ + format1.c \ + import-export.c \ + import-extents.c \ + layout.c \ + lvm1-label.c \ + vg_number.c + +LIB_SHARED = liblvm2format1.$(LIB_SUFFIX) +LIB_VERSION = $(LIB_VERSION_LVM) + +include $(top_builddir)/make.tmpl + +install: install_lvm2_plugin
lib/format1/disk-rep.c new file +761 -0
761 lines not on this page · raw message
lib/format1/disk-rep.h new file +250 -0
250 lines not on this page · raw message
lib/format1/format1.c new file +630 -0
630 lines not on this page · raw message
lib/format1/format1.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. +* Copyright (C) 2004 Red Hat, Inc. All rights reserved. +* +* This file is part of LVM2. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU Lesser General Public License v.2.1. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _LVM_FORMAT1_H +#define _LVM_FORMAT1_H + +#include "metadata.h" +#include "lvmcache.h" + +#define FMT_LVM1_NAME "lvm1" +#define FMT_LVM1_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_LVM1_NAME) + +#ifdef LVM1_INTERNAL +struct format_type *init_lvm1_format (struct cmd_context *cmd); +#endif + +#endif
lib/format1/import-export.c new file +680 -0
680 lines not on this page · raw message
lib/format1/import-extents.c new file +377 -0
54 lines not on this page · raw message
lib/format1/layout.c new file +172 -0
172 lines not on this page · raw message
lib/format1/lvm1-label.c new file +129 -0
129 lines not on this page · raw message
lib/format1/vg_number.c new file +60 -0
60 lines not on this page · raw message
lib/format_pool/.exported_symbols new file +1 -0
Lines of this file are not shown. View the raw message.
lib/format_pool/disk_rep.c new file +409 -0
409 lines not on this page · raw message
lib/format_pool/disk_rep.h new file +156 -0
156 lines not on this page · raw message
lib/format_pool/format_pool.c new file +337 -0
337 lines not on this page · raw message
lib/format_pool/format_pool.h new file +28 -0
Lines of this file are not shown. View the raw message.
lib/format_pool/import_export.c new file +285 -0
285 lines not on this page · raw message
lib/format_pool/pool_label.c new file +104 -0
104 lines not on this page · raw message
lib/format_pool/sptype_names.h new file +42 -0
42 lines not on this page · raw message
tools/lvmcmdline.c +57 -1
58 lines not on this page · raw message
tools/vgconvert.c +38 -15
53 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.