Add a partition warning for LVM2 PVs which can't be resized (#670171)

As LVM2 Physical Volumes can't be resized when they are members of
exported Volume Groups add a warning message to explain this fact.
Display the message as a partition specific warning and as additional
text when growing the file system to fill the partition is skipped for
the check operation and when pasting into an existing larger partition.

Bug #670171 - Add LVM PV read-write support
This commit is contained in:
Mike Fleetwood 2012-08-25 22:25:23 +01:00 committed by Curtis Gedak
parent ee49891611
commit 60d7728177
3 changed files with 24 additions and 4 deletions

View File

@ -100,6 +100,7 @@ enum CUSTOM_TEXT
CTEXT_ACTIVATE_FILESYSTEM, // Activate text ('Mount', 'Swapon', VG 'Activate', ...)
CTEXT_DEACTIVATE_FILESYSTEM, // Deactivate text ('Unmount', 'Swapoff', VG 'Deactivate', ...)
CTEXT_CHANGE_UUID_WARNING, // Warning to print when changing UUIDs
CTEXT_RESIZE_DISALLOWED_WARNING // File system resizing currently disallowed reason
} ;
//struct to store file system information

View File

@ -1588,6 +1588,14 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
}
partitions[ t ] .messages .push_back( temp ) ;
}
if ( filesystem_resize_disallowed( partitions[ t ] ) )
{
temp = get_filesystem_object( partitions[ t ] .filesystem )
->get_custom_text( CTEXT_RESIZE_DISALLOWED_WARNING ) ;
if ( ! temp .empty() )
partitions[ t ] .messages .push_back( temp ) ;
}
}
else if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
set_used_sectors( partitions[ t ] .logicals ) ;
@ -2486,10 +2494,15 @@ bool GParted_Core::maximize_filesystem( const Partition & partition, OperationDe
}
else if ( filesystem_resize_disallowed( partition ) )
{
operationdetail .get_last_child() .add_child(
OperationDetail( _("growing the file system is currently disallowed"),
STATUS_NONE, FONT_ITALIC ) ) ;
Glib::ustring msg = _("growing the file system is currently disallowed") ;
Glib::ustring custom_msg = get_filesystem_object( partition .filesystem )
->get_custom_text( CTEXT_RESIZE_DISALLOWED_WARNING ) ;
if ( ! custom_msg .empty() )
{
msg += "\n" ;
msg += custom_msg ;
}
operationdetail .get_last_child() .add_child( OperationDetail( msg, STATUS_NONE, FONT_ITALIC ) ) ;
operationdetail .get_last_child() .set_status( STATUS_N_A ) ;
return true ;
}

View File

@ -28,12 +28,18 @@ const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index )
static const Glib::ustring activate_text = _( "Ac_tivate" ) ;
static const Glib::ustring deactivate_text = _( "Deac_tivate" ) ;
static const Glib::ustring resize_warning =
_( "The LVM2 Physical Volume can not currently be resized because it is a member of an exported "
"Volume Group." ) ;
switch ( ttype )
{
case CTEXT_ACTIVATE_FILESYSTEM:
return index == 0 ? activate_text : "" ;
case CTEXT_DEACTIVATE_FILESYSTEM:
return index == 0 ? deactivate_text : "" ;
case CTEXT_RESIZE_DISALLOWED_WARNING:
return index == 0 ? resize_warning : "" ;
default:
return "" ;
}