-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Problem The page for configuring storage allows to select the policy for making free space: delete, resize or keep partitions. Those policies affect to all the partitions of the disks used for the installation. But there is no way to select the custom policy in which the user has to choose what to do with each partition (delete, keep or allow to resize). https://trello.com/c/9AhV6aOb/3406-13-agama-ui-for-custom-making-space ## Solution Add a new section to configure the space policy and the actions for the custom policy. The UI solution is based on the mockups for the new storage UI, see https://github.com/openSUSE/agama/blob/master/doc/storage_ui.md. ## Testing * Added new unit tests. * Tested manually. ## Screenshots ![localhost_8080_ (27)](https://github.com/openSUSE/agama/assets/1112304/61802838-57d8-4c6e-a29a-ffb24ecf046a)
- Loading branch information
Showing
60 changed files
with
2,642 additions
and
1,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
service/lib/agama/dbus/storage/interfaces/device/block.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) [2023-2024] 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 "dbus" | ||
|
||
module Agama | ||
module DBus | ||
module Storage | ||
module Interfaces | ||
module Device | ||
# Interface for block devices. | ||
# | ||
# @note This interface is intended to be included by {Agama::DBus::Storage::Device} if | ||
# needed. | ||
module Block | ||
# Whether this interface should be implemented for the given device. | ||
# | ||
# @note Block devices implement this interface. | ||
# | ||
# @param storage_device [Y2Storage::Device] | ||
# @return [Boolean] | ||
def self.apply?(storage_device) | ||
storage_device.is?(:blk_device) | ||
end | ||
|
||
BLOCK_INTERFACE = "org.opensuse.Agama.Storage1.Block" | ||
private_constant :BLOCK_INTERFACE | ||
|
||
# Name of the block device | ||
# | ||
# @return [String] e.g., "/dev/sda" | ||
def block_name | ||
storage_device.name | ||
end | ||
|
||
# Whether the block device is currently active | ||
# | ||
# @return [Boolean] | ||
def block_active | ||
storage_device.active? | ||
end | ||
|
||
# Name of the udev by-id links | ||
# | ||
# @return [Array<String>] | ||
def block_udev_ids | ||
storage_device.udev_ids | ||
end | ||
|
||
# Name of the udev by-path links | ||
# | ||
# @return [Array<String>] | ||
def block_udev_paths | ||
storage_device.udev_paths | ||
end | ||
|
||
# Size of the block device in bytes | ||
# | ||
# @return [Integer] | ||
def block_size | ||
storage_device.size.to_i | ||
end | ||
|
||
# Size of the space that could be theoretically reclaimed by shrinking the device. | ||
# | ||
# @return [Integer] | ||
def block_recoverable_size | ||
storage_device.recoverable_size.to_i | ||
end | ||
|
||
# Name of the currently installed systems | ||
# | ||
# @return [Array<String>] | ||
def block_systems | ||
return @systems if @systems | ||
|
||
filesystems = storage_device.descendants.select { |d| d.is?(:filesystem) } | ||
@systems = filesystems.map(&:system_name).compact | ||
end | ||
|
||
def self.included(base) | ||
base.class_eval do | ||
dbus_interface BLOCK_INTERFACE do | ||
dbus_reader :block_name, "s", dbus_name: "Name" | ||
dbus_reader :block_active, "b", dbus_name: "Active" | ||
dbus_reader :block_udev_ids, "as", dbus_name: "UdevIds" | ||
dbus_reader :block_udev_paths, "as", dbus_name: "UdevPaths" | ||
dbus_reader :block_size, "t", dbus_name: "Size" | ||
dbus_reader :block_recoverable_size, "t", dbus_name: "RecoverableSize" | ||
dbus_reader :block_systems, "as", dbus_name: "Systems" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.