mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
This commit adds the support for creating a Raw Block Volume request using volumemode as block in PVC :-
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: block-claim
spec:
volumeMode: Block
storageClassName: zfspv-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
```
The driver will create a zvol for this volume and bind mount the block device at the given path.
Signed-off-by: Pawan <pawan@mayadata.io>
76 lines
2.7 KiB
Go
76 lines
2.7 KiB
Go
/*
|
|
Copyright 2019 The OpenEBS Authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package tests
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo"
|
|
)
|
|
|
|
var _ = Describe("[zfspv] TEST VOLUME PROVISIONING", func() {
|
|
Context("App is deployed with zfs driver", func() {
|
|
It("Running zfs volume Creation Test", volumeCreationTest)
|
|
})
|
|
})
|
|
|
|
func datasetCreationTest() {
|
|
By("Creating zfs storage class", createZfsStorageClass)
|
|
By("creating and verifying PVC bound status", createAndVerifyPVC)
|
|
By("Creating and deploying app pod", createDeployVerifyApp)
|
|
By("verifying ZFSVolume object", VerifyZFSVolume)
|
|
By("Resizing the PVC", resizeAndVerifyPVC)
|
|
By("verifying ZFSVolume property change", VerifyZFSVolumePropEdit)
|
|
By("Deleting application deployment", deleteAppDeployment)
|
|
By("Deleting pvc", deletePVC)
|
|
By("Deleting storage class", deleteStorageClass)
|
|
}
|
|
|
|
func zvolCreationTest() {
|
|
By("Creating ext4 storage class", createExt4StorageClass)
|
|
By("creating and verifying PVC bound status", createAndVerifyPVC)
|
|
|
|
/*
|
|
* commenting app deployment as provisioning is taking time
|
|
* since we are creating a zfs pool on a sparse file and mkfs
|
|
* is taking forever for zvol.
|
|
* Should create the zfs pool on the disk. Need to check if travis
|
|
* has that functionality.
|
|
*/
|
|
//By("Creating and deploying app pod", createDeployVerifyApp)
|
|
By("verifying ZFSVolume object", VerifyZFSVolume)
|
|
By("verifying ZFSVolume property change", VerifyZFSVolumePropEdit)
|
|
//By("Deleting application deployment", deleteAppDeployment)
|
|
By("Deleting pvc", deletePVC)
|
|
By("Deleting storage class", deleteStorageClass)
|
|
}
|
|
|
|
func blockVolCreationTest() {
|
|
By("Creating default storage class", createStorageClass)
|
|
By("creating and verifying PVC bound status", createAndVerifyBlockPVC)
|
|
|
|
By("Creating and deploying app pod", createDeployVerifyBlockApp)
|
|
By("verifying ZFSVolume object", VerifyZFSVolume)
|
|
By("verifying ZFSVolume property change", VerifyZFSVolumePropEdit)
|
|
By("Deleting application deployment", deleteAppDeployment)
|
|
By("Deleting pvc", deletePVC)
|
|
By("Deleting storage class", deleteStorageClass)
|
|
}
|
|
|
|
func volumeCreationTest() {
|
|
By("Running dataset creation test", datasetCreationTest)
|
|
By("Running zvol creation test", zvolCreationTest)
|
|
By("Running block volume creation test", blockVolCreationTest)
|
|
}
|