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

    let rest_api = cluster.rest_v00();
    let volumes_api = rest_api.volumes_api();

    let volume = volumes_api
        .put_volume_target(
            &volume.spec().uuid,
            cluster.node(0).as_str(),
            models::VolumeShareProtocol::Nvmf,
        )
        .await
        .unwrap();

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

    cluster.composer().stop(nexus.node.as_str()).await.unwrap();
    let curr_nexus = wait_till_nexus_state(cluster, &nexus.uuid, None).await;
    assert_eq!(curr_nexus, None);

    cluster.composer().start(nexus.node.as_str()).await.unwrap();
    let curr_nexus = wait_till_nexus_state(cluster, &nexus.uuid, Some(&nexus)).await;
    assert_eq!(Some(nexus), curr_nexus);

    let volume_id = volume_state.uuid;
    let volume = volumes_api.get_volume(&volume_id).await.unwrap();
    assert_eq!(volume.state.status, models::VolumeStatus::Online);

    volumes_api.del_volume(&volume_id).await.unwrap();
}
/// Creates a volume nexus on a mayastor instance, which will have both spec and state.
/// Stops/Kills the mayastor container. At some point we will have no nexus state, because the node
/// is gone. We then restart the node and the volume nexus reconciler will then recreate the nexus!
/// At this point, we'll have a state again and the volume will be Online!
Creates a volume nexus on a mayastor instance, which will have both spec and state.
Stops/Kills the mayastor container. At some point we will have no nexus state, because the node
is gone. We then restart the node and the volume nexus reconciler will then recreate the nexus.
At this point, we'll have a state again and the volume will be Online!
Creates a volume nexus on a mayastor instance which will have both spec and state . Stops / Kills the mayastor container . At some point we will have no nexus state because the node is gone . We then restart the node and the volume nexus reconciler will then recreate the nexus . At this point we ' ll have a state again and the volume will be Online!
async fn missing_nexus_reconcile(cluster: &Cluster) {
    let volume = CreateVolume {
        uuid: "1e3cf927-80c2-47a8-adf0-95c486bdd7b7".try_into().unwrap(),
        size: 5242880,
        replicas: 1,
        ..Default::default()
    }
    .request()
    .await
    .unwrap();
    let rest_api = cluster.rest_v00();
    let volumes_api = rest_api.volumes_api();
    let volume = volumes_api
        .put_volume_target(
            &volume.spec().uuid,
            cluster.node(0).as_str(),
            models::VolumeShareProtocol::Nvmf,
        )
        .await
        .unwrap();
    tracing::info!("Volume: {:?}", volume);
    let volume_state = volume.state;
    let nexus = volume_state.target.unwrap();
    cluster.composer().stop(nexus.node.as_str()).await.unwrap();
    let curr_nexus = wait_till_nexus_state(cluster, &nexus.uuid, None).await;
    assert_eq!(curr_nexus, None);
    cluster.composer().start(nexus.node.as_str()).await.unwrap();
    let curr_nexus = wait_till_nexus_state(cluster, &nexus.uuid, Some(&nexus)).await;
    assert_eq!(Some(nexus), curr_nexus);
    let volume_id = volume_state.uuid;
    let volume = volumes_api.get_volume(&volume_id).await.unwrap();
    assert_eq!(volume.state.status, models::VolumeStatus::Online);
    volumes_api.del_volume(&volume_id).await.unwrap();
}
async fn missing_nexus_reconcile ( cluster : & Cluster ) { let volume = CreateVolume { uuid : " " . try_into ( ) . unwrap ( ) , size : 5242880 , replicas : 1 , .. Default :: default ( ) } . request ( ) . await . unwrap ( ) ; let rest_api = cluster . rest_v00 ( ) ; let volumes_api = rest_api . volumes_api ( ) ; let volume = volumes_api . put_volume_target ( & volume . spec ( ) . uuid , cluster . node ( 0 ) . as_str ( ) , models :: VolumeShareProtocol :: Nvmf , ) . await . unwrap ( ) ; tracing :: info ! ( " " volume ) ; let volume_state = volume . state ; let nexus = volume_state . target . unwrap ( ) ; cluster . composer ( ) . stop ( nexus . node . as_str ( ) ) . await . unwrap ( ) ; let curr_nexus = wait_till_nexus_state ( cluster , & nexus . uuid , None ) . await ; assert_eq ! ( curr_nexus None ) ; cluster . composer ( ) . start ( nexus . node . as_str ( ) ) . await . unwrap ( ) ; let curr_nexus = wait_till_nexus_state ( cluster , & nexus . uuid , Some ( & nexus ) ) . await ; assert_eq ! ( Some ( nexus ) curr_nexus ) ; let volume_id = volume_state . uuid ; let volume = volumes_api . get_volume ( & volume_id ) . await . unwrap ( ) ; assert_eq ! ( volume state status models VolumeStatus Online ) ; volumes_api . del_volume ( & volume_id ) . await . unwrap ( ) ; }
Creates a volume nexus on a mayastor instance, which will have both spec and state.
Creates a volume nexus on a mayastor instance which will have both spec and state .
cluster
&Cluster
cluster
&Cluster