-
Notifications
You must be signed in to change notification settings - Fork 14
/
proposal_settings.rb
93 lines (84 loc) · 3.06 KB
/
proposal_settings.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env ruby
#
# encoding: utf-8
# Copyright (c) [2015] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
require "yast"
require_relative "disk_size"
require "pp"
module Yast
module Storage
#
# User-configurable settings for the storage proposal.
# Those are settings the user can change in the UI.
#
class ProposalUserSettings
include Yast::Logger
attr_accessor :use_lvm, :encrypt_volume_group
attr_accessor :root_filesystem_type, :use_snapshots
attr_accessor :use_separate_home, :home_filesystem_type
attr_accessor :enlarge_swap_for_suspend
def initialize
@use_lvm = false
@encrypt_volume_group = false
@root_filesystem_type = ::Storage::BTRFS
@use_snapshots = true
@use_separate_home = true
@home_filesystem_type = ::Storage::XFS
@enlarge_swap_for_suspend = false
end
end
# Per-product settings for the storage proposal.
# Those settings are read from /control.xml on the installation media.
# The user can directly override the part inherited from UserSettings.
#
class ProposalSettings < ProposalUserSettings
attr_accessor :root_base_size
attr_accessor :root_max_size
attr_accessor :root_space_percent
attr_accessor :btrfs_increase_percentage
attr_accessor :limit_try_home
attr_accessor :lvm_keep_unpartitioned_region
attr_accessor :lvm_desired_size
attr_accessor :lvm_home_max_size
attr_accessor :btrfs_default_subvolume
attr_accessor :home_min_size
attr_accessor :home_max_size
def initialize
super
# Default values taken from SLE-12-SP1
@root_base_size = DiskSize.GiB(3)
@root_max_size = DiskSize.GiB(10)
@root_space_percent = 40
@btrfs_increase_percentage = 300.0
@limit_try_home = DiskSize.GiB(20)
@lvm_keep_unpartitioned_region = false
@lvm_desired_size = DiskSize.GiB(15)
@lvm_home_max_size = DiskSize.GiB(25)
@btrfs_default_subvolume = "@"
# Not yet in control.xml
@home_min_size = DiskSize.GiB(10)
@home_max_size = DiskSize.unlimited
end
def read_from_xml_file(xml_file_name)
# TO DO
end
end
end
end