Ejemplo n.º 1
0
 def stage(volume):
     csi_instance.node.NodeStageVolume(
         pb.NodeStageVolumeRequest(
             volume_id=volume.uuid,
             publish_context={"uri": volume.uri, "ioTimeout": io_timeout},
             staging_target_path=volume.staging_target_path,
             volume_capability=get_volume_capability(volume, False),
             secrets={},
             volume_context={},
         )
     )
     staged_volumes[volume.uuid] = volume
Ejemplo n.º 2
0
def test_stage_block_volume(csi_instance, volume_id, stage_context,
                            staging_target_path, block_volume_capability):
    csi_instance.node.NodeStageVolume(
        pb.NodeStageVolumeRequest(
            volume_id=volume_id,
            publish_context=stage_context,
            staging_target_path=staging_target_path,
            volume_capability=block_volume_capability,
            secrets={},
            volume_context={},
        ))
    time.sleep(0.5)
    csi_instance.node.NodeUnstageVolume(
        pb.NodeUnstageVolumeRequest(volume_id=volume_id,
                                    staging_target_path=staging_target_path))
Ejemplo n.º 3
0
def attempt_to_stage_volume_with_missing_volume_capability(
    get_published_nexus, csi_instance, staging_target_path, io_timeout
):
    nexus = get_published_nexus
    with pytest.raises(grpc.RpcError) as error:
        csi_instance.node.NodeStageVolume(
            pb.NodeStageVolumeRequest(
                volume_id=nexus.uuid,
                publish_context={"uri": nexus.uri, "ioTimeout": io_timeout},
                staging_target_path=staging_target_path,
                secrets={},
                volume_context={},
            )
        )
    assert error.value.code() == grpc.StatusCode.INVALID_ARGUMENT
Ejemplo n.º 4
0
def staged_mount_volume(
    csi_instance,
    volume_id,
    stage_context,
    staging_target_path,
    stage_mount_volume_capability,
):
    csi_instance.node.NodeStageVolume(
        pb.NodeStageVolumeRequest(
            volume_id=volume_id,
            publish_context=stage_context,
            staging_target_path=staging_target_path,
            volume_capability=stage_mount_volume_capability,
            secrets={},
            volume_context={},
        ))
    yield
    csi_instance.node.NodeUnstageVolume(
        pb.NodeUnstageVolumeRequest(volume_id=volume_id,
                                    staging_target_path=staging_target_path))
Ejemplo n.º 5
0
def attempt_to_stage_volume_with_missing_volume_id(
    get_published_nexus, csi_instance, staging_target_path, io_timeout
):
    nexus = get_published_nexus
    with pytest.raises(grpc.RpcError) as error:
        csi_instance.node.NodeStageVolume(
            pb.NodeStageVolumeRequest(
                publish_context={"uri": nexus.uri, "ioTimeout": io_timeout},
                staging_target_path=staging_target_path,
                volume_capability=pb.VolumeCapability(
                    access_mode=pb.VolumeCapability.AccessMode(
                        mode=pb.VolumeCapability.AccessMode.Mode.MULTI_NODE_SINGLE_WRITER
                    ),
                    mount=pb.VolumeCapability.MountVolume(
                        fs_type="ext4", mount_flags=[]
                    ),
                ),
                secrets={},
                volume_context={},
            )
        )
    assert error.value.code() == grpc.StatusCode.INVALID_ARGUMENT