Add LVM2 PV resize, check and move operations (#670171)
Copy operation for LVM2 Physical Volumes is deliberately not implemented because it doesn't fit with how LVM2 works and is not safe in the general case without an understanding of its internals. See comment in lvm2_pv::copy() for more details. Bug #670171 - Add LVM PV read-write support
This commit is contained in:
parent
619bda5d8b
commit
566ebc1b88
|
@ -49,6 +49,10 @@ FS lvm2_pv::get_filesystem_support()
|
|||
{
|
||||
fs .read = FS::EXTERNAL ;
|
||||
fs .create = FS::EXTERNAL ;
|
||||
fs .grow = FS::EXTERNAL ;
|
||||
fs .shrink = FS::EXTERNAL ;
|
||||
fs .move = FS::GPARTED ;
|
||||
fs .check = FS::EXTERNAL ;
|
||||
}
|
||||
|
||||
return fs ;
|
||||
|
@ -100,7 +104,12 @@ bool lvm2_pv::create( const Partition & new_partition, OperationDetail & operati
|
|||
|
||||
bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
{
|
||||
return true ;
|
||||
Glib::ustring size = "" ;
|
||||
if ( ! fill_partition )
|
||||
size = " --setphysicalvolumesize " +
|
||||
Utils::num_to_str( floor( Utils::sector_to_unit(
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) ) + "K " ;
|
||||
return ! execute_command( "lvm pvresize -v " + size + partition_new .get_path(), operationdetail ) ;
|
||||
}
|
||||
|
||||
bool lvm2_pv::move( const Partition & partition_new
|
||||
|
@ -115,12 +124,25 @@ bool lvm2_pv::copy( const Glib::ustring & src_part_path
|
|||
, const Glib::ustring & dest_part_path
|
||||
, OperationDetail & operationdetail )
|
||||
{
|
||||
//Copy not implemented.
|
||||
// Metadata fully describing a Volume Group is stored at the start of
|
||||
// each Physical Volume member. Internally LVM2 primarily uses UUIDs
|
||||
// to uniquely identify all objects (PVs, VG and LVs) but the interface
|
||||
// uses device names and VG and LV names. The general case of copying
|
||||
// a PV could confuse LVM2 because it will result in duplicate objects,
|
||||
// or even duplicate partial VGs and LVs if they span multiple PVs, so
|
||||
// it is not safe and should be achieved using other LVM2 commands. A
|
||||
// specific case of copying a PV is the right action when it is as part
|
||||
// of the transfer of an exported VG to a remote machine via storage
|
||||
// which will be detached from the local machine and attached to the
|
||||
// remote machine, but would probably fit better at a VG manipulation
|
||||
// layer. Thus copying of PVs is not implemented.
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool lvm2_pv::check_repair( const Partition & partition, OperationDetail & operationdetail )
|
||||
{
|
||||
return true ;
|
||||
return ! execute_command( "lvm pvck -v " + partition .get_path(), operationdetail ) ;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
Loading…
Reference in New Issue