Module: Yast::PartitioningEpLvmDialogsInclude
- Defined in:
- ../../src/include/partitioning/ep-lvm-dialogs.rb
Instance Method Summary (collapse)
- - (Object) CheckLvName(lv_name)
- - (Object) CheckLvNameConflict(lv_name, vg_name, lvs)
- - (Object) CheckNumberOfDevicesForVg(num)
- - (Object) CheckPeSize(pe_size)
- - (Object) CheckVgName(name)
- - (Object) CheckVgNameConflict(name, vgs)
- - (Object) ComputePoolMetadataSize(siz, pesize)
- - (Object) ConfirmVgDelete(vgname, log_volumes)
- - (Object) DlgCreateLogicalVolume(data, _Commit)
- - (Object) DlgCreateVolumeGroupNew(data)
- - (Object) DlgEditLogicalVolume(data)
- - (Object) DlgResizeLogicalVolumeNew(lv_data, vg_data)
- - (Object) DlgResizeVolumeGroup(data, _Commit)
- - (Object) initialize_partitioning_ep_lvm_dialogs(include_target)
- - (Object) MiniWorkflowStepLvName(data)
- - (Object) MiniWorkflowStepLvNameHelptext
- - (Object) MiniWorkflowStepLvSize(data)
- - (Object) MiniWorkflowStepLvSizeHelptext
- - (Object) MiniWorkflowStepResizeVg(data)
- - (Object) MiniWorkflowStepResizeVgHelptext
- - (Object) MiniWorkflowStepVg(data)
- - (Object) MiniWorkflowStepVgHelptext
Instance Method Details
- (Object) CheckLvName(lv_name)
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 160 def CheckLvName(lv_name) ret = true allowed_chars = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "._-+" if Builtins.size(lv_name) == 0 # error popup text Popup.Error(_("Enter a name for the logical volume.")) ret = false elsif Ops.greater_than(Builtins.size(lv_name), 128) # error popup text Popup.Error( _("The name for the logical volume is longer than 128 characters.") ) ret = false elsif Builtins.findfirstnotof(lv_name, allowed_chars) != nil # error popup text Popup.Error( _( "The name for the logical volume contains illegal characters. Allowed\nare alphanumeric characters, \".\", \"_\", \"-\" and \"+\"." ) ) ret = false end UI.SetFocus(Id(:lvname)) if !ret ret end |
- (Object) CheckLvNameConflict(lv_name, vg_name, lvs)
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 191 def CheckLvNameConflict(lv_name, vg_name, lvs) lvs = deep_copy(lvs) if Builtins.contains(lvs, lv_name) # error popup text Popup.Error( Builtins.sformat( _( "A logical volume named \"%1\" already exists\nin volume group \"%2\"." ), lv_name, vg_name ) ) UI.SetFocus(Id(:lvname)) return false end true end |
- (Object) CheckNumberOfDevicesForVg(num)
148 149 150 151 152 153 154 155 156 157 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 148 def CheckNumberOfDevicesForVg(num) if Ops.less_than(num, 1) # error popup Popup.Error(Builtins.sformat(_("Select at least one device."))) UI.SetFocus(Id(:unselected)) return false else return true end end |
- (Object) CheckPeSize(pe_size)
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 127 def CheckPeSize(pe_size) if !Integer.IsPowerOfTwo(pe_size) || Ops.less_than(pe_size, 1024) # error popup, %1, %2 and %3 are replaced by sizes Popup.Error( Builtins.sformat( _( "The data entered is invalid. Insert a physical extent size larger than %1\nin powers of 2, for example, \"%2\" or \"%3\"" ), Storage.KByteToHumanStringOmitZeroes(1), Storage.KByteToHumanStringOmitZeroes(4), Storage.KByteToHumanStringOmitZeroes(4 * 1024) ) ) UI.SetFocus(Id(:pesize)) return false else return true end end |
- (Object) CheckVgName(name)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 34 def CheckVgName(name) ret = true allowed_chars = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "._-+" if Builtins.size(name) == 0 # error popup text Popup.Error(_("Enter a name for the volume group.")) ret = false elsif Ops.greater_than(Builtins.size(name), 128) # error popup text Popup.Error( _("The name for the volume group is longer than 128 characters.") ) ret = false elsif Builtins.substring(name, 0, 1) == "-" # error popup text Popup.Error( _("The name for the volume group must not start with a \"-\".") ) ret = false elsif Builtins.findfirstnotof(name, allowed_chars) != nil # error popup text Popup.Error( _( "The name for the volume group contains illegal characters. Allowed\nare alphanumeric characters, \".\", \"_\", \"-\" and \"+\"." ) ) ret = false end UI.SetFocus(Id(:vgname)) if !ret ret end |
- (Object) CheckVgNameConflict(name, vgs)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 70 def CheckVgNameConflict(name, vgs) vgs = deep_copy(vgs) ret = true if Builtins.contains(vgs, name) # error popup text Popup.Error( Builtins.sformat(_("The volume group \"%1\" already exists."), name) ) ret = false end if !check_vgname_dev(name) # error popup text Popup.Error( Builtins.sformat( _( "The volume group name \"%1\" conflicts\nwith another entry in the /dev directory.\n" ), name ) ) ret = false end UI.SetFocus(Id(:vgname)) if !ret ret end |
- (Object) ComputePoolMetadataSize(siz, pesize)
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 212 def ComputePoolMetadataSize(siz, pesize) chunk = 64 = Ops.divide(Ops.divide(siz, chunk), 1024 / 64) = 2 * 1024 if Ops.less_than(, 2 * 1024) while Ops.less_or_equal(chunk, 1048576) && Ops.greater_than(, 128 * 1024) chunk = Ops.multiply(chunk, 2) = Ops.divide(, 2) end pe_k = Ops.divide(pesize, 1024) = Ops.multiply( Ops.divide(Ops.subtract(Ops.add(, pe_k), 1), pe_k), pe_k ) Builtins.y2milestone( "ComputePoolMetadataSize size:%1 pe:%2 chunk:%3 ret:%4", siz, pe_k, chunk, ) end |
- (Object) ConfirmVgDelete(vgname, log_volumes)
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 100 def ConfirmVgDelete(vgname, log_volumes) log_volumes = deep_copy(log_volumes) ConfirmRecursiveDelete( vgname, log_volumes, #pop-up dialog title _("Confirm Deleting of Volume Group"), #pop-up dialog message part 1: %1 is vol.group name Builtins.sformat( _( "The volume group \"%1\" contains at least one logical volume.\n" + "If you proceed, the following volumes will be unmounted (if mounted)\n" + "and deleted:" ), vgname ), #pop-up dialog message part 2: %1 is vol.group name Builtins.sformat( _( "Really delete volume group \"%1\" and all related logical volumes?" ), vgname ) ) end |
- (Object) DlgCreateLogicalVolume(data, _Commit)
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 963 def DlgCreateLogicalVolume(data, _Commit) _Commit = deep_copy(_Commit) aliases = { "Name" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepLvName_result = MiniWorkflowStepLvName(data_ref); data.value = data_ref.value; _MiniWorkflowStepLvName_result ) end, "Size" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepLvSize_result = MiniWorkflowStepLvSize(data_ref); data.value = data_ref.value; _MiniWorkflowStepLvSize_result ) end, "FormatMount" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepFormatMount_result = MiniWorkflowStepFormatMount( data_ref ); data.value = data_ref.value; _MiniWorkflowStepFormatMount_result ) end, "Password" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepPassword_result = MiniWorkflowStepPassword( data_ref ); data.value = data_ref.value; _MiniWorkflowStepPassword_result ) end, "Commit" => lambda { _Commit.call(data.value) } } sequence = { "Name" => { :next => "Size" }, "Size" => { :next => "FormatMount", :finish => "Commit" }, "FormatMount" => { :next => "Password", :finish => "Commit" }, "Password" => { :finish => "Commit" }, "Commit" => { :finish => :finish } } # dialog title, %1 is a volume group title = Builtins.sformat( _("Add Logical Volume on %1"), Ops.add("/dev/", Ops.get_string(data.value, "vg_name", "error")) ) = MiniWorkflow.Run( title, StorageIcons.lvm_lv_icon, aliases, sequence, "Name" ) == :finish end |
- (Object) DlgCreateVolumeGroupNew(data)
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 460 def DlgCreateVolumeGroupNew(data) aliases = { "TheOne" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepVg_result = MiniWorkflowStepVg(data_ref); data.value = data_ref.value; _MiniWorkflowStepVg_result ) end } sequence = { "TheOne" => { :finish => :finish } } # dialog title title = _("Add Volume Group") = MiniWorkflow.Run( title, StorageIcons.lvm_icon, aliases, sequence, "TheOne" ) == :finish end |
- (Object) DlgEditLogicalVolume(data)
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 1031 def DlgEditLogicalVolume(data) device = Ops.get_string(data.value, "device", "error") aliases = { "FormatMount" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepFormatMount_result = MiniWorkflowStepFormatMount( data_ref ); data.value = data_ref.value; _MiniWorkflowStepFormatMount_result ) end, "Password" => lambda( ) do ( data_ref = arg_ref(data.value); _MiniWorkflowStepPassword_result = MiniWorkflowStepPassword(data_ref); data.value = data_ref.value; _MiniWorkflowStepPassword_result ) end } sequence = { "FormatMount" => { :next => "Password", :finish => :finish }, "Password" => { :finish => :finish } } # dialog title - %1 is a logical volume name, %2 is a volume group title = Builtins.sformat( _("Edit Logical Volume %1 on %2"), Ops.get_string(data.value, "name", ""), Builtins.regexpsub(device, "^(.*)/[^/]*$", "\\1") ) = MiniWorkflow.Run( title, StorageIcons.lvm_lv_icon, aliases, sequence, "FormatMount" ) == :finish end |
- (Object) DlgResizeLogicalVolumeNew(lv_data, vg_data)
1077 1078 1079 1080 1081 1082 1083 1084 1085 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 1077 def DlgResizeLogicalVolumeNew(lv_data, vg_data) vg_data = deep_copy(vg_data) ( lv_data_ref = arg_ref(lv_data.value); _DlgResize_result = DlgResize(lv_data_ref, vg_data); lv_data.value = lv_data_ref.value; _DlgResize_result ) end |
- (Object) DlgResizeVolumeGroup(data, _Commit)
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 732 def DlgResizeVolumeGroup(data, _Commit) _Commit = deep_copy(_Commit) aliases = { "TheOne" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepResizeVg_result = MiniWorkflowStepResizeVg(data_ref); data.value = data_ref.value; _MiniWorkflowStepResizeVg_result ) end, "Commit" => lambda { _Commit.call(data.value) } } sequence = { "TheOne" => { :finish => "Commit" }, "Commit" => { :finish => :finish } } # dialog title title = Builtins.sformat( _("Resize Volume Group %1"), Ops.get_string(data.value, "device", "error") ) = MiniWorkflow.Run( title, StorageIcons.lvm_icon, aliases, sequence, "TheOne" ) == :finish end |
- (Object) initialize_partitioning_ep_lvm_dialogs(include_target)
28 29 30 31 32 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 28 def initialize_partitioning_ep_lvm_dialogs(include_target) textdomain "storage" Yast.include include_target, "partitioning/ep-lib.rb" end |
- (Object) MiniWorkflowStepLvName(data)
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 801 def MiniWorkflowStepLvName(data) Builtins.y2milestone("MiniWorkflowStepLvName data:%1", data.value) target_map = Storage.GetTargetMap vg_name = Ops.get_string(data.value, "vg_name", "error") vg_key = Ops.add("/dev/", vg_name) lvs = get_lv_names(target_map, vg_name) pools = Builtins.maplist( Builtins.filter(Ops.get_list(target_map, [vg_key, "partitions"], [])) do |p| Ops.get_boolean(p, "pool", false) end ) { |l| Ops.get_string(l, "name", "") } lv_name = Ops.get_string(data.value, "name", "") frames = term(:VStackFrames) # heading for frame frames = Builtins.add( frames, term( :FrameWithMarginBox, _("Name"), VBox(Left(InputField(Id(:lvname), _("Logical Volume"), lv_name))) ) ) pool_list = Builtins.maplist(pools) { |n| Item(Id(n), n) } frames = Builtins.add( frames, # heading for frame term( :FrameWithMarginBox, _("Type"), RadioButtonGroup( Id(:type), VBox( # radio button label term( :LeftRadioButton, Id(:normal), Opt(:notify), _("Normal Volume") ), # radio button label term(:LeftRadioButton, Id(:pool), Opt(:notify), _("Thin Pool")), # radio button label term( :LeftRadioButtonWithAttachment, Id(:thin), Opt(:notify), _("Thin Volume"), VBox( Left( term( :ComboBoxSelected, Id(:used_pool), Opt(:notify), # combo box label _("Used Pool"), pool_list, Id(:used_pool) ) ) ) ) ) ) ) ) contents = HVSquash(frames) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepLvNameHelptext() ) MiniWorkflow.SetLastStep(false) UI.SetFocus(Id(:lvname)) used_enab = false if Ops.get_boolean(data.value, "pool", false) ChangeWidgetIfExists(:pool, :Value, true) elsif !Builtins.isempty(Ops.get_string(data.value, "used_pool", "")) || Ops.get_integer(data.value, "max_size_k", 0) == 0 ChangeWidgetIfExists(:thin, :Value, true) if !Builtins.isempty(Ops.get_string(data.value, "used_pool", "")) ChangeWidgetIfExists( :used_pool, :Value, Ops.get_string(data.value, "used_pool", "") ) end used_enab = true elsif Ops.greater_than(Ops.get_integer(data.value, "max_size_k", 0), 0) ChangeWidgetIfExists(:normal, :Value, true) end if Ops.get_integer(data.value, "max_size_k", 0) == 0 ChangeWidgetIfExists(:normal, :Enabled, false) ChangeWidgetIfExists(:pool, :Enabled, false) end ChangeWidgetIfExists(:used_pool, :Enabled, used_enab) = nil begin = MiniWorkflow.UserInput case when :normal, :pool, :thin UI.ChangeWidget(Id(:used_pool), :Enabled, == :thin) when :next lv_name = Convert.to_string(UI.QueryWidget(Id(:lvname), :Value)) if !CheckLvName(lv_name) || !CheckLvNameConflict(lv_name, vg_name, lvs) = :again end end end until == :abort || == :back || == :next if == :next Ops.set(data.value, "name", lv_name) # ChangeVolumeProperties and thus addLogicalVolume need the device Ops.set( data.value, "device", Ops.add( Ops.add(Ops.add("/dev/", vg_name), "/"), Ops.get_string(data.value, "name", "") ) ) if Builtins.haskey(data.value, "used_pool") data.value = Builtins.remove(data.value, "used_pool") end if Builtins.haskey(data.value, "pool") data.value = Builtins.remove(data.value, "pool") end if Convert.to_boolean(UI.QueryWidget(Id(:pool), :Value)) Ops.set(data.value, "pool", true) end if Convert.to_boolean(UI.QueryWidget(Id(:thin), :Value)) Ops.set( data.value, "used_pool", UI.QueryWidget(Id(:used_pool), :Value) ) end end Builtins.y2milestone( "MiniWorkflowStepLvName data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepLvNameHelptext
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 770 def MiniWorkflowStepLvNameHelptext # helptext helptext = _("<p>Enter the name of the new logical volume.</p>") # helptext helptext = Ops.add( helptext, _( "<p>You can declare the logical volume as a <b>Normal Volume</b>.\n" + "This is the default and means plain LVM Volumes like all volumes were before the feature of <b>Thin Provisioning</b> existed.\n" + "If in doubt this is most probably the right choice</p>" ) ) # helptext helptext = Ops.add( helptext, _( "<p>You can declare the logical volume as a <b>Thin Pool</b>.\nThis means <b>Thin Volumes</b> allocate their needed space on demand from such a pool.</p>" ) ) # helptext helptext = Ops.add( helptext, _( "<p>You can declare the logical volume as a <b>Thin Volume</b>.\nThis means the volume allocates needed space on demand from a <b>Thin Pool</b>.</p>" ) ) helptext end |
- (Object) MiniWorkflowStepLvSize(data)
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 512 def MiniWorkflowStepLvSize(data) Builtins.y2milestone("MiniWorkflowStepLvSize data:%1", data.value) min_size_k = Ops.divide(Ops.get_integer(data.value, "pesize", 0), 1024) max_size_k = Ops.get_integer(data.value, "max_size_k", 0) thin = !Builtins.isempty(Ops.get_string(data.value, "used_pool", "")) pool = Ops.get_boolean(data.value, "pool", false) if pool max_size_k = Ops.subtract( max_size_k, ComputePoolMetadataSize( Ops.get_integer(data.value, "max_size_k", 0), Ops.get_integer(data.value, "pesize", 0) ) ) end size_k = Ops.get_integer(data.value, "size_k", max_size_k) what = size_k == max_size_k ? :max_size : :manual_size name = Ops.get_string(data.value, "name", "") max_s = Builtins.sformat( _("Maximum Size (%1)"), Storage.KByteToHumanString(max_size_k) ) if thin what = :manual_size max_size_k = 1024 * 1024 * 1024 * 1024 * 1024 size_k = 2 * 1024 * 1024 pos = Builtins.search(max_s, "(") max_s = Builtins.substring(max_s, 0, pos) if pos != nil end max_stripes = Ops.get_integer(data.value, "max_stripes", 1) stripes = Ops.get_integer(data.value, "stripes", 1) stripe_size = Ops.multiply( Ops.get_integer(data.value, "stripesize", 64), 1024 ) frames = term(:VStackFrames) frames = Builtins.add( frames, term( :FrameWithMarginBox, _("Size"), RadioButtonGroup( Id(:size), VBox( term(:LeftRadioButton, Id(:max_size), Opt(:notify), max_s), term( :LeftRadioButtonWithAttachment, Id(:manual_size), Opt(:notify), _("Custom Size"), VBox( Id(:manual_size_attachment), MinWidth( 15, InputField(Id(:size_input), Opt(:shrinkable), _("Size")) ) ) ) ) ) ) ) stripes_list = Builtins.maplist( Integer.RangeFrom(1, Ops.add(max_stripes, 1)) ) { |i| Item(Id(i), Builtins.tostring(i)) } stripe_sizes_list = Builtins.maplist(Integer.RangeFrom(11, 20)) do |i| Item( Id(Ops.shift_left(2, i)), Storage.ByteToHumanStringOmitZeroes(Ops.shift_left(2, i)) ) end # heading for frame frames = Builtins.add( frames, term( :FrameWithMarginBox, _("Stripes"), HBox( # combo box label Left( term( :ComboBoxSelected, Id(:stripes), Opt(:notify), _("Number"), stripes_list, Id(stripes) ) ), # combo box label Left( term( :ComboBoxSelected, Id(:stripe_size), _("Size"), stripe_sizes_list, Id(stripe_size) ) ), HStretch() ) ) ) contents = HVSquash(frames) #A dialog title - %1 is a logical volume name, %2 is a volume group. MiniWorkflow.SetTitle( Builtins.sformat( _("Add Logical volume %1 on %2"), name, Ops.add("/dev/", Ops.get_string(data.value, "vg_name", "error")) ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepLvSizeHelptext() ) MiniWorkflow.SetLastStep(false) UI.ChangeWidget(Id(:size), :Value, what) UI.ChangeWidget(Id(:max_size), :Enabled, !thin) UI.ChangeWidget( Id(:manual_size_attachment), :Enabled, what == :manual_size ) UI.ChangeWidget( Id(:size_input), :Value, Storage.KByteToHumanString(size_k) ) UI.ChangeWidget(Id(:stripes), :Enabled, !thin) UI.ChangeWidget(Id(:stripe_size), :Enabled, Ops.greater_than(stripes, 1)) = nil begin = MiniWorkflow.UserInput case when :max_size UI.ChangeWidget(Id(:manual_size_attachment), :Enabled, false) when :manual_size UI.ChangeWidget(Id(:manual_size_attachment), :Enabled, true) UI.SetFocus(Id(:size_input)) when :stripes stripes = Convert.to_integer(UI.QueryWidget(Id(:stripes), :Value)) UI.ChangeWidget( Id(:stripe_size), :Enabled, Ops.greater_than(stripes, 1) ) when :next what = Convert.to_symbol(UI.QueryWidget(Id(:size), :Value)) if what == :manual_size tmp = Convert.to_string(UI.QueryWidget(Id(:size_input), :Value)) if !( size_k_ref = arg_ref(size_k); _HumanStringToKByteWithRangeCheck_result = Storage.HumanStringToKByteWithRangeCheck( tmp, size_k_ref, min_size_k, max_size_k ); size_k = size_k_ref.value; _HumanStringToKByteWithRangeCheck_result ) Popup.Error( Builtins.sformat( _( "The size entered is invalid. Enter a size between %1 and %2." ), Storage.KByteToHumanString(min_size_k), Storage.KByteToHumanString(max_size_k) ) ) = :again end end stripes = Convert.to_integer(UI.QueryWidget(Id(:stripes), :Value)) stripe_size = Convert.to_integer( UI.QueryWidget(Id(:stripe_size), :Value) ) end end until == :abort || == :back || == :next if == :next case what when :max_size Ops.set(data.value, "size_k", max_size_k) when :manual_size Ops.set(data.value, "size_k", size_k) end Ops.set(data.value, "stripes", stripes) Ops.set(data.value, "stripesize", Ops.divide(stripe_size, 1024)) = :finish if Ops.get_boolean(data.value, "pool", false) end Builtins.y2milestone( "MiniWorkflowStepLvSize data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepLvSizeHelptext
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 487 def MiniWorkflowStepLvSizeHelptext # helptext helptext = _( "<p>Enter the size as well as the number and size\n" + "of stripes for the new logical volume. The number of stripes cannot be higher\n" + "than the number of physical volumes of the volume group.</p>" ) # helptext helptext = Ops.add( helptext, _( "<p>So called <b>Thin Volumes</b> can created\n" + "with arbitrary volume size. The space required is taken on demand from the \n" + "assigned <b>Thin Pool</b>. So one can create Thin Volume of a size larger\n" + "than the Thin Pool. Of course when there is really data written to a Thin\n" + "Volume, the assigned Thin Pool must be able to meet this space requirement.\n" + "Thin Volumes cannot have a Stripe Count." ) ) helptext end |
- (Object) MiniWorkflowStepResizeVg(data)
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 386 def MiniWorkflowStepResizeVg(data) Builtins.y2milestone("MiniWorkflowStepResizeVg data:%1", data.value) vgname = Ops.get_string(data.value, "name", "error") pvs_new = [] fields = StorageSettings.FilterTable( [:device, :udev_path, :udev_id, :size, :encrypted, :type] ) target_map = Storage.GetTargetMap unused_pvs = Builtins.filter(get_possible_pvs(target_map)) do |pv| !Storage.IsUsedBy(pv) end used_pvs = Builtins.filter(get_possible_pvs(target_map)) do |pv| Ops.get_string(pv, "used_by_device", "") == Ops.add("/dev/", vgname) end contents = VBox() contents = Builtins.add( contents, DevicesSelectionBox.Create( unused_pvs, used_pvs, fields, nil, _("Available Physical Volumes:"), _("Selected Physical Volumes:"), false ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepResizeVgHelptext() ) MiniWorkflow.SetLastStep(true) = nil begin = MiniWorkflow.UserInput DevicesSelectionBox.Handle() case when :next pvs_new = Builtins.maplist(DevicesSelectionBox.GetSelectedDevices) do |pv| Ops.get_string(pv, "device", "") end if !CheckNumberOfDevicesForVg(Builtins.size(pvs_new)) = :again end # TODO: overall size check end end until == :abort || == :back || == :next if == :next Ops.set(data.value, "devices_new", pvs_new) = :finish end Builtins.y2milestone( "MiniWorkflowStepResizeVg data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepResizeVgHelptext
376 377 378 379 380 381 382 383 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 376 def MiniWorkflowStepResizeVgHelptext # helptext helptext = _( "<p>Change the devices that are used for the volume group.</p>" ) helptext end |
- (Object) MiniWorkflowStepVg(data)
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 252 def MiniWorkflowStepVg(data) Builtins.y2milestone("MiniWorkflowStepVg data:%1", data.value) target_map = Storage.GetTargetMap vgs = get_vgs(target_map) vgname = Builtins.size(vgs) == 0 ? "system" : "" pesize = 4 * 1024 * 1024 pvs = [] fields = StorageSettings.FilterTable( [:device, :udev_path, :udev_id, :size, :encrypted, :type] ) unused_pvs = Builtins.filter(get_possible_pvs(target_map)) do |pv| !Storage.IsUsedBy(pv) end contents = VBox() pesizes_list = Builtins.maplist(Integer.RangeFrom(19, 26)) do |i| Item( Id(Ops.shift_left(2, i)), Storage.ByteToHumanStringOmitZeroes(Ops.shift_left(2, i)) ) end # label for input field contents = Builtins.add( contents, Left(InputField(Id(:vgname), _("Volume Group Name"))) ) contents = Builtins.add( contents, Left( term( :ComboBoxSelected, Id(:pesize), Opt(:editable), # label for combo box _("&Physical Extent Size"), pesizes_list, Id(pesize) ) ) ) contents = Builtins.add( contents, DevicesSelectionBox.Create( unused_pvs, [], fields, nil, # label for selection box _("Available Physical Volumes:"), # label for selection box _("Selected Physical Volumes:"), false ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepVgHelptext() ) MiniWorkflow.SetLastStep(true) UI.SetFocus(Id(:vgname)) = nil begin = MiniWorkflow.UserInput DevicesSelectionBox.Handle() case when :next vgname = Convert.to_string(UI.QueryWidget(Id(:vgname), :Value)) tmp = UI.QueryWidget(Id(:pesize), :Value) if Ops.is_integer?(tmp) pesize = Convert.to_integer(tmp) elsif !( pesize_ref = arg_ref(pesize); _HumanStringToByte_result = Storage.HumanStringToByte( Convert.to_string(tmp), pesize_ref ); pesize = pesize_ref.value; _HumanStringToByte_result ) pesize = 0 end # will trigger error below pvs = Builtins.maplist(DevicesSelectionBox.GetSelectedDevices) do |pv| Ops.get_string(pv, "device", "") end if !CheckVgName(vgname) || !CheckVgNameConflict(vgname, vgs) || !CheckPeSize(pesize) || !CheckNumberOfDevicesForVg(Builtins.size(pvs)) = :again end end end until == :abort || == :back || == :next if == :next Ops.set(data.value, "name", vgname) Ops.set(data.value, "pesize", pesize) Ops.set(data.value, "devices", pvs) = :finish end Builtins.y2milestone( "MiniWorkflowStepVg data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepVgHelptext
236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File '../../src/include/partitioning/ep-lvm-dialogs.rb', line 236 def MiniWorkflowStepVgHelptext # helptext helptext = _( "<p>Enter the name and physical extent size of the new volume group.</p>" ) # helptext helptext = Ops.add( helptext, _("<p>Select the physical volumes the volume group should contain.</p>") ) helptext end |