Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9160238
Do not block storage in SetConfig calls
imobachgs Feb 26, 2026
35b7558
Add an call_future to the actors
imobachgs Feb 26, 2026
115c659
Temporarily disable iSCSI, bootloader and storage monitor code
imobachgs Feb 26, 2026
01e582f
Add a client to interact with the D-Bus service
imobachgs Feb 27, 2026
b03bd4f
Adapt agama-storage to the new storage client
imobachgs Feb 27, 2026
d223c9f
Adapt agama-bootloader to the new storage client
imobachgs Feb 27, 2026
3d4d562
Adapt agama-manager to the new storage client
imobachgs Feb 27, 2026
9d9dfeb
Adapt agama-iscsi to the new storage client
imobachgs Feb 27, 2026
c92a060
Adapt agama-s390 to the new storage client
imobachgs Feb 27, 2026
273e82a
Revert "Add an call_future to the actors"
imobachgs Mar 2, 2026
d5bba05
Make Clippy happy
imobachgs Mar 2, 2026
2fee0f0
Move iSCSI and DASD messages to separate modules
imobachgs Mar 2, 2026
c9f3644
Use Storage1Proxy instead of the old StorageDBusClient
imobachgs Mar 2, 2026
98d4fd6
Move bootloader messages to its own module
imobachgs Mar 3, 2026
a663d28
Update from code review
imobachgs Mar 3, 2026
703c3e3
Do not initialize the DASD proxy
imobachgs Mar 3, 2026
7fc5c33
Make the dasd_proxy field as optional
imobachgs Mar 3, 2026
f4779ea
Load the DASD proxy configuration
imobachgs Mar 3, 2026
11024ce
Fix issues calculation in the storage Monitor
imobachgs Mar 3, 2026
5ee4a12
Drop unused code
imobachgs Mar 3, 2026
53e3223
Update changes files
imobachgs Mar 3, 2026
afa4398
Fix agama-storage initialization in tests
imobachgs Mar 3, 2026
1204e3e
Merge branch 'master' into new-storage-client
imobachgs Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"agama-server",
"agama-software",
"agama-storage",
"agama-storage-client",
"agama-transfer",
"agama-utils",
"agama-users",
Expand Down
1 change: 1 addition & 0 deletions rust/agama-bootloader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition.workspace = true

[dependencies]
agama-utils = { path = "../agama-utils" }
agama-storage-client = { path = "../agama-storage-client" }
anyhow = "1.0.99"
async-trait = "0.1.89"
gettext-rs = { version = "0.7.2", features = ["gettext-system"] }
Expand Down
34 changes: 17 additions & 17 deletions rust/agama-bootloader/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@

use std::collections::HashMap;

use agama_utils::api::bootloader::Config;
use agama_storage_client::message;
use agama_utils::{actor::Handler, api::bootloader::Config};
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use zbus::Connection;

use crate::dbus::BootloaderProxy;

/// Errors that can occur when using the Bootloader client.
#[derive(thiserror::Error, Debug)]
Expand All @@ -38,6 +36,8 @@ pub enum Error {
/// Error parsing or generating JSON data.
#[error("Passed json data is not correct: {0}")]
InvalidJson(#[from] serde_json::Error),
#[error("Storage D-Bus server error: {0}")]
DBusClient(#[from] agama_storage_client::Error),
}

/// Trait defining the interface for the Bootloader client.
Expand Down Expand Up @@ -71,28 +71,27 @@ pub type ClientResult<T> = Result<T, Error>;

/// Client to connect to Agama's D-Bus API for Bootloader management.
#[derive(Clone)]
pub struct Client<'a> {
bootloader_proxy: BootloaderProxy<'a>,
pub struct Client {
storage_dbus: Handler<agama_storage_client::Service>,
kernel_args: HashMap<String, String>,
}

impl<'a> Client<'a> {
pub async fn new(connection: Connection) -> ClientResult<Client<'a>> {
let bootloader_proxy = BootloaderProxy::new(&connection).await?;

impl Client {
pub async fn new(storage_dbus: Handler<agama_storage_client::Service>) -> ClientResult<Client> {
Ok(Self {
bootloader_proxy,
storage_dbus,
kernel_args: HashMap::new(),
})
}
}

#[async_trait]
impl<'a> BootloaderClient for Client<'a> {
impl BootloaderClient for Client {
async fn get_config(&self) -> ClientResult<Config> {
let serialized_string = self.bootloader_proxy.get_config().await?;
let settings = serde_json::from_str(serialized_string.as_str())?;
Ok(settings)
Ok(self
.storage_dbus
.call(message::bootloader::GetConfig)
.await?)
}

async fn set_config(&self, config: &Config) -> ClientResult<()> {
Expand All @@ -103,8 +102,9 @@ impl<'a> BootloaderClient for Client<'a> {
tracing::info!("sending bootloader config {:?}", full_config);
// ignore return value as currently it does not fail and who knows what future brings
// but it should not be part of result and instead transformed to Issue
self.bootloader_proxy
.set_config(serde_json::to_string(&full_config)?.as_str())
let value = serde_json::to_value(&full_config)?;
self.storage_dbus
.call(message::bootloader::SetConfig::new(value))
.await?;
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion rust/agama-bootloader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ pub mod service;
pub use service::{Service, Starter};

pub mod client;
mod dbus;
pub mod message;
pub mod test_utils;
10 changes: 9 additions & 1 deletion rust/agama-bootloader/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub enum Error {
Actor(#[from] actor::Error),
#[error(transparent)]
Client(#[from] client::Error),
#[error("Storage D-Bus server error: {0}")]
DBusClient(#[from] agama_storage_client::Error),
}

/// Builds and spawns the bootloader service.
Expand Down Expand Up @@ -67,7 +69,13 @@ impl Starter {
pub async fn start(self) -> Result<Handler<Service>, Error> {
let client = match self.client {
Some(client) => client,
None => Box::new(Client::new(self.connection.clone()).await?),
None => {
let storage_dbus =
agama_storage_client::service::Starter::new(self.connection.clone())
.start()
.await?;
Box::new(Client::new(storage_dbus).await?)
}
};
let service = Service { client };
let handler = actor::spawn(service);
Expand Down
1 change: 1 addition & 0 deletions rust/agama-iscsi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition.workspace = true
[dependencies]
agama-utils = { path = "../agama-utils" }
agama-storage = { path = "../agama-storage" }
agama-storage-client = { path = "../agama-storage-client" }
thiserror = "2.0.16"
async-trait = "0.1.89"
zbus = "5.7.1"
Expand Down
45 changes: 19 additions & 26 deletions rust/agama-iscsi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

//! Implements a client to access Agama's D-Bus API related to Bootloader management.
//! Implements a client to access Agama's D-Bus API related to iSCSI management.

use crate::dbus::ISCSIProxy;
use agama_storage_client::message;
use agama_utils::actor::Handler;
use agama_utils::api::iscsi::Config;
use agama_utils::api::iscsi::DiscoverConfig;
use async_trait::async_trait;
use serde_json::Value;
use zbus::Connection;

#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(transparent)]
DBus(#[from] zbus::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
#[error("Storage D-Bus server error: {0}")]
DBusClient(#[from] agama_storage_client::Error),
}

pub enum DiscoverResult {
Expand All @@ -49,23 +51,24 @@ pub trait ISCSIClient {
}

#[derive(Clone)]
pub struct Client<'a> {
proxy: ISCSIProxy<'a>,
pub struct Client {
storage_dbus: Handler<agama_storage_client::Service>,
}

impl<'a> Client<'a> {
pub async fn new(connection: Connection) -> Result<Client<'a>, Error> {
let proxy = ISCSIProxy::new(&connection).await?;
Ok(Self { proxy })
impl Client {
pub async fn new(
storage_dbus: Handler<agama_storage_client::Service>,
) -> Result<Client, Error> {
Ok(Self { storage_dbus })
}
}

#[async_trait]
impl<'a> ISCSIClient for Client<'a> {
impl ISCSIClient for Client {
async fn discover(&self, config: DiscoverConfig) -> Result<DiscoverResult, Error> {
let result = self
.proxy
.discover(serde_json::to_string(&config)?.as_str())
.storage_dbus
.call(message::iscsi::Discover::new(config))
.await?;
match result {
0 => Ok(DiscoverResult::Success),
Expand All @@ -74,26 +77,16 @@ impl<'a> ISCSIClient for Client<'a> {
}

async fn get_system(&self) -> Result<Option<Value>, Error> {
let serialized_system = self.proxy.get_system().await?;
let system: Value = serde_json::from_str(serialized_system.as_str())?;
match system {
Value::Null => Ok(None),
_ => Ok(Some(system)),
}
Ok(self.storage_dbus.call(message::iscsi::GetSystem).await?)
}

async fn get_config(&self) -> Result<Option<Config>, Error> {
let serialized_config = self.proxy.get_config().await?;
let value: Value = serde_json::from_str(serialized_config.as_str())?;
match value {
Value::Null => Ok(None),
_ => Ok(Some(Config(value))),
}
Ok(self.storage_dbus.call(message::iscsi::GetConfig).await?)
}

async fn set_config(&self, config: Option<Config>) -> Result<(), Error> {
self.proxy
.set_config(serde_json::to_string(&config)?.as_str())
self.storage_dbus
.call(message::iscsi::SetConfig::new(config))
.await?;
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion rust/agama-iscsi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub mod client;
pub mod message;
pub mod test_utils;

mod dbus;
mod monitor;

use agama_storage as storage;
Expand Down
8 changes: 3 additions & 5 deletions rust/agama-iscsi/src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

use crate::{
dbus::{ISCSIProxy, ProgressChanged, ProgressFinished, SystemChanged},
storage,
};
use crate::storage;
use agama_storage_client::proxies::{ISCSIProxy, ProgressChanged, ProgressFinished, SystemChanged};
use agama_utils::{
actor::Handler,
api::{
Expand Down Expand Up @@ -130,7 +128,7 @@ impl Monitor {

async fn handle_progress_changed(&self, signal: ProgressChanged) -> Result<(), Error> {
let args = signal.args()?;
let progress_data = serde_json::from_str::<ProgressData>(args.progress)?;
let progress_data = serde_json::from_str::<ProgressData>(args.serialized_progress)?;
self.progress
.call(progress::message::SetProgress::new(progress_data.into()))
.await?;
Expand Down
10 changes: 9 additions & 1 deletion rust/agama-iscsi/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub enum Error {
Client(#[from] client::Error),
#[error(transparent)]
Monitor(#[from] monitor::Error),
#[error("Storage D-Bus server error: {0}")]
DBusClient(#[from] agama_storage_client::Error),
}

pub struct Starter {
Expand Down Expand Up @@ -74,7 +76,13 @@ impl Starter {
pub async fn start(self) -> Result<Handler<Service>, Error> {
let client = match self.client {
Some(client) => client,
None => Box::new(Client::new(self.connection.clone()).await?),
None => {
let storage_dbus =
agama_storage_client::service::Starter::new(self.connection.clone())
.start()
.await?;
Box::new(Client::new(storage_dbus).await?)
}
};
let service = Service { client };
let handler = actor::spawn(service);
Expand Down
1 change: 1 addition & 0 deletions rust/agama-manager/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ impl MessageHandler<message::SetConfig> for Service {
/// Sets the user configuration with the given values.
async fn handle(&mut self, message: message::SetConfig) -> Result<(), Error> {
checks::check_stage(&self.progress, Stage::Configuring).await?;
tracing::debug!("DEBUG: SetConfig handler (calling set_config)");
self.set_config(message.config).await
}
}
Expand Down
4 changes: 3 additions & 1 deletion rust/agama-manager/src/tasks/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,14 @@ impl SetConfigAction {
self.progress
.call(progress::message::Next::new(Scope::Manager))
.await?;
self.storage
let future = self
.storage
.call(storage::message::SetConfig::new(
Arc::clone(product),
config.storage.clone(),
))
.await?;
let _ = future.await;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it should raise the future error, if any.


// call bootloader always after storage to ensure that bootloader reflect new storage settings
self.progress
Expand Down
1 change: 1 addition & 0 deletions rust/agama-s390/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition.workspace = true
[dependencies]
agama-utils = { path = "../agama-utils" }
agama-storage = { path = "../agama-storage" }
agama-storage-client = { path = "../agama-storage-client" }
thiserror = "2.0.16"
async-trait = "0.1.89"
zbus = "5.7.1"
Expand Down
2 changes: 0 additions & 2 deletions rust/agama-s390/src/dasd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ pub use client::Client;

pub mod monitor;
pub use monitor::Monitor;

mod dbus;
Loading
Loading