async fn on_rebuild_complete_job(
        &mut self,
        job: &RebuildJob,
    ) -> Result<(), Error> {
        let recovering_child = self.get_child_by_name(&job.destination)?;

        match job.state() {
            RebuildState::Completed => {
                recovering_child.out_of_sync(false);
                info!(
                    "Child {} has been rebuilt successfully",
                    recovering_child.name
                );

                assert_eq!(recovering_child.status(), ChildStatus::Online);
            }
            RebuildState::Stopped => {
                info!(
                    "Rebuild job for child {} of nexus {} stopped",
                    &job.destination, &self.name,
                );
            }
            RebuildState::Failed => {
                // rebuild has failed so we need to set the child as faulted
                // allowing the control plane to replace it with another
                if let Some(RebuildError::ReadIoError {
                    ..
                }) = job.error
                {
                    // todo: retry rebuild using another child as source?
                }
                recovering_child.fault();
                error!(
                    "Rebuild job for child {} of nexus {} failed, error: {}",
                    &job.destination,
                    &self.name,
                    job.error_desc(),
                );
            }
            _ => {
                recovering_child.fault();
                error!(
                    "Rebuild job for child {} of nexus {} failed with state {:?}",
                    &job.destination,
                    &self.name,
                    job.state(),
                );
            }
        }

        self.reconfigure(DREvent::ChildRebuild).await;
        Ok(())
    }
/// On rebuild job completion it updates the child and the nexus
/// based on the rebuild job's final state
On rebuild job completion it updates the child and the nexus
based on the rebuild job's final state
On rebuild job completion it updates the child and the nexus based on the rebuild job ' s final state
async fn on_rebuild_complete_job(
        &mut self,
        job: &RebuildJob,
    ) -> Result<(), Error> {
        let recovering_child = self.get_child_by_name(&job.destination)?;
        match job.state() {
            RebuildState::Completed => {
                recovering_child.out_of_sync(false);
                info!(
                    "Child {} has been rebuilt successfully",
                    recovering_child.name
                );
                assert_eq!(recovering_child.status(), ChildStatus::Online);
            }
            RebuildState::Stopped => {
                info!(
                    "Rebuild job for child {} of nexus {} stopped",
                    &job.destination, &self.name,
                );
            }
            RebuildState::Failed => {
                // rebuild has failed so we need to set the child as faulted
                // allowing the control plane to replace it with another
                if let Some(RebuildError::ReadIoError {
                    ..
                }) = job.error
                {
                    // todo: retry rebuild using another child as source?
                }
                recovering_child.fault();
                error!(
                    "Rebuild job for child {} of nexus {} failed, error: {}",
                    &job.destination,
                    &self.name,
                    job.error_desc(),
                );
            }
            _ => {
                recovering_child.fault();
                error!(
                    "Rebuild job for child {} of nexus {} failed with state {:?}",
                    &job.destination,
                    &self.name,
                    job.state(),
                );
            }
        }
        self.reconfigure(DREvent::ChildRebuild).await;
        Ok(())
    }
async fn on_rebuild_complete_job ( & mut self , job : & RebuildJob , ) -> Result < ( ) , Error > { let recovering_child = self . get_child_by_name ( & job . destination ) ? ; match job . state ( ) { RebuildState :: Completed => { recovering_child . out_of_sync ( false ) ; info ! ( " " recovering_child name ) ; assert_eq ! ( recovering_child status ( ) ChildStatus Online ) ; } RebuildState :: Stopped => { info ! ( " " job destination self name ) ; } RebuildState :: Failed => { // rebuild has failed so we need to set the child as faulted // allowing the control plane to replace it with another if let Some ( RebuildError :: ReadIoError { .. } ) = job . error { // todo: retry rebuild using another child as source? } recovering_child . fault ( ) ; error ! ( " " job destination self name job error_desc ( ) ) ; } _ => { recovering_child . fault ( ) ; error ! ( " " job destination self name job state ( ) ) ; } } self . reconfigure ( DREvent :: ChildRebuild ) . await ; Ok ( ( ) ) }
On rebuild job completion it updates the child and the nexus
based on the rebuild job's final state
On rebuild job completion it updates the child and the nexus based on the rebuild job ' s final state
&mut self
job
&RebuildJob
&mut self
job
&RebuildJob