Author: kmachalkova
Date: Tue Feb 3 17:51:07 2009
New Revision: 55216
URL: http://svn.opensuse.org/viewcvs/yast?rev=55216&view=rev
Log: (empty)
Modified:
trunk/storage/storage/src/include/custom_part_check_generated.ycp
trunk/storage/storage/src/include/ep-lib.ycp
trunk/storage/storage/src/include/ep-lvm-lib.ycp
Modified: trunk/storage/storage/src/include/custom_part_check_generated.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_check_generated.ycp?rev=55216&r1=55215&r2=55216&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_check_generated.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_check_generated.ycp Tue Feb 3 17:51:07 2009
@@ -586,13 +586,13 @@
if( used != `UB_NONE )
{
- if( used == `UB_LVM)
+ /*if( used == `UB_LVM)
{
// popup text %2 is a device name, %1 is the volume group name
Popup::Error(sformat(_("The device (%2) belongs to a volume group (%1).
Remove it from the volume group before deleting it.
"),curr_part["used_by"]:"" , part_name) );
- }
+ }*/
if( used == `UB_MD)
{
Modified: trunk/storage/storage/src/include/ep-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lib.ycp?rev=55216&r1=55215&r2=55216&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-lib.ycp Tue Feb 3 17:51:07 2009
@@ -7,6 +7,7 @@
{
textdomain "storage";
+ boolean EpDeleteVolumeGroup(string device);
list<string> AddedToList(list<string> old, list<string> new)
{
@@ -44,6 +45,32 @@
return disk["device"]:"";
}
+ boolean ConfirmDeletingUsedDevice( map part, symbol used_by )
+ {
+ switch (used_by)
+ {
+ case `UB_LVM:
+ if (Popup::AnyQuestion( _("Confirm Deleting Partition Used by LVM"),
+ sformat(_("The selected partition \"%1\" belongs to volume group \"%2\".
+To keep system in consistent state, it is recommended to delete the volume group and
+all its logical volumes before deleting the partition.
+
+Delete partition \"%1\" AND volume group \"%2\" now?"), part["device"]:"", part["used_by_device"]:""),
+ Label::DeleteButton(),
+ Label::CancelButton(),
+ `focus_no
+ ))
+ {
+ return EpDeleteVolumeGroup(part["used_by_device"]:"");
+ }
+ break;
+ //FIXME: add RAID case here
+ default:
+ break;
+ }
+
+ return false;
+ }
/**
* Must be called before removing device.
@@ -145,6 +172,7 @@
// with "delete = true"
y2milestone( "delete part %1", part );
+ boolean ask = true;
/////////////////////////////////////////////////////
// check if the partition can be deleted
@@ -153,18 +181,37 @@
{
return false;
}
- if( part["type"]:`primary != `extended &&
- !check_device_delete( part, false, Stage::initial(),
- disk ))
+
+ if( part["type"]:`primary != `extended )
{
- return false;
+ symbol used_by = check_devices_used( [ part ], false);
+
+ if ( used_by != `UB_NONE)
+ {
+ if (!ConfirmDeletingUsedDevice( part, used_by ))
+ return false;
+ // whatever was using the defice is deleted by now
+ else
+ {
+ // but we must re-read target map to reflect current status
+ // i.e. device is no longer used by now
+ tg = Storage::GetTargetMap();
+ part = Storage::GetPartition(tg, id);
+ // do not ask anymore - user has already confirmed deleting
+ ask = false;
+ }
+ }
+
+ if (!check_device_delete( part, false, Stage::initial(),
+ disk ))
+ return false;
}
/////////////////////////////////////////////////////
// now delete partition!!
// YesNo popup text, %1 is replaced by a device name e.g. /dev/hda1
- if( Popup::YesNo( sformat(_("Really delete %1?"),
+ if( !ask || Popup::YesNo( sformat(_("Really delete %1?"),
part["device"]:"" )))
{
if( (search( id, "/dev/loop")==0 ||
Modified: trunk/storage/storage/src/include/ep-lvm-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lvm-lib.ycp?rev=55216&r1=55215&r2=55216&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-lvm-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-lvm-lib.ycp Tue Feb 3 17:51:07 2009
@@ -125,13 +125,13 @@
}
- void EpDeleteVolumeGroup(string device)
+ boolean EpDeleteVolumeGroup(string device)
{
if (device == nil)
{
// error popup
Popup::Error(_("No volume group selected."));
- return;
+ return false;
}
string vgname = substring(device, 5);
@@ -167,13 +167,17 @@
UpdateNavigationTree(`lvm);
TreePanel::Create();
}
+ return true;
}
else
{
Popup::Error( sformat(_("Deleting volume group \"%1\" failed."), vgname));
//FIXME: some rollback?
+ return false;
}
}
+ else
+ return false;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org