Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"agama-manager",
"agama-proxy",
"agama-network",
"agama-s390",
"agama-security",
"agama-server",
"agama-software",
Expand All @@ -22,7 +23,6 @@ members = [
"suseconnect-agama/suseconnect-agama-sys",
"xtask",
"zypp-agama",
"zypp-agama/zypp-agama-sys",
"zypp-agama/zypp-agama-sys"
]
resolver = "2"
Expand Down
14 changes: 8 additions & 6 deletions rust/agama-iscsi/src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ impl Monitor {
continue;
}
if let Some(signal) = ProgressChanged::from_message(message.clone()) {
self.handle_progress_changed(signal)?;
self.handle_progress_changed(signal).await?;
continue;
}
if let Some(signal) = ProgressFinished::from_message(message.clone()) {
self.handle_progress_finished(signal)?;
self.handle_progress_finished(signal).await?;
continue;
}
tracing::warn!("Unmanaged iSCSI signal: {message:?}");
Expand All @@ -129,17 +129,19 @@ impl Monitor {
Ok(())
}

fn handle_progress_changed(&self, signal: ProgressChanged) -> Result<(), Error> {
async fn handle_progress_changed(&self, signal: ProgressChanged) -> Result<(), Error> {
let args = signal.args()?;
let progress_data = serde_json::from_str::<ProgressData>(args.progress)?;
self.progress
.cast(progress::message::SetProgress::new(progress_data.into()))?;
.call(progress::message::SetProgress::new(progress_data.into()))
.await?;
Ok(())
}

fn handle_progress_finished(&self, _signal: ProgressFinished) -> Result<(), Error> {
async fn handle_progress_finished(&self, _signal: ProgressFinished) -> Result<(), Error> {
self.progress
.cast(progress::message::Finish::new(Scope::ISCSI))?;
.call(progress::message::Finish::new(Scope::ISCSI))
.await?;
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-iscsi/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl ISCSIClient for TestClient {
}
}

/// Starts a testing storage service.
/// Starts a testing iSCSI service.
pub async fn start_service(
storage: Handler<storage::Service>,
events: event::Sender,
Expand Down
1 change: 1 addition & 0 deletions rust/agama-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ agama-hostname = { path = "../agama-hostname" }
agama-iscsi = { path = "../agama-iscsi" }
agama-l10n = { path = "../agama-l10n" }
agama-network = { path = "../agama-network" }
agama-s390 = { path = "../agama-s390" }
agama-security = { path = "../agama-security" }
agama-software = { path = "../agama-software" }
agama-storage = { path = "../agama-storage" }
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) [2025] SUSE LLC
// Copyright (c) [2025-2026] SUSE LLC
//
// All Rights Reserved.
//
Expand Down Expand Up @@ -32,6 +32,7 @@ pub use agama_iscsi as iscsi;
pub use agama_l10n as l10n;
pub use agama_network as network;
pub use agama_proxy as proxy;
pub use agama_s390 as s390;
pub use agama_security as security;
pub use agama_software as software;
pub use agama_storage as storage;
Expand Down
71 changes: 64 additions & 7 deletions rust/agama-manager/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) [2025] SUSE LLC
// Copyright (c) [2025-2026] SUSE LLC
//
// All Rights Reserved.
//
Expand All @@ -19,8 +19,8 @@
// find current contact information at www.suse.com.

use crate::{
bootloader, checks, files, hardware, hostname, iscsi, l10n, message, network, proxy, security,
software, storage, tasks, users,
bootloader, checks, files, hardware, hostname, iscsi, l10n, message, network, proxy, s390,
security, software, storage, tasks, users,
};
use agama_utils::{
actor::{self, Actor, Handler, MessageHandler},
Expand All @@ -30,6 +30,7 @@ use agama_utils::{
status::Stage,
Action, Config, Event, FinishMethod, Issue, IssueMap, Proposal, Scope, Status, SystemInfo,
},
arch::Arch,
issue, licenses,
products::{self, ProductSpec},
progress, question,
Expand Down Expand Up @@ -93,6 +94,8 @@ pub enum Error {
PendingIssues { issues: HashMap<Scope, Vec<Issue>> },
#[error(transparent)]
Users(#[from] users::service::Error),
#[error(transparent)]
S390(#[from] s390::service::Error),
}

pub struct Starter {
Expand All @@ -113,6 +116,7 @@ pub struct Starter {
progress: Option<Handler<progress::Service>>,
hardware: Option<hardware::Registry>,
users: Option<Handler<users::Service>>,
s390: Option<Handler<s390::Service>>,
}

impl Starter {
Expand All @@ -139,21 +143,25 @@ impl Starter {
progress: None,
hardware: None,
users: None,
s390: None,
}
}

pub fn with_bootloader(mut self, bootloader: Handler<bootloader::Service>) -> Self {
self.bootloader = Some(bootloader);
self
}

pub fn with_hostname(mut self, hostname: Handler<hostname::Service>) -> Self {
self.hostname = Some(hostname);
self
}

pub fn with_iscsi(mut self, iscsi: Handler<iscsi::Service>) -> Self {
self.iscsi = Some(iscsi);
self
}

pub fn with_network(mut self, network: NetworkSystemClient) -> Self {
self.network = Some(network);
self
Expand Down Expand Up @@ -193,6 +201,7 @@ impl Starter {
self.proxy = Some(proxy);
self
}

pub fn with_progress(mut self, progress: Handler<progress::Service>) -> Self {
self.progress = Some(progress);
self
Expand All @@ -208,6 +217,11 @@ impl Starter {
self
}

pub fn with_s390(mut self, s390: Handler<s390::Service>) -> Self {
self.s390 = Some(s390);
self
}

/// Starts the service and returns a handler to communicate with it.
pub async fn start(self) -> Result<Handler<Service>, Error> {
let issues = match self.issues {
Expand Down Expand Up @@ -333,6 +347,25 @@ impl Starter {
}
};

let s390 = match self.s390 {
Some(s390) => Some(s390),
None => {
if !Arch::is_s390() {
None
} else {
let s390 = s390::Service::starter(
storage.clone(),
self.events.clone(),
progress.clone(),
self.dbus.clone(),
)
.start()
.await?;
Some(s390)
}
}
};

let runner = tasks::TasksRunner {
bootloader: bootloader.clone(),
files: files.clone(),
Expand All @@ -348,6 +381,7 @@ impl Starter {
software: software.clone(),
storage: storage.clone(),
users: users.clone(),
s390: s390.clone(),
};
let tasks = actor::spawn(runner);

Expand All @@ -361,10 +395,8 @@ impl Starter {
l10n,
network,
proxy,
security,
software,
storage,
files,
products: products::Registry::default(),
licenses: licenses::Registry::default(),
hardware,
Expand All @@ -373,6 +405,7 @@ impl Starter {
product: None,
users,
tasks,
s390,
};

service.setup().await?;
Expand All @@ -386,11 +419,9 @@ pub struct Service {
iscsi: Handler<iscsi::Service>,
proxy: Handler<proxy::Service>,
l10n: Handler<l10n::Service>,
security: Handler<security::Service>,
software: Handler<software::Service>,
network: NetworkSystemClient,
storage: Handler<storage::Service>,
files: Handler<files::Service>,
issues: Handler<issue::Service>,
progress: Handler<progress::Service>,
questions: Handler<question::Service>,
Expand All @@ -401,6 +432,7 @@ pub struct Service {
config: Config,
system: manager::SystemInfo,
users: Handler<users::Service>,
s390: Option<Handler<s390::Service>>,
tasks: Handler<tasks::TasksRunner>,
}

Expand Down Expand Up @@ -487,6 +519,13 @@ impl Service {
Ok(())
}

async fn probe_dasd(&self) -> Result<(), Error> {
if let Some(s390) = &self.s390 {
s390.call(s390::message::ProbeDASD).await?;
}
Ok(())
}

fn set_product(&mut self, config: &Config) -> Result<(), Error> {
self.product = None;
self.update_product(config)
Expand Down Expand Up @@ -577,6 +616,12 @@ impl MessageHandler<message::GetSystem> for Service {
let iscsi = self.iscsi.call(iscsi::message::GetSystem).await?;
let network = self.network.get_system().await?;

let s390 = if let Some(s390) = &self.s390 {
Some(s390.call(s390::message::GetSystem).await?)
} else {
None
};

// If the software service is busy, it will not answer.
let software = if self.is_software_available().await? {
self.software.call(software::message::GetSystem).await?
Expand All @@ -592,6 +637,7 @@ impl MessageHandler<message::GetSystem> for Service {
network,
storage,
iscsi,
s390,
software,
})
}
Expand Down Expand Up @@ -621,6 +667,12 @@ impl MessageHandler<message::GetExtendedConfig> for Service {
let storage = self.storage.call(storage::message::GetConfig).await?;
let users = self.users.call(users::message::GetConfig).await?;

let s390 = if let Some(s390) = &self.s390 {
Some(s390.call(s390::message::GetConfig).await?)
} else {
None
};

// If the software service is busy, it will not answer.
let software = if self.is_software_available().await? {
Some(self.software.call(software::message::GetConfig).await?)
Expand All @@ -641,6 +693,7 @@ impl MessageHandler<message::GetExtendedConfig> for Service {
storage,
files: None,
users: Some(users),
s390,
})
}
}
Expand Down Expand Up @@ -745,6 +798,10 @@ impl MessageHandler<message::RunAction> for Service {
checks::check_stage(&self.progress, Stage::Configuring).await?;
self.probe_storage().await?;
}
Action::ProbeDASD => {
checks::check_stage(&self.progress, Stage::Configuring).await?;
self.probe_dasd().await?;
}
Action::Install => {
self.tasks.cast(tasks::message::Install)?;
}
Expand Down
Loading
Loading