async fn hotspare_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 specs = GetSpecs::default().request().await.unwrap();

    let replica_spec = specs.replicas.first().cloned().unwrap();
    let replicas = GetReplicas::new(&replica_spec.uuid).request().await;
    let replica = replicas.unwrap().0.first().unwrap().clone();

    // forcefully destroy a volume replica
    let mut destroy = DestroyReplica::from(replica);
    destroy.disowners = ReplicaOwners::from_volume(volume.uuid());
    destroy.request().await.unwrap();

    // check we have 2 replicas
    wait_till_volume(volume.uuid(), 2).await;

    // now add one extra replica (it should be removed)
    CreateReplica {
        node: cluster.node(1),
        name: Default::default(),
        uuid: ReplicaId::new(),
        pool: cluster.pool(1, 0),
        size: volume.spec().size / 1024 / 1024 + 5,
        thin: false,
        share: Default::default(),
        managed: true,
        owners: ReplicaOwners::from_volume(volume.uuid()),
    }
    .request()
    .await
    .unwrap();

    wait_till_volume(volume.uuid(), 2).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_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 specs = GetSpecs::default().request().await.unwrap();
    let replica_spec = specs.replicas.first().cloned().unwrap();
    let replicas = GetReplicas::new(&replica_spec.uuid).request().await;
    let replica = replicas.unwrap().0.first().unwrap().clone();
    // forcefully destroy a volume replica
    let mut destroy = DestroyReplica::from(replica);
    destroy.disowners = ReplicaOwners::from_volume(volume.uuid());
    destroy.request().await.unwrap();
    // check we have 2 replicas
    wait_till_volume(volume.uuid(), 2).await;
    // now add one extra replica (it should be removed)
    CreateReplica {
        node: cluster.node(1),
        name: Default::default(),
        uuid: ReplicaId::new(),
        pool: cluster.pool(1, 0),
        size: volume.spec().size / 1024 / 1024 + 5,
        thin: false,
        share: Default::default(),
        managed: true,
        owners: ReplicaOwners::from_volume(volume.uuid()),
    }
    .request()
    .await
    .unwrap();
    wait_till_volume(volume.uuid(), 2).await;
    DestroyVolume::new(volume.uuid()).request().await.unwrap();
}
async fn hotspare_replica_count ( cluster : & Cluster ) { let volume = CreateVolume { uuid : " " . try_into ( ) . unwrap ( ) , size : 5242880 , replicas : 2 , .. Default :: default ( ) } . request ( ) . await . unwrap ( ) ; let specs = GetSpecs :: default ( ) . request ( ) . await . unwrap ( ) ; let replica_spec = specs . replicas . first ( ) . cloned ( ) . unwrap ( ) ; let replicas = GetReplicas :: new ( & replica_spec . uuid ) . request ( ) . await ; let replica = replicas . unwrap ( ) . 0 . first ( ) . unwrap ( ) . clone ( ) ; // forcefully destroy a volume replica let mut destroy = DestroyReplica :: from ( replica ) ; destroy . disowners = ReplicaOwners :: from_volume ( volume . uuid ( ) ) ; destroy . request ( ) . await . unwrap ( ) ; // check we have 2 replicas wait_till_volume ( volume . uuid ( ) , 2 ) . await ; // now add one extra replica (it should be removed) CreateReplica { node : cluster . node ( 1 ) , name : Default :: default ( ) , uuid : ReplicaId :: new ( ) , pool : cluster . pool ( 1 , 0 ) , size : volume . spec ( ) . size / 1024 / 1024 + 5 , thin : false , share : Default :: default ( ) , managed : true , owners : ReplicaOwners :: from_volume ( volume . uuid ( ) ) , } . request ( ) . await . unwrap ( ) ; wait_till_volume ( volume . uuid ( ) , 2 ) . 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