async fn hotspare_nexus_replica_count(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 timeout_opts = TimeoutOptions::default()
        .with_max_retries(10)
        .with_timeout(Duration::from_millis(500))
        .with_timeout_backoff(Duration::from_millis(50));
    let mut store = Etcd::new("0.0.0.0:2379")
        .await
        .expect("Failed to connect to etcd.");

    let mut volume_spec: VolumeSpec = store.get_obj(&volume.spec().key()).await.unwrap();
    volume_spec.num_replicas += 1;
    tracing::info!("VolumeSpec: {:?}", volume_spec);
    store.put_obj(&volume_spec).await.unwrap();

    cluster.restart_core().await;

    Liveness::default()
        .request_on_ext(ChannelVs::Volume, timeout_opts.clone())
        .await
        .expect("Should have restarted by now");

    wait_till_volume_nexus(volume.uuid(), volume_spec.num_replicas as usize, "").await;

    let mut volume_spec: VolumeSpec = store.get_obj(&volume.spec().key()).await.unwrap();
    volume_spec.num_replicas -= 1;
    tracing::info!("VolumeSpec: {:?}", volume_spec);
    store.put_obj(&volume_spec).await.unwrap();

    cluster.restart_core().await;
    Liveness::default()
        .request_on_ext(ChannelVs::Volume, timeout_opts)
        .await
        .expect("Should have restarted by now");

    wait_till_volume_nexus(volume.uuid(), volume_spec.num_replicas as usize, "").await;

    DestroyVolume::new(volume.uuid()).request().await.unwrap();
}
/// Remove a replica that belongs to a volume. Another should be created.
Remove a replica that belongs to a volume. Another should be created.
Remove a replica that belongs to a volume . Another should be created .
async fn hotspare_nexus_replica_count(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 timeout_opts = TimeoutOptions::default()
        .with_max_retries(10)
        .with_timeout(Duration::from_millis(500))
        .with_timeout_backoff(Duration::from_millis(50));
    let mut store = Etcd::new("0.0.0.0:2379")
        .await
        .expect("Failed to connect to etcd.");
    let mut volume_spec: VolumeSpec = store.get_obj(&volume.spec().key()).await.unwrap();
    volume_spec.num_replicas += 1;
    tracing::info!("VolumeSpec: {:?}", volume_spec);
    store.put_obj(&volume_spec).await.unwrap();
    cluster.restart_core().await;
    Liveness::default()
        .request_on_ext(ChannelVs::Volume, timeout_opts.clone())
        .await
        .expect("Should have restarted by now");
    wait_till_volume_nexus(volume.uuid(), volume_spec.num_replicas as usize, "").await;
    let mut volume_spec: VolumeSpec = store.get_obj(&volume.spec().key()).await.unwrap();
    volume_spec.num_replicas -= 1;
    tracing::info!("VolumeSpec: {:?}", volume_spec);
    store.put_obj(&volume_spec).await.unwrap();
    cluster.restart_core().await;
    Liveness::default()
        .request_on_ext(ChannelVs::Volume, timeout_opts)
        .await
        .expect("Should have restarted by now");
    wait_till_volume_nexus(volume.uuid(), volume_spec.num_replicas as usize, "").await;
    DestroyVolume::new(volume.uuid()).request().await.unwrap();
}
async fn hotspare_nexus_replica_count ( 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 timeout_opts = TimeoutOptions :: default ( ) . with_max_retries ( 10 ) . with_timeout ( Duration :: from_millis ( 500 ) ) . with_timeout_backoff ( Duration :: from_millis ( 50 ) ) ; let mut store = Etcd :: new ( " " ) . await . expect ( " " ) ; let mut volume_spec : VolumeSpec = store . get_obj ( & volume . spec ( ) . key ( ) ) . await . unwrap ( ) ; volume_spec . num_replicas += 1 ; tracing :: info ! ( " " volume_spec ) ; store . put_obj ( & volume_spec ) . await . unwrap ( ) ; cluster . restart_core ( ) . await ; Liveness :: default ( ) . request_on_ext ( ChannelVs :: Volume , timeout_opts . clone ( ) ) . await . expect ( " " ) ; wait_till_volume_nexus ( volume . uuid ( ) , volume_spec . num_replicas as usize , " " ) . await ; let mut volume_spec : VolumeSpec = store . get_obj ( & volume . spec ( ) . key ( ) ) . await . unwrap ( ) ; volume_spec . num_replicas -= 1 ; tracing :: info ! ( " " volume_spec ) ; store . put_obj ( & volume_spec ) . await . unwrap ( ) ; cluster . restart_core ( ) . await ; Liveness :: default ( ) . request_on_ext ( ChannelVs :: Volume , timeout_opts ) . await . expect ( " " ) ; wait_till_volume_nexus ( volume . uuid ( ) , volume_spec . num_replicas as usize , " " ) . await ; DestroyVolume :: new ( volume . uuid ( ) ) . request ( ) . await . unwrap ( ) ; }
Remove a replica that belongs to a volume.
Remove a replica that belongs to a volume .
cluster
&Cluster
cluster
&Cluster