Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Sep 20, 2024
1 parent 11a6078 commit 6ba6002
Show file tree
Hide file tree
Showing 4 changed files with 438 additions and 278 deletions.
8 changes: 4 additions & 4 deletions service/lib/agama/storage/config_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def unlimited_size

def auto_size(outline, paths, snapshots)
min_fallbacks = remove_paths(outline.min_size_fallback_for, paths)
min_size_fallbacks = min_fallbacks.map { |p| volume_builder.for(p).min_size }.sum
min = outline.base_min_size + min_size_fallbacks
min_size_fallbacks = min_fallbacks.map { |p| volume_builder.for(p).min_size }
min = min_size_fallbacks.reduce(outline.base_min_size, &:+)

max_fallbacks = remove_paths(outline.max_size_fallback_for, paths)
max_size_fallbacks = max_fallbacks.map { |p| volume_builder.for(p).max_size }.sum
max = outline.base_max_size + max_size_fallbacks
max_size_fallbacks = max_fallbacks.map { |p| volume_builder.for(p).max_size }
max = max_size_fallbacks.reduce(outline.base_max_size, &:+)

if outline.adjust_by_ram?
min = size_with_ram(min)
Expand Down
7 changes: 4 additions & 3 deletions service/lib/agama/storage/config_conversions/from_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require "agama/config"
require "agama/storage/config_builder"
require "agama/storage/config_conversions/from_json_conversions/config"

Expand All @@ -28,11 +29,11 @@ module ConfigConversions
# Config conversion from JSON hash according to schema.
class FromJSON
# @param config_json [Hash]
# @param product_config [Agama::Config]
def initialize(config_json, product_config:)
# @param product_config [Agama::Config, nil]
def initialize(config_json, product_config: nil)
# TODO: Replace product_config param by a ProductDefinition.
@config_json = config_json
@product_config = product_config
@product_config = product_config || Agama::Config.new
end

# Performs the conversion from Hash according to the JSON schema.
Expand Down
Loading

0 comments on commit 6ba6002

Please sign in to comment.