Commit Graph

1995 Commits

Author SHA1 Message Date
Mike Fleetwood 5cb6c687ba New LVM2_PV_Info::bit_set() testing VG and LV attribs "bits"
Abstract repeated code used to test the setting of individual LVM Volume
Group and Logical Volume "bits" attributes into bit_set() function.
2012-08-30 13:47:46 -06:00
Mike Fleetwood c90365a6db Update declarations of some LVM2_PV_Info member functions
Add const qualifier to get_pv_attr_by_path() and get_pv_attr_by_row() as
they only access member variables read-only.

Make lvm2_pv_attr_to_num() a static member function as it doesn't access
any member variables.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 7c8156b7d2 Remove redundant lines from LVM2_PV_Info functions
Splitting of each cache string on comma "," is performed in
get_pv_attr_by_row() and not needed in the caller functions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood fae040c63e Only lookup LVM2 VG name once in Display_Info()
For LVM2 Physical Volumes the Volume Group name was looked up multiple
times, sometimes from the secondary location of the mount point and at
other times from the primary location in the LVM2_PV_Info class.  Just
lookup the VG name once from the primary location.
2012-08-30 13:47:45 -06:00
Mike Fleetwood ca3d40d9c7 Rename *toggle_swap_mount* -> *toggle_busy*
Rename functions and a variable to use a generic term for the menu item
which changes the busy state of partitions now that it also activates
and deactivates LVM2 Physical Volumes as well as mounting and unmounting
file systems and enables and disables swap partitions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 590f1377f9 Add fallback implementation to new delete LVM2 PV warning dialog (#670171)
The new delete non-empty LVM2 Physical Volume warning dialog uses
Gtk::MessageDialog::get_message_area() in the display of Volume Group
members.  This function was new in gtkmm 2.22, released September 2010,
which is not available in a number of current distributions including:
Unbuntu 10.04 LTS, RHEL 6.3, SLES 11-SP2, Debian 6.0.

Implement fallback method to display the VG name and member PVs in the
warning dialog for when get_message_area() is not available.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 69c8acce75 Add warning dialog when deleting non-empty LVM2 PVs (#670171)
When attempting to delete a non-empty LVM2 Physical Volume (one which is
still a member of a Volume Group) display a warning dialog which
includes the VG name and a list of the PV members to allow the user to
make an informed choice whether to go ahead and perform the deletion or
cancel to the operation.  This dialog is displayed when a partition
containing a PV is being deleted or being overwritten by being
reformatted or pasted into.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 307f489177 Add LVM2 VG member details to the Information dialog (#670171)
For LVM2 Physical Volumes display the Volume Group name and all the
members in the Information dialog.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 1a62354995 Implement LVM2 PV remove() method (#670171)
Implement remove() method so that the LVM2 metadata is updated to
reflect the removal of the LVM2 Physical Volume as well as removing the
signature from the PV before the partition is deleted or overwritten.
    lvm pvremove /dev/DEVICE

Also specifically force the removal of the PV when it is a member of a
Volume Group so that it will succeed.

RATIONAL:

If the PV was not removed before the partition was deleted or
overwritten, LVM2 would be left in a broken state with metadata
describing missing PVs for any partially deleted VGs.  This leaves the
user needing to perform recovery of a lost PV, which required in depth
understanding of LVM2 and is beyond the scope of what GParted can
currently provide.

The alternative is to use the pvremove command to instruct LVM2 to
remove the PV and update LVM2 metadata to reflect the removal of the PV.
For PVs which are a member of a VG this includes forcing the removal.
This has the impact of making recovery from accidental deletion of a
partition containing a PV irrecoverable.  GParted is not able to recover
this situation anyway because Device -> Attempt Data Rescue, using the
gpart command, is not able to detect the signature of an LVM2 PV.

Choose to remove the PV, forcibly if required, rather than potentially
leave LVM2 with missing PVs.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 795a92f5b2 Add file system specific remove() methods (#670171)
This commit only adds a remove() method to every file system and an
optional call to it in the relevant operations.  All remove() methods
are no operations and not enabled.

The remove() method provides explicit controlled removal of a file
system before the partition is deleted or overwritten by being formatted
or pasted into.  When implemented, it appears as an extra step in the
relevant operation.  The file system specific remove() method is
explicitly allowed to fail and stop the operations currently being
applied.

This is different to the existing erase_filesystem_signatures() which
wipes any previous file system signatures immediately before a new file
system is written to ensure there is no possibility of the partition
containing two or more different file system signatures.  It never fails
or reports anything to the user.

NOTE:
Most file systems should NOT implement a remove() method as it will
prevent recovery from accidental partition deletion.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 566ebc1b88 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
2012-08-30 13:47:45 -06:00
Mike Fleetwood 619bda5d8b Enable LVM2 VG activation / deactivation (#670171)
In the Partition menu enable activation / deactivation of the LVM2
Volume Group of which the Physical Volume is a member.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood c3ab62591b Add creation of LVM2 PVs (#670171)
Add creation of Physical Volumes specifying LVM2 metatdata format:
    lvm pvcreate -M 2 /dev/DEVICE

Also set the partition type to identify its contents as LVM.  Note that
libparted treats every partition type as a file system except LVM which
it treats as a flag, hence GParted displaying "lvm" in the Manage Flags
dialog.  Never the less libparted set the partition types correctly.
For MBR partitioning the type is 8e "Linux LVM" and for GPT partitioning
the type is E6D6D379-F507-44C2-A23C-238F2A3DF928.  Setting the partition
type as LVM is not strictly required as LVM2 scans the contents of all
partitions looking for PVs, but it is best practice.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 87625c2b0a Prevent crash from pressing Esc in dialogs with number entry (#682658)
Steps to reproduce:
1) Open any of these dialogs: Create New Partition, Resize/Move or
   Paste;
2) Update any of the following numeric entry fields to a different value
   using the keyboard: Free space preceding, New size or Free space
   following;
3) Press [Esc] key;
Gparted crashes.

What is happening is that the [Esc] key is leading to the dialog being
closed and calling the ~Dialog_Base_Partition() destructor.  However
after this the GTK widget is calling the on_spinbutton_value_change()
registered callbacks for the change to the other two values, on the now
just deleted object.

Fix by disconnecting the change notification callbacks in the
destructor.

Closes bug #682658 - GParted crash by pressing Esc in dialogs with
                     number entry
2012-08-30 13:14:04 -06:00
Fran Diéguez 34cf70f41d Updated Galician translations 2012-08-30 14:40:14 +02:00
Chao-Hsiung Liao 770fab8ca4 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2012-08-11 21:31:27 +08:00
Curtis Gedak c0a9673146 Append -git to version for continuing development 2012-08-08 10:18:16 -06:00
Curtis Gedak e606eae836 ========== gparted-0.13.1 ========== 2012-08-08 09:26:05 -06:00
Tom Tryfonidis d5f380aff6 Updated Greek translation 2012-08-07 14:49:30 +03:00
Мирослав Николић 08be77cbcc Updated Serbian translation 2012-08-07 08:50:39 +02:00
Aurimas Černius 7748a73532 Updated Lithuanian translation 2012-08-05 17:20:31 +03:00
Yngve Spjeld Landro e28f5ff45e Added Norwegian Nynorsk translation 2012-08-05 14:43:58 +02:00
Joan Lledó 14374c19f3 Fix failure creating read-only view of rescued file systems (#680740)
The mount of lost file systems that were larger than a 32 bit integer
could hold (~2 GiB), or started after the first ~2 GiB of disk, would
fail.

Closes Bug #680740 - Gparted fails when mounting the read-only view of
                     lost filesystems
2012-07-31 10:34:14 -06:00
Baurzhan Muftakhidinov eb74ed69b8 Updated Kazakh translation 2012-07-26 09:16:32 +06:00
Wylmer Wang c472b60046 Update Chinese translation 2012-07-17 21:40:49 +08:00
Christian Kirbach 204a3448f2 Updated German translation 2012-07-15 13:39:27 +02:00
Enrico Nicoletto ba3e44c52f Updated Brazilian Portuguese translation 2012-07-13 17:36:15 -03:00
Curtis Gedak 3d7ea276c5 Minor spelling and word changes to NEWS for last release 2012-07-13 10:39:41 -06:00
Curtis Gedak 6a68734a1e Append -git to version for continuing development 2012-07-13 10:38:04 -06:00
Curtis Gedak 09761dd0d4 ========== gparted-0.13.0 ========== 2012-07-13 09:21:19 -06:00
Curtis Gedak e5c7172440 Add more contributors to AUTHORS
Scanned ChangeLog and added some GParted code contributors that had
been accidentally missed from being included in the AUTHORS file.
2012-07-12 15:12:59 -06:00
Aleksej Kabanov 0f0af430e6 Updated Russian translation 2012-07-11 23:40:10 +04:00
Aleksej Kabanov 49c3bfea29 Updated Russian translation 2012-07-11 12:57:01 +04:00
Alexander Shopov ce1bf8693b Updated Bulgarian translation 2012-07-10 21:14:36 +03:00
Alexander Shopov a921e65cec Updated Bulgarian translation 2012-07-10 20:40:19 +03:00
Mike Fleetwood a6ff181faf Make btrfs_size_*() static member functions
The member functions btrfs_size_to_num(), btrfs_size_max_delta() and
btrfs_size_to_gdouble() don't access any member variables.  Therefore
they don't need the const qualifier allowing them to be called when the
btrfs object is const for read-only access to member variables, but
instead need to be static member functions with no access to member
variables.
2012-07-08 12:12:16 -06:00
Milo Casagrande 9020d6cced [l10n] Updated Italian translation. 2012-07-05 22:28:31 +02:00
Andika Triwidada ff441f85b9 Updated Indonesian translation 2012-07-05 23:08:39 +07:00
Piotr Drąg 7bae117213 Updated Polish translation 2012-07-05 17:50:57 +02:00
Curtis Gedak 9591b2de08 Provide credit in About dialog for significant contributions (#678486)
Closes Bug #678486 - Provide Credit in About Dialog for Significant
                     Contributions
2012-06-30 11:27:25 -06:00
Curtis Gedak 66961a9057 Reorder names and add significant contribution reminder to AUTHORS 2012-06-30 11:15:44 -06:00
Curtis Gedak 14f48809ff Update AUTHORS
Update email address for Seth Heeren
2012-06-30 11:02:59 -06:00
Curtis Gedak 6a6607e1c6 Avoid end partition overlap when resizing extended partition (#678831)
When resizing an extended partition, a problem can occur with MiB
alignment wherein the requested end sector could be less than the end
sector of the last logical partition.  This would be an invalid
geometry because all the logical partitions must be wholly contained
within the extended partition.

Check for this situation and if found then set requested end for
the extended partition to the end of the last logical partition.

Closes Bug #678831 - Partition End Overlap when Resizing Extended
                     Partition
2012-06-30 10:47:40 -06:00
Mike Fleetwood 367945bbb2 Restore original logic regarding negative values in get_usage_triple()
Restore intended logic accidentally changed by my recent commit:

    Simplify calc_usage_triple() interface and rename
    6c96ab34b3

Set each display integer to zero if the associated usage value is
negative, rather than setting 100% unused for unknown usage.  Graphical
display of partition usage for unknown and unsupported file system types
is not affected and continues to be all white because of the logic in
the callers.
2012-06-30 10:37:13 -06:00
Mike Fleetwood d9e314f82f Remove and rename local variables in Display_Info()
Local variables used, unused and unallocated were hiding class member
variables of the same name.  Remove first two local variables as they
were only accessed once and rename third.
2012-06-26 14:13:31 -06:00
Mike Fleetwood 6c96ab34b3 Simplify calc_usage_triple() interface and rename
Now that every call to calc_usage_triple() just passes usage figures
returned by get_sectors_*(), remove those parameters, call
get_sectors_*() internally and rename to get_usage_triple().
2012-06-26 14:13:31 -06:00
Mike Fleetwood ac3ce5ec2b Simplify main window partition usage graphic code
Stop using fraction_unallocated and fraction_used member variables of
the DrawingAreaVisualDisk class as intermediate storage of partition
usage fractions.  Instead get the figures straight from the partition
class and use the new calc_usage_triple() to directly set pixels widths
for the partition usage graphic.
2012-06-26 14:13:31 -06:00
Mike Fleetwood 67f334a8ac Fix minor unallocated space display issue in the Info dialog (#499202)
For specific partition usage values the right hand border of the
partition graphic in the Information dialog would be displayed as grey
rather than the color assigned to the partition.

Steps to reproduce fault:
    Create 1024 MiB partition
    # lvm pvcreate /dev/sda12
    # lvm vgcreate GParted-VG1 /dev/sda12
    View partition information

Fragment from Dialog_Partition_Info::init_drawingarea():
    139  else if ( partition .sector_usage_known() )
    140  {
    141          used        = Utils::round( ( 400 - BORDER *2 ) / ( dlength / partition .get_sectors_used()   ) ) ;
    142          unused      = Utils::round( ( 400 - BORDER *2 ) / ( dlength / partition .get_sectors_unused() ) ) ;
    143          unallocated = 400 - BORDER *2 - used - unused ;
    144  }

For this issue the above values are both exactly x.5 and both round
upwards, resulting in unallocated being -1.
    used        = round((400 - 8*2)/(2097152.0/8192))    = round(1.5)
    unused      = round((400 - 8*2)/(2097152.0/2088960)) = round(382.5)
    unallocated = 400 - 8*2 - 2 - 383 = -1

The simple fix would be to use floor() instead of round() in the
calculation of either used or unused.  The same fix would also need to
be applied in Display_Info() for the calculation of the percentage
figures.  Unfortunately this simple fix can lead to odd figures when the
used or unused is close to zero and floor() or ceil() is effectively
applied rather than round().  For example:
    Size:           227.23 GiB
    Used:           28.00 KiB   ( 1% )
    Unused:         180.00 GiB  ( 79% )
    Unallocated:    47.23 GiB   ( 20% )
Used figure of 28 KiB in 227 GiB partition should be rounded to 0% but
wasn't.

Write Partition::calc_usage_triple() which calculates the "best" figures
by rounding the smaller two figures and subtracts them from the desired
total for the largest figure.  Apply to the calculation of the partition
usage percentage figures in the Information dialog and the partition
usage graphic in the same dialog and the main window.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-26 14:13:31 -06:00
Wylmer Wang 747d08f2e4 update Simplified Chinese (zh_CN) translation 2012-06-24 01:19:13 +08:00
Curtis Gedak d631c93607 Update credits in about dialog for artwork
Provide credit for the Tango themed icons designed by Sebastian Kraft.
2012-06-21 14:52:04 -06:00