2001-10-02 21:09:05 +04:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2012-03-03 22:32:53 +04:00
* Copyright ( C ) 2004 - 2012 Red Hat , Inc . All rights reserved .
2001-10-02 21:09:05 +04:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
2001-10-02 21:09:05 +04:00
*
2004-03-30 23:35:44 +04:00
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2001-10-02 21:09:05 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-10-02 21:09:05 +04:00
*/
# include "tools.h"
2012-02-23 17:11:07 +04:00
# include "lvmetad.h"
# include "lvmcache.h"
2014-03-19 03:19:01 +04:00
unsigned pv_max_name_len = 0 ;
unsigned vg_max_name_len = 0 ;
2001-10-02 21:09:05 +04:00
2002-12-20 02:25:55 +03:00
static void _pvscan_display_single ( struct cmd_context * cmd ,
2006-05-10 01:23:51 +04:00
struct physical_volume * pv ,
2010-07-09 19:34:40 +04:00
void * handle __attribute__ ( ( unused ) ) )
2002-11-18 17:04:08 +03:00
{
2014-03-19 03:17:36 +04:00
/* XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX */
char uuid [ 40 ] __attribute__ ( ( aligned ( 8 ) ) ) ;
const unsigned suffix = sizeof ( uuid ) + 10 ;
char pv_tmp_name [ pv_max_name_len + suffix ] ;
unsigned pv_len = pv_max_name_len ;
const char * pvdevname = pv_dev_name ( pv ) ;
2002-11-18 17:04:08 +03:00
/* short listing? */
if ( arg_count ( cmd , short_ARG ) > 0 ) {
2014-03-19 03:19:01 +04:00
log_print_unless_silent ( " %s " , pvdevname ) ;
2002-11-18 17:04:08 +03:00
return ;
}
if ( arg_count ( cmd , verbose_ARG ) > 1 ) {
/* FIXME As per pv_display! Drop through for now. */
/* pv_show(pv); */
/* FIXME - Moved to Volume Group structure */
/* log_print("System Id %s", pv->vg->system_id); */
/* log_print(" "); */
/* return; */
}
if ( arg_count ( cmd , uuid_ARG ) ) {
if ( ! id_write_format ( & pv - > id , uuid , sizeof ( uuid ) ) ) {
stack ;
return ;
}
2014-03-19 03:17:36 +04:00
if ( dm_snprintf ( pv_tmp_name , sizeof ( pv_tmp_name ) , " %-*s with UUID %s " ,
pv_max_name_len - 2 , pvdevname , uuid ) < 0 ) {
log_error ( " Invalid PV name with uuid. " ) ;
return ;
}
pvdevname = pv_tmp_name ;
pv_len + = suffix ;
2002-11-18 17:04:08 +03:00
}
2014-03-19 03:17:36 +04:00
if ( is_orphan ( pv ) )
config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.
When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]
Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 23:35:48 +04:00
log_print_unless_silent ( " PV %-*s %-*s %s [%s] " ,
2014-03-19 03:17:36 +04:00
pv_len , pvdevname ,
config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.
When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]
Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 23:35:48 +04:00
vg_max_name_len , " " ,
pv - > fmt ? pv - > fmt - > name : " " ,
display_size ( cmd , pv_size ( pv ) ) ) ;
2014-03-19 03:17:36 +04:00
else if ( pv_status ( pv ) & EXPORTED_VG )
log_print_unless_silent ( " PV %-*s is in exported VG %s [%s / %s free] " ,
pv_len , pvdevname , pv_vg_name ( pv ) ,
display_size ( cmd , ( uint64_t ) pv_pe_count ( pv ) * pv_pe_size ( pv ) ) ,
display_size ( cmd , ( uint64_t ) ( pv_pe_count ( pv ) - pv_pe_alloc_count ( pv ) ) * pv_pe_size ( pv ) ) ) ;
else
log_print_unless_silent ( " PV %-*s VG %-*s %s [%s / %s free] " ,
pv_len , pvdevname ,
vg_max_name_len , pv_vg_name ( pv ) ,
pv - > fmt ? pv - > fmt - > name : " " ,
config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.
When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]
Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 23:35:48 +04:00
display_size ( cmd , ( uint64_t ) pv_pe_count ( pv ) * pv_pe_size ( pv ) ) ,
display_size ( cmd , ( uint64_t ) ( pv_pe_count ( pv ) - pv_pe_alloc_count ( pv ) ) * pv_pe_size ( pv ) ) ) ;
2002-11-18 17:04:08 +03:00
}
2013-11-12 13:55:34 +04:00
# define REFRESH_BEFORE_AUTOACTIVATION_RETRIES 5
# define REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY 100000
2012-12-12 15:51:28 +04:00
static int _auto_activation_handler ( struct cmd_context * cmd ,
2014-03-14 15:07:41 +04:00
const char * vgname , const char * vgid ,
2014-03-14 13:44:14 +04:00
int partial , int changed ,
2012-08-21 17:49:23 +04:00
activation_change_t activate )
2012-06-27 17:35:11 +04:00
{
2013-11-12 13:55:34 +04:00
unsigned int refresh_retries = REFRESH_BEFORE_AUTOACTIVATION_RETRIES ;
int refresh_done = 0 ;
2012-12-12 15:51:28 +04:00
struct volume_group * vg ;
struct id vgid_raw ;
2013-09-03 18:45:18 +04:00
int r = 0 ;
2012-12-12 15:51:28 +04:00
2012-06-27 17:35:11 +04:00
/* TODO: add support for partial and clustered VGs */
2012-12-12 15:51:28 +04:00
if ( partial )
2012-06-27 17:35:11 +04:00
return 1 ;
2013-04-29 14:34:50 +04:00
if ( ! id_read_format ( & vgid_raw , vgid ) )
return_0 ;
2013-09-03 18:45:18 +04:00
/* NB. This is safe because we know lvmetad is running and we won't hit disk. */
2014-03-14 15:07:41 +04:00
vg = vg_read ( cmd , vgname , ( const char * ) & vgid_raw , 0 ) ;
if ( vg_read_error ( vg ) ) {
log_error ( " Failed to read Volume Group \" %s \" (%s) during autoactivation. " , vgname , vgid ) ;
release_vg ( vg ) ;
return 0 ;
}
2012-12-12 15:51:28 +04:00
if ( vg_is_clustered ( vg ) ) {
2013-09-03 18:45:18 +04:00
r = 1 ; goto out ;
}
2013-11-12 13:55:34 +04:00
/* FIXME: There's a tiny race when suspending the device which is part
* of the refresh because when suspend ioctl is performed , the dm
* kernel driver executes ( do_suspend and dm_suspend kernel fn ) :
*
* step 1 : a check whether the dev is already suspended and
* if yes it returns success immediately as there ' s
* nothing to do
* step 2 : it grabs the suspend lock
* step 3 : another check whether the dev is already suspended
* and if found suspended , it exits with - EINVAL now
*
* The race can occur in between step 1 and step 2. To prevent premature
* autoactivation failure , we ' re using a simple retry logic here before
* we fail completely . For a complete solution , we need to fix the
* locking so there ' s no possibility for suspend calls to interleave
* each other to cause this kind of race .
*
* Remove this workaround with " refresh_retries " once we have proper locking in !
*/
2014-03-14 13:44:14 +04:00
if ( changed ) {
while ( refresh_retries - - ) {
if ( vg_refresh_visible ( vg - > cmd , vg ) ) {
refresh_done = 1 ;
break ;
}
usleep ( REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY ) ;
2013-11-12 13:55:34 +04:00
}
2014-03-14 13:44:14 +04:00
if ( ! refresh_done )
log_warn ( " %s: refresh before autoactivation failed. " , vg - > name ) ;
}
2012-12-12 15:51:28 +04:00
2012-06-27 17:35:11 +04:00
if ( ! vgchange_activate ( vg - > cmd , vg , activate ) ) {
log_error ( " %s: autoactivation failed. " , vg - > name ) ;
2013-09-03 18:45:18 +04:00
goto out ;
2012-06-27 17:35:11 +04:00
}
2013-09-03 18:45:18 +04:00
r = 1 ;
out :
2014-03-14 15:07:41 +04:00
unlock_and_release_vg ( cmd , vg , vgname ) ;
2013-09-03 18:45:18 +04:00
return r ;
2012-06-27 17:35:11 +04:00
}
2013-10-22 15:52:18 +04:00
static int _clear_dev_from_lvmetad_cache ( dev_t devno , int32_t major , int32_t minor ,
activation_handler handler )
{
2014-06-16 14:38:14 +04:00
char buf [ 24 ] ;
2013-10-22 15:52:18 +04:00
2014-06-16 14:38:14 +04:00
( void ) dm_snprintf ( buf , sizeof ( buf ) , " % " PRIi32 " :% " PRIi32 , major , minor ) ;
if ( ! lvmetad_pv_gone ( devno , buf , handler ) )
return_0 ;
2013-10-22 15:52:18 +04:00
log_print_unless_silent ( " Device %s not found. "
2014-06-16 14:38:14 +04:00
" Cleared from lvmetad cache. " , buf ) ;
2013-10-22 15:52:18 +04:00
return 1 ;
}
2012-03-03 22:32:53 +04:00
static int _pvscan_lvmetad ( struct cmd_context * cmd , int argc , char * * argv )
{
int ret = ECMD_PROCESSED ;
struct device * dev ;
const char * pv_name ;
2012-03-06 06:30:49 +04:00
int32_t major = - 1 ;
int32_t minor = - 1 ;
int devno_args = 0 ;
struct arg_value_group_list * current_group ;
2012-03-03 22:32:53 +04:00
dev_t devno ;
2012-06-27 16:59:34 +04:00
activation_handler handler = NULL ;
2012-03-06 06:30:49 +04:00
2012-11-09 18:56:57 +04:00
/*
* Return here immediately if lvmetad is not used .
* Also return if locking_type = 3 ( clustered ) as we
* dont ' t support cluster + lvmetad yet .
*
* This is to avoid taking the global lock uselessly
* and to prevent hangs in clustered environment .
*/
/* TODO: Remove this once lvmetad + cluster supported! */
2014-04-18 05:13:46 +04:00
if ( ! lvmetad_used ( ) ) {
log_verbose ( " Ignoring pvscan --cache command because lvmetad is not in use. " ) ;
2012-11-09 18:56:57 +04:00
return ret ;
}
2012-06-27 17:35:11 +04:00
if ( arg_count ( cmd , activate_ARG ) ) {
if ( arg_uint_value ( cmd , activate_ARG , CHANGE_AAY ) ! = CHANGE_AAY ) {
log_error ( " Only --activate ay allowed with pvscan. " ) ;
return 0 ;
}
handler = _auto_activation_handler ;
}
2012-03-06 06:30:49 +04:00
if ( arg_count ( cmd , major_ARG ) + arg_count ( cmd , minor_ARG ) )
devno_args = 1 ;
2012-03-03 22:32:53 +04:00
2012-03-06 06:30:49 +04:00
if ( devno_args & & ( ! arg_count ( cmd , major_ARG ) | | ! arg_count ( cmd , minor_ARG ) ) ) {
log_error ( " Both --major and --minor required to identify devices. " ) ;
return EINVALID_CMD_LINE ;
}
2013-03-18 00:29:58 +04:00
if ( ! lock_vol ( cmd , VG_GLOBAL , LCK_VG_READ , NULL ) ) {
2012-03-02 20:58:41 +04:00
log_error ( " Unable to obtain global lock. " ) ;
return ECMD_FAILED ;
}
2012-03-06 06:30:49 +04:00
/* Scan everything? */
if ( ! argc & & ! devno_args ) {
2012-09-10 00:05:59 +04:00
if ( ! lvmetad_pvscan_all_devs ( cmd , handler ) )
2012-03-03 22:32:53 +04:00
ret = ECMD_FAILED ;
goto out ;
}
2012-03-02 20:58:41 +04:00
log_verbose ( " Using physical volume(s) on command line " ) ;
2012-03-03 22:32:53 +04:00
2012-03-06 06:30:49 +04:00
/* Process any command line PVs first. */
2012-03-02 20:58:41 +04:00
while ( argc - - ) {
2012-03-03 22:32:53 +04:00
pv_name = * argv + + ;
2013-10-22 15:52:18 +04:00
if ( pv_name [ 0 ] = = ' / ' ) {
/* device path */
if ( ! ( dev = dev_cache_get ( pv_name , cmd - > lvmetad_filter ) ) ) {
log_error ( " Physical Volume %s not found. " , pv_name ) ;
ret = ECMD_FAILED ;
continue ;
}
}
else {
/* device major:minor */
if ( sscanf ( pv_name , " %d:%d " , & major , & minor ) ! = 2 ) {
log_error ( " Failed to parse major:minor from %s " , pv_name ) ;
ret = ECMD_FAILED ;
continue ;
}
devno = MKDEV ( ( dev_t ) major , minor ) ;
if ( ! ( dev = dev_cache_get_by_devt ( devno , cmd - > lvmetad_filter ) ) ) {
if ( ! ( _clear_dev_from_lvmetad_cache ( devno , major , minor , handler ) ) ) {
stack ;
ret = ECMD_FAILED ;
break ;
}
continue ;
}
2012-03-06 06:30:49 +04:00
}
2013-07-01 18:30:12 +04:00
if ( sigint_caught ( ) ) {
2012-03-06 06:30:49 +04:00
ret = ECMD_FAILED ;
2013-07-01 18:30:12 +04:00
stack ;
2012-03-06 06:30:49 +04:00
break ;
}
2013-07-01 18:30:12 +04:00
if ( ! lvmetad_pvscan_single ( cmd , dev , handler ) ) {
ret = ECMD_FAILED ;
stack ;
2012-03-06 06:30:49 +04:00
break ;
2013-07-01 18:30:12 +04:00
}
2012-03-06 06:30:49 +04:00
}
if ( ! devno_args )
goto out ;
/* Process any grouped --major --minor args */
dm_list_iterate_items ( current_group , & cmd - > arg_value_groups ) {
major = grouped_arg_int_value ( current_group - > arg_values , major_ARG , major ) ;
minor = grouped_arg_int_value ( current_group - > arg_values , minor_ARG , minor ) ;
if ( major < 0 | | minor < 0 )
continue ;
2012-08-16 22:06:07 +04:00
devno = MKDEV ( ( dev_t ) major , minor ) ;
2012-03-06 06:30:49 +04:00
2013-07-22 17:03:56 +04:00
if ( ! ( dev = dev_cache_get_by_devt ( devno , cmd - > lvmetad_filter ) ) ) {
2013-10-22 15:52:18 +04:00
if ( ! ( _clear_dev_from_lvmetad_cache ( devno , major , minor , handler ) ) ) {
2012-03-06 06:30:49 +04:00
stack ;
2012-03-03 22:32:53 +04:00
ret = ECMD_FAILED ;
break ;
}
continue ;
}
2013-07-01 18:30:12 +04:00
if ( sigint_caught ( ) ) {
ret = ECMD_FAILED ;
stack ;
break ;
}
2012-09-10 00:05:59 +04:00
if ( ! lvmetad_pvscan_single ( cmd , dev , handler ) ) {
2012-03-02 20:58:41 +04:00
ret = ECMD_FAILED ;
2013-07-01 18:30:12 +04:00
stack ;
2012-03-02 20:58:41 +04:00
break ;
}
2012-03-03 22:32:53 +04:00
2012-03-02 20:58:41 +04:00
}
2012-03-03 22:32:53 +04:00
out :
2012-12-21 13:54:31 +04:00
sync_local_dev_names ( cmd ) ;
2012-03-02 20:58:41 +04:00
unlock_vg ( cmd , VG_GLOBAL ) ;
return ret ;
}
2012-02-23 17:11:07 +04:00
int pvscan ( struct cmd_context * cmd , int argc , char * * argv )
2001-10-02 21:09:05 +04:00
{
int new_pvs_found = 0 ;
int pvs_found = 0 ;
2008-11-04 01:14:30 +03:00
struct dm_list * pvslist ;
2001-10-16 22:07:54 +04:00
struct pv_list * pvl ;
2001-10-02 21:09:05 +04:00
struct physical_volume * pv ;
2001-10-05 02:53:37 +04:00
uint64_t size_total = 0 ;
uint64_t size_new = 0 ;
2014-03-19 03:19:01 +04:00
unsigned len ;
2001-10-02 21:09:05 +04:00
2012-03-02 22:09:46 +04:00
if ( arg_count ( cmd , cache_ARG ) )
2012-03-02 20:58:41 +04:00
return _pvscan_lvmetad ( cmd , argc , argv ) ;
2012-02-23 17:11:07 +04:00
2014-03-31 01:32:53 +04:00
if ( argc ) {
log_error ( " Too many parameters on command line. " ) ;
return EINVALID_CMD_LINE ;
}
2012-06-27 17:35:11 +04:00
if ( arg_count ( cmd , activate_ARG ) ) {
log_error ( " --activate is only valid with --cache. " ) ;
return EINVALID_CMD_LINE ;
}
2014-03-31 13:43:28 +04:00
if ( arg_count ( cmd , major_ARG ) | | arg_count ( cmd , minor_ARG ) ) {
2012-03-06 06:30:49 +04:00
log_error ( " --major and --minor are only valid with --cache. " ) ;
return EINVALID_CMD_LINE ;
}
2002-02-12 00:00:35 +03:00
if ( arg_count ( cmd , novolumegroup_ARG ) & & arg_count ( cmd , exported_ARG ) ) {
2001-10-16 22:07:54 +04:00
log_error ( " Options -e and -n are incompatible " ) ;
2001-10-05 02:53:37 +04:00
return EINVALID_CMD_LINE ;
2001-10-02 21:09:05 +04:00
}
2012-03-03 21:03:20 +04:00
if ( arg_count ( cmd , exported_ARG ) | | arg_count ( cmd , novolumegroup_ARG ) )
2007-06-28 21:33:44 +04:00
log_warn ( " WARNING: only considering physical volumes %s " ,
2002-02-12 00:00:35 +03:00
arg_count ( cmd , exported_ARG ) ?
2001-10-02 21:09:05 +04:00
" of exported volume group(s) " : " in no volume group " ) ;
2013-03-18 00:29:58 +04:00
if ( ! lock_vol ( cmd , VG_GLOBAL , LCK_VG_WRITE , NULL ) ) {
2007-08-23 19:02:26 +04:00
log_error ( " Unable to obtain global lock. " ) ;
return ECMD_FAILED ;
}
2012-08-13 21:44:10 +04:00
if ( cmd - > filter - > wipe )
cmd - > filter - > wipe ( cmd - > filter ) ;
2014-03-22 01:26:39 +04:00
lvmcache_destroy ( cmd , 1 , 0 ) ;
2002-11-18 17:04:08 +03:00
2012-03-03 21:12:21 +04:00
/* populate lvmcache */
if ( ! lvmetad_vg_list_to_lvmcache ( cmd ) )
stack ;
2001-10-24 21:53:50 +04:00
log_verbose ( " Walking through all physical volumes " ) ;
2007-08-23 19:02:26 +04:00
if ( ! ( pvslist = get_pvs ( cmd ) ) ) {
unlock_vg ( cmd , VG_GLOBAL ) ;
2013-07-01 13:27:22 +04:00
return_ECMD_FAILED ;
2007-08-23 19:02:26 +04:00
}
2001-10-02 21:09:05 +04:00
/* eliminate exported/new if required */
2008-11-04 01:14:30 +03:00
dm_list_iterate_items ( pvl , pvslist ) {
2002-01-21 19:05:23 +03:00
pv = pvl - > pv ;
2001-10-02 21:09:05 +04:00
2002-04-24 22:20:51 +04:00
if ( ( arg_count ( cmd , exported_ARG )
2012-03-03 21:12:21 +04:00
& & ! ( pv_status ( pv ) & EXPORTED_VG ) ) | |
( arg_count ( cmd , novolumegroup_ARG ) & & ( ! is_orphan ( pv ) ) ) ) {
2008-11-04 01:14:30 +03:00
dm_list_del ( & pvl - > list ) ;
2012-03-03 22:32:53 +04:00
free_pv_fid ( pv ) ;
2001-10-02 21:09:05 +04:00
continue ;
}
/* Also check for MD use? */
/*******
if ( MAJOR ( pv_create_kdev_t ( pv [ p ] - > pv_name ) ) ! = MD_MAJOR ) {
2010-04-01 14:34:09 +04:00
log_warn
2001-10-02 21:09:05 +04:00
( " WARNING: physical volume \" %s \" belongs to a meta device " ,
pv [ p ] - > pv_name ) ;
}
if ( MAJOR ( pv [ p ] - > pv_dev ) ! = MD_MAJOR )
continue ;
* * * * * * * */
pvs_found + + ;
2001-10-06 01:39:30 +04:00
2007-11-02 17:54:40 +03:00
if ( is_orphan ( pv ) ) {
2001-10-02 21:09:05 +04:00
new_pvs_found + + ;
2007-06-16 02:16:55 +04:00
size_new + = pv_size ( pv ) ;
size_total + = pv_size ( pv ) ;
2001-10-31 15:47:01 +03:00
} else
2010-05-07 19:24:17 +04:00
size_total + = ( uint64_t ) pv_pe_count ( pv ) * pv_pe_size ( pv ) ;
2001-10-02 21:09:05 +04:00
}
/* find maximum pv name length */
pv_max_name_len = vg_max_name_len = 0 ;
2008-11-04 01:14:30 +03:00
dm_list_iterate_items ( pvl , pvslist ) {
2003-10-16 00:02:46 +04:00
pv = pvl - > pv ;
2007-10-12 18:29:32 +04:00
len = strlen ( pv_dev_name ( pv ) ) ;
2001-10-02 21:09:05 +04:00
if ( pv_max_name_len < len )
pv_max_name_len = len ;
2007-06-16 02:16:55 +04:00
len = strlen ( pv_vg_name ( pv ) ) ;
2001-10-02 21:09:05 +04:00
if ( vg_max_name_len < len )
vg_max_name_len = len ;
}
pv_max_name_len + = 2 ;
vg_max_name_len + = 2 ;
2011-03-11 17:56:56 +03:00
dm_list_iterate_items ( pvl , pvslist ) {
2012-02-23 17:11:07 +04:00
_pvscan_display_single ( cmd , pvl - > pv , NULL ) ;
free_pv_fid ( pvl - > pv ) ;
2011-03-11 17:56:56 +03:00
}
2001-10-02 21:09:05 +04:00
2014-03-19 03:19:01 +04:00
if ( ! pvs_found )
config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.
When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]
Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 23:35:48 +04:00
log_print_unless_silent ( " No matching physical volumes found " ) ;
2014-03-19 03:19:01 +04:00
else
log_print_unless_silent ( " Total: %d [%s] / in use: %d [%s] / in no VG: %d [%s] " ,
pvs_found ,
display_size ( cmd , size_total ) ,
pvs_found - new_pvs_found ,
display_size ( cmd , ( size_total - size_new ) ) ,
new_pvs_found , display_size ( cmd , size_new ) ) ;
2001-10-02 21:09:05 +04:00
2007-08-23 19:02:26 +04:00
unlock_vg ( cmd , VG_GLOBAL ) ;
2003-10-22 02:06:07 +04:00
return ECMD_PROCESSED ;
2001-10-02 21:09:05 +04:00
}