Skip to content

Commit

Permalink
feat(nexus): separate pool configuration from other mayastor configur…
Browse files Browse the repository at this point in the history
…ation

- create new PoolConfig struct to represent pool configuration,
  and remove pool information from existing Config struct
  (resolves CAS-861)

- add new option to specify yaml file to persist pool configuration
  (resolves CAS-862)

- nexus pool configuration is updated (only) when a pool is created or destroyed,
  (resolves CAS-864)

- at startup, attempt to create pools specified in pool configuration YAML

- remove unused information from main nexus configuration

- remove child status configuration and all references to it
  • Loading branch information
cjones1024 committed Jun 9, 2021
1 parent fee98bd commit 0199ebc
Show file tree
Hide file tree
Showing 22 changed files with 441 additions and 736 deletions.
1 change: 1 addition & 0 deletions chart/templates/mayastor-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
- "-g$(MY_POD_IP)"
- "-nnats"
- "-y/var/local/mayastor/config.yaml"
- "-P/var/local/mayastor/pools.yaml"
- "-l{{ include "mayastorCpuSpec" . }}"
- "-pmayastor-etcd"
securityContext:
Expand Down
1 change: 1 addition & 0 deletions deploy/mayastor-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
- "-g$(MY_POD_IP)"
- "-nnats"
- "-y/var/local/mayastor/config.yaml"
- "-P/var/local/mayastor/pools.yaml"
- "-l0"
- "-pmayastor-etcd"
securityContext:
Expand Down
1 change: 0 additions & 1 deletion mayastor/src/bdev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub use nexus::{
VerboseError,
},
nexus_child::{lookup_nexus_child, ChildState, Reason},
nexus_child_status_config,
nexus_label::{GptEntry, GptGuid as Guid, GptHeader},
nexus_metadata::{
MetaDataChildEntry,
Expand Down
1 change: 0 additions & 1 deletion mayastor/src/bdev/nexus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub mod nexus_bdev_rebuild;
pub mod nexus_bdev_snapshot;
mod nexus_channel;
pub(crate) mod nexus_child;
pub mod nexus_child_status_config;
mod nexus_config;
pub mod nexus_fn_table;
pub mod nexus_io;
Expand Down
2 changes: 0 additions & 2 deletions mayastor/src/bdev/nexus/nexus_bdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,6 @@ impl Nexus {
}

if r.await.unwrap() {
// Update the child states to remove them from the config file.
NexusChild::save_state_change();
Ok(())
} else {
Err(Error::NexusDestroy {
Expand Down
8 changes: 0 additions & 8 deletions mayastor/src/bdev/nexus/nexus_bdev_children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ use crate::{
},
nexus_channel::DrEvent,
nexus_child::{ChildState, NexusChild},
nexus_child_status_config::ChildStatusConfig,
},
Reason,
VerboseError,
Expand Down Expand Up @@ -196,9 +195,6 @@ impl Nexus {
// it can never take part in the IO path
// of the nexus until it's rebuilt from a healthy child.
child.fault(Reason::OutOfSync).await;
if ChildStatusConfig::add(&child).is_err() {
error!("Failed to add child status information");
}

// Register event listener for newly added child.
self.register_child_event_listener(&child);
Expand Down Expand Up @@ -275,9 +271,6 @@ impl Nexus {
self.children.remove(idx);
self.child_count -= 1;

// Update child status to remove this child
NexusChild::save_state_change();

self.start_rebuild_jobs(cancelled_rebuilding_children).await;
Ok(())
}
Expand Down Expand Up @@ -349,7 +342,6 @@ impl Nexus {
ChildState::Faulted(_) => {}
_ => {
child.fault(reason).await;
NexusChild::save_state_change();
self.reconfigure(DrEvent::ChildFault).await;
}
}
Expand Down
3 changes: 1 addition & 2 deletions mayastor/src/bdev/nexus/nexus_bdev_rebuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
RemoveRebuildJob,
},
nexus_channel::DrEvent,
nexus_child::{ChildState, NexusChild, Reason},
nexus_child::{ChildState, Reason},
},
VerboseError,
},
Expand Down Expand Up @@ -261,7 +261,6 @@ impl Nexus {
match job.state() {
RebuildState::Completed => {
recovering_child.set_state(ChildState::Open);
NexusChild::save_state_change();
info!(
"Child {} has been rebuilt successfully",
recovering_child.get_name()
Expand Down
5 changes: 1 addition & 4 deletions mayastor/src/bdev/nexus/nexus_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub enum DrEvent {
ChildRemove,
/// Child rebuild event
ChildRebuild,
/// Child status information is being applied
ChildStatusSync,
}

impl NexusChannelInner {
Expand Down Expand Up @@ -297,8 +295,7 @@ impl NexusChannel {
DrEvent::ChildOffline
| DrEvent::ChildRemove
| DrEvent::ChildFault
| DrEvent::ChildRebuild
| DrEvent::ChildStatusSync => unsafe {
| DrEvent::ChildRebuild => unsafe {
spdk_for_each_channel(
device,
Some(NexusChannel::refresh_io_channels),
Expand Down
11 changes: 0 additions & 11 deletions mayastor/src/bdev/nexus/nexus_child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
instances,
nexus_channel::DrEvent,
nexus_child::ChildState::Faulted,
nexus_child_status_config::ChildStatusConfig,
},
nexus_lookup,
Guid,
Expand Down Expand Up @@ -313,7 +312,6 @@ impl NexusChild {
self.set_state(ChildState::Faulted(reason));
}
}
NexusChild::save_state_change();
}

/// Set the child as temporarily offline
Expand All @@ -326,7 +324,6 @@ impl NexusChild {
e.verbose()
);
}
NexusChild::save_state_change();
}

/// Get full name of this Nexus child.
Expand Down Expand Up @@ -371,17 +368,9 @@ impl NexusChild {

let result = self.open(parent_size);
self.set_state(ChildState::Faulted(Reason::OutOfSync));
NexusChild::save_state_change();
result
}

/// Save the state of the children to the config file
pub(crate) fn save_state_change() {
if ChildStatusConfig::save().is_err() {
error!("Failed to save child status information");
}
}

/// Extract a UUID from a URI.
pub(crate) fn uuid(uri: &str) -> Option<String> {
let url = Url::parse(uri).expect("Failed to parse URI");
Expand Down
171 changes: 0 additions & 171 deletions mayastor/src/bdev/nexus/nexus_child_status_config.rs

This file was deleted.

1 change: 0 additions & 1 deletion mayastor/src/bin/casperf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ fn main() {
let mut cfg = Config::default();
cfg.nexus_opts.iscsi_enable = false;
cfg.nexus_opts.nvmf_enable = false;
cfg.sync_disable = true;
cfg
});

Expand Down
Loading

0 comments on commit 0199ebc

Please sign in to comment.