async fn wait_till_volume_nexus(volume: &VolumeId, replicas: usize, no_child: &str) -> Vec<Child> {
    let timeout = Duration::from_secs(RECONCILE_TIMEOUT_SECS);
    let start = std::time::Instant::now();
    loop {
        let volume = GetVolumes::new(volume).request().await.unwrap();
        let volume_state = volume.0.clone().first().unwrap().state();
        let nexus = volume_state.target.clone().unwrap();
        let specs = GetSpecs::default().request().await.unwrap();
        let nexus_spec = specs.nexuses.first().unwrap().clone();

        if !nexus.contains_child(&ChildUri::from(no_child))
            && nexus.children.len() == replicas
            && nexus_spec.children.len() == replicas
        {
            return nexus.children;
        }
        if std::time::Instant::now() > (start + timeout) {
            panic!(
                "Timeout waiting for the volume to reach the specified state (replicas: '{}', no_child: '{}')! Current: {:#?}",
                replicas, no_child, volume_state
            );
        }
        tokio::time::sleep(Duration::from_secs(1)).await;
    }
}
/// Wait for the published volume to have the specified replicas and to not having the specified
/// child. Wait up to the specified timeout.
Wait for the published volume to have the specified replicas and to not having the specified
child. Wait up to the specified timeout.
Wait for the published volume to have the specified replicas and to not having the specified child . Wait up to the specified timeout .
async fn wait_till_volume_nexus(volume: &VolumeId, replicas: usize, no_child: &str) -> Vec<Child> {
    let timeout = Duration::from_secs(RECONCILE_TIMEOUT_SECS);
    let start = std::time::Instant::now();
    loop {
        let volume = GetVolumes::new(volume).request().await.unwrap();
        let volume_state = volume.0.clone().first().unwrap().state();
        let nexus = volume_state.target.clone().unwrap();
        let specs = GetSpecs::default().request().await.unwrap();
        let nexus_spec = specs.nexuses.first().unwrap().clone();
        if !nexus.contains_child(&ChildUri::from(no_child))
            && nexus.children.len() == replicas
            && nexus_spec.children.len() == replicas
        {
            return nexus.children;
        }
        if std::time::Instant::now() > (start + timeout) {
            panic!(
                "Timeout waiting for the volume to reach the specified state (replicas: '{}', no_child: '{}')! Current: {:#?}",
                replicas, no_child, volume_state
            );
        }
        tokio::time::sleep(Duration::from_secs(1)).await;
    }
}
async fn wait_till_volume_nexus ( volume : & VolumeId , replicas : usize , no_child : & str ) -> Vec < Child > { let timeout = Duration :: from_secs ( RECONCILE_TIMEOUT_SECS ) ; let start = std :: time :: Instant :: now ( ) ; loop { let volume = GetVolumes :: new ( volume ) . request ( ) . await . unwrap ( ) ; let volume_state = volume . 0 . clone ( ) . first ( ) . unwrap ( ) . state ( ) ; let nexus = volume_state . target . clone ( ) . unwrap ( ) ; let specs = GetSpecs :: default ( ) . request ( ) . await . unwrap ( ) ; let nexus_spec = specs . nexuses . first ( ) . unwrap ( ) . clone ( ) ; if ! nexus . contains_child ( & ChildUri :: from ( no_child ) ) && nexus . children . len ( ) == replicas && nexus_spec . children . len ( ) == replicas { return nexus . children ; } if std :: time :: Instant :: now ( ) > ( start + timeout ) { panic ! ( " " replicas no_child volume_state ) ; } tokio :: time :: sleep ( Duration :: from_secs ( 1 ) ) . await ; } }
Wait for the published volume to have the specified replicas and to not having the specified
child.
Wait for the published volume to have the specified replicas and to not having the specified child .
volume
&VolumeId
replicas
usize
no_child
&str
volume
&VolumeId
replicas
usize
no_child
&str