async fn hotspare_missing_children(cluster: &Cluster) {
    let volume = CreateVolume {
        uuid: "1e3cf927-80c2-47a8-adf0-95c486bdd7b7".try_into().unwrap(),
        size: 5242880,
        replicas: 2,
        ..Default::default()
    }
    .request()
    .await
    .unwrap();

    let volume = PublishVolume::new(volume.spec().uuid.clone(), Some(cluster.node(0)), None)
        .request()
        .await
        .unwrap();

    tracing::info!("Volume: {:?}", volume);
    let volume_state = volume.state();
    let nexus = volume_state.target.unwrap().clone();

    let mut rpc_handle = cluster.grpc_handle(cluster.node(0).as_str()).await.unwrap();

    let children_before_fault = volume_children(volume.uuid()).await;
    tracing::info!("volume children: {:?}", children_before_fault);

    let missing_child = nexus.children.first().unwrap().uri.to_string();
    rpc_handle
        .mayastor
        .remove_child_nexus(rpc::mayastor::RemoveChildNexusRequest {
            uuid: nexus.uuid.to_string(),
            uri: missing_child.clone(),
        })
        .await
        .unwrap();

    tracing::debug!(
        "Nexus: {:?}",
        rpc_handle
            .mayastor
            .list_nexus(rpc::mayastor::Null {})
            .await
            .unwrap()
    );
    let children = wait_till_volume_nexus(volume.uuid(), 2, &missing_child).await;
    tracing::info!("volume children: {:?}", children);

    assert_eq!(children.len(), 2);
    // the missing child should have been replaced!
    assert!(!children.iter().any(|c| c.uri == missing_child));

    DestroyVolume::new(volume.uuid()).request().await.unwrap();
}
/// Remove a child from a volume nexus (under the control plane) and waits till it gets added back
Remove a child from a volume nexus (under the control plane) and waits till it gets added back
Remove a child from a volume nexus ( under the control plane ) and waits till it gets added back
async fn hotspare_missing_children(cluster: &Cluster) {
    let volume = CreateVolume {
        uuid: "1e3cf927-80c2-47a8-adf0-95c486bdd7b7".try_into().unwrap(),
        size: 5242880,
        replicas: 2,
        ..Default::default()
    }
    .request()
    .await
    .unwrap();
    let volume = PublishVolume::new(volume.spec().uuid.clone(), Some(cluster.node(0)), None)
        .request()
        .await
        .unwrap();
    tracing::info!("Volume: {:?}", volume);
    let volume_state = volume.state();
    let nexus = volume_state.target.unwrap().clone();
    let mut rpc_handle = cluster.grpc_handle(cluster.node(0).as_str()).await.unwrap();
    let children_before_fault = volume_children(volume.uuid()).await;
    tracing::info!("volume children: {:?}", children_before_fault);
    let missing_child = nexus.children.first().unwrap().uri.to_string();
    rpc_handle
        .mayastor
        .remove_child_nexus(rpc::mayastor::RemoveChildNexusRequest {
            uuid: nexus.uuid.to_string(),
            uri: missing_child.clone(),
        })
        .await
        .unwrap();
    tracing::debug!(
        "Nexus: {:?}",
        rpc_handle
            .mayastor
            .list_nexus(rpc::mayastor::Null {})
            .await
            .unwrap()
    );
    let children = wait_till_volume_nexus(volume.uuid(), 2, &missing_child).await;
    tracing::info!("volume children: {:?}", children);
    assert_eq!(children.len(), 2);
    // the missing child should have been replaced!
    assert!(!children.iter().any(|c| c.uri == missing_child));
    DestroyVolume::new(volume.uuid()).request().await.unwrap();
}
async fn hotspare_missing_children ( cluster : & Cluster ) { let volume = CreateVolume { uuid : " " . try_into ( ) . unwrap ( ) , size : 5242880 , replicas : 2 , .. Default :: default ( ) } . request ( ) . await . unwrap ( ) ; let volume = PublishVolume :: new ( volume . spec ( ) . uuid . clone ( ) , Some ( cluster . node ( 0 ) ) , None ) . request ( ) . await . unwrap ( ) ; tracing :: info ! ( " " volume ) ; let volume_state = volume . state ( ) ; let nexus = volume_state . target . unwrap ( ) . clone ( ) ; let mut rpc_handle = cluster . grpc_handle ( cluster . node ( 0 ) . as_str ( ) ) . await . unwrap ( ) ; let children_before_fault = volume_children ( volume . uuid ( ) ) . await ; tracing :: info ! ( " " children_before_fault ) ; let missing_child = nexus . children . first ( ) . unwrap ( ) . uri . to_string ( ) ; rpc_handle . mayastor . remove_child_nexus ( rpc :: mayastor :: RemoveChildNexusRequest { uuid : nexus . uuid . to_string ( ) , uri : missing_child . clone ( ) , } ) . await . unwrap ( ) ; tracing :: debug ! ( " " rpc_handle mayastor list_nexus ( rpc mayastor Null { } ) await unwrap ( ) ) ; let children = wait_till_volume_nexus ( volume . uuid ( ) , 2 , & missing_child ) . await ; tracing :: info ! ( " " children ) ; assert_eq ! ( children len ( ) 2 ) ; // the missing child should have been replaced! assert ! ( children iter ( ) any ( c c uri missing_child ) ) ; DestroyVolume :: new ( volume . uuid ( ) ) . request ( ) . await . unwrap ( ) ; }
Remove a child from a volume nexus (under the control plane) and waits till it gets added back
Remove a child from a volume nexus ( under the control plane ) and waits till it gets added back
cluster
&Cluster
cluster
&Cluster