Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54921 - in /trunk/storage/storage/src/include: ep-lvm-dialogs.ycp ep-lvm-lib.ycp
  • From: kmachalkova@xxxxxxxxxxxxxxxx
  • Date: Thu, 22 Jan 2009 17:09:35 -0000
  • Message-id: <E1LQ33f-0004dm-VK@xxxxxxxxxxxxxxxx>
Author: kmachalkova
Date: Thu Jan 22 18:09:35 2009
New Revision: 54921

URL: http://svn.opensuse.org/viewcvs/yast?rev=54921&view=rev
Log:
On deleting VG, ask user whether to delete also
related LVs (if the group is non-empty) (related
to #426907)

Fixme: too verbose now - should delete LVs
non-interactively

Modified:
trunk/storage/storage/src/include/ep-lvm-dialogs.ycp
trunk/storage/storage/src/include/ep-lvm-lib.ycp

Modified: trunk/storage/storage/src/include/ep-lvm-dialogs.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lvm-dialogs.ycp?rev=54921&r1=54920&r2=54921&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-lvm-dialogs.ycp (original)
+++ trunk/storage/storage/src/include/ep-lvm-dialogs.ycp Thu Jan 22 18:09:35
2009
@@ -73,6 +73,27 @@
return ret;
}

+ boolean ConfirmVgDelete( string vgname, list <string> log_volumes )
+ {
+ string lvlist = "";
+
+ foreach( string one_volume, log_volumes, {
+ lvlist = lvlist + one_volume + "\n";
+ });
+
+ //pop-up dialog title
+ return Popup::AnyQuestion( _("Confirm Deleting of Volume Group"),
+ //pop-up dialog message: %1 is vol.group name, %2 is a list of log.
volumes
+ sformat( _("The volume group \"%1\" contains at least one logical
+volume. If you proceed, the following volumes will be deleted:\n
+%2
+Really delete volume group \"%1\" and all related logical volumes?"), vgname,
lvlist),
+ _("Delete"),
+ _("Cancel"),
+ `focus_no
+ );
+
+ }

boolean CheckPeSize(integer pe_size)
{

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=54921&r1=54920&r2=54921&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-lvm-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-lvm-lib.ycp Thu Jan 22 18:09:35 2009
@@ -135,22 +135,31 @@
}

string vgname = substring(device, 5);
-
map<string,map> tg = Storage::GetTargetMap();
- integer count = size(get_lv_names(tg, vgname));
+ //all LVs
+ list<map> parts = tg["/dev/" + vgname, "partitions"]:[];
+ //LV device names
+ list<string> log_volumes = maplist(map part, parts, { return
part["device"]:""; });
+ //how many of those we have?
+ integer count = size(log_volumes);
+
+ boolean proceed = (count > 0) ?
+ //non-empty VG - make sure user wants to delete all LVs
+ ConfirmVgDelete(vgname, log_volumes) :
+ //empty VG - simple
+ Popup::YesNo(sformat(_("Really delete the volume group \"%1\"?"),
vgname));

- if (count > 0)
- {
- // message popup
- Popup::Message(sformat(_("The volume group \"%1\" contains at least
one logical
-volume. It cannot be removed. Remove all logical volumes then
-remove the volume group.
-"), vgname));
- }
- else
+ if (proceed)
{
- // popup text
- if (Popup::YesNo(sformat(_("Really delete the volume group
\"%1\"?"), vgname)))
+ foreach (string one_volume, log_volumes, {
+ if (!EpDeleteDevice(one_volume))
+ {
+ proceed = false;
+ break;
+ }
+ });
+
+ if (proceed)
{
if (Storage::DeleteLvmVg(vgname))
{
@@ -159,6 +168,11 @@
TreePanel::Create();
}
}
+ else
+ {
+ Popup::Error( sformat(_("Deleting volume group \"%1\"
failed."), vgname));
+ //FIXME: some rollback?
+ }
}
}


--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages