Skip to content

Commit 7bfc030

Browse files
weshayutinsseago
andauthored
add a 3 cirros-vm test for manual recreate (#1626)
* add a 3 cirros-vm test for manual recreate * update restore yaml * add some notes * added second test case * updated w/ container based disks for vms * cleanup readme * clean up cirros pv test,readme,results * more cleanup * add screenshot of diff * fix file name * Update tests/e2e/sample-applications/virtual-machines/cirros-test/3-vms/README.MD Co-authored-by: Scott Seago <[email protected]> * Update tests/e2e/sample-applications/virtual-machines/cirros-test/3-vms/README.MD Co-authored-by: Scott Seago <[email protected]> * retested and updated for latest d.s. builds * remove old results --------- Co-authored-by: Scott Seago <[email protected]>
1 parent f0663e9 commit 7bfc030

15 files changed

+680
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Various test cases for backing up / restoring vms using selectors
2+
3+
## DataVolume precreated: backup all, restore one at a time
4+
#### setup:
5+
```
6+
alias velero='oc -n openshift-adp exec deployment/velero -c velero -it -- ./velero'
7+
cd cirros-test-with-dataVolumePV
8+
oc create namespace cirros-test-ds-pv
9+
oc create -f cirros-datasource-datavolume.yaml
10+
oc create -f cirros-test-1.yaml -f cirros-test-2.yaml -f cirros-test-3.yaml
11+
velero backup create backup-cirros-test-pv-all --include-namespaces cirros-test-ds-pv --snapshot-move-data=true
12+
oc delete -f cirros-test-1.yaml -f cirros-test-2.yaml -f cirros-test-3.yaml
13+
```
14+
15+
#### to restore:
16+
```
17+
alias velero='oc -n openshift-adp exec deployment/velero -c velero -it -- ./velero'
18+
velero restore create cirros-test-pv-1 --from-backup backup-cirros-test-pv-all --selector app=cirros-test-pv-1
19+
velero restore create cirros-test-pv-2 --from-backup backup-cirros-test-pv-all --selector app=cirros-test-pv-2
20+
velero restore create cirros-test-pv-3 --from-backup backup-cirros-test-pv-all --selector app=cirros-test-pv-3
21+
```
22+
23+
**The above use case should all work as expected. \0/**
24+
See the results in [cirros-test-with-dataVolumePV/RESULTS](cirros-test-with-dataVolumePV/RESULTS)
25+
26+
**To restore the datasource and datavolume**
27+
You may want to test the restore of the vm's after also deleting the datasource and datavolume.
28+
Include the `openshift-virtualization-os-images` namespace in the original backup.
29+
30+
```
31+
spec:
32+
defaultVolumesToFsBackup: false
33+
storageLocation: velero-sample-1
34+
includedNamespaces:
35+
- cirros-test-ds-pv
36+
- openshift-virtualization-os-images
37+
snapshotMoveData: true
38+
```
39+
40+
* note: restoring by label without the datavolume and datasource previously restored or present will not work unless tagged appropriately.
41+
42+
## DataVolume not precreated, container disk: backup all, restore one at a time
43+
#### setup:
44+
```
45+
alias velero='oc -n openshift-adp exec deployment/velero -c velero -it -- ./velero'
46+
cd cirros-test-with-dataVolumeContainer
47+
48+
oc create namespace cirros-test-cont
49+
oc create -f cirros-test-1.yaml -f cirros-test-2.yaml -f cirros-test-3.yaml
50+
velero backup create backup-cirros-test-cont-all --include-namespaces cirros-test-cont --snapshot-move-data=true
51+
oc delete -f cirros-test-1.yaml -f cirros-test-2.yaml -f cirros-test-3.yaml
52+
```
53+
#### to restore scenario 1: (does NOT work)
54+
See the results in [cirros-test-with-dataVolumeContainer/RESULTS](cirros-test-with-dataVolumeContainer/RESULTS)
55+
56+
```
57+
velero restore create cirros-test-cont-1 --from-backup backup-cirros-test-cont-all --selector app=cirros-test-cont-1
58+
velero restore create cirros-test-cont-2 --from-backup backup-cirros-test-cont-all --selector app=cirros-test-cont-2
59+
velero restore create cirros-test-cont-3 --from-backup backup-cirros-test-cont-all --selector app=cirros-test-cont-3
60+
```
61+
62+
#### to restore scenario 2: (works)
63+
```
64+
velero restore create cirros-test-1 --from-backup backup-cirros-test-cont-all
65+
```
66+
67+
**Velero selectors in some cases are not working, The datavolume PV/PVC is not a restore resource**
68+
69+
[visual diff of restore's resources](cirros-test-with-dataVolumeContainer/RESULTS/visual_diff_of_restore.png)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: cdi.kubevirt.io/v1beta1
2+
kind: DataVolume
3+
metadata:
4+
annotations:
5+
cdi.kubevirt.io/allowClaimAdoption: "true"
6+
cdi.kubevirt.io/storage.deleteAfterCompletion: "false"
7+
cdi.kubevirt.io/storage.prePopulated: cirros-test-cont-1-dv
8+
cdi.kubevirt.io/storage.usePopulator: "true"
9+
creationTimestamp: "2025-02-14T18:02:10Z"
10+
generation: 1
11+
labels:
12+
kubevirt.io/created-by: 6a13cdf9-5248-43c5-af45-173686433723
13+
velero.io/backup-name: backup-cirros-test-cont-all
14+
velero.io/restore-name: cirros-test-cont-1
15+
name: cirros-test-cont-1-dv
16+
namespace: cirros-test-cont
17+
ownerReferences:
18+
- apiVersion: kubevirt.io/v1
19+
blockOwnerDeletion: true
20+
controller: true
21+
kind: VirtualMachine
22+
name: cirros-test-cont-1
23+
uid: 8df919d1-9798-47f8-b4ce-1ba0859d451c
24+
resourceVersion: "24067411"
25+
uid: bf4409e2-1992-4d36-bfb9-3c29857947dc
26+
spec:
27+
pvc:
28+
accessModes:
29+
- ReadWriteOnce
30+
resources:
31+
requests:
32+
storage: 150Mi
33+
volumeMode: Block
34+
source:
35+
registry:
36+
pullMethod: node
37+
url: docker://quay.io/kubevirt/cirros-container-disk-demo
38+
status:
39+
conditions:
40+
- lastHeartbeatTime: "2025-02-14T18:02:10Z"
41+
lastTransitionTime: "2025-02-14T18:02:10Z"
42+
message: No PVC found
43+
reason: NotFound
44+
status: Unknown
45+
type: Bound
46+
- lastHeartbeatTime: "2025-02-14T18:02:10Z"
47+
lastTransitionTime: "2025-02-14T18:02:10Z"
48+
status: "False"
49+
type: Ready
50+
- lastHeartbeatTime: "2025-02-14T18:02:10Z"
51+
lastTransitionTime: "2025-02-14T18:02:10Z"
52+
status: "False"
53+
type: Running
54+
phase: Pending
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Name: cirros-test-cont-1-dv
2+
Namespace: cirros-test-cont
3+
Labels: kubevirt.io/created-by=6a13cdf9-5248-43c5-af45-173686433723
4+
velero.io/backup-name=backup-cirros-test-cont-all
5+
velero.io/restore-name=cirros-test-cont-1
6+
Annotations: cdi.kubevirt.io/allowClaimAdoption: true
7+
cdi.kubevirt.io/storage.deleteAfterCompletion: false
8+
cdi.kubevirt.io/storage.prePopulated: cirros-test-cont-1-dv
9+
cdi.kubevirt.io/storage.usePopulator: true
10+
API Version: cdi.kubevirt.io/v1beta1
11+
Kind: DataVolume
12+
Metadata:
13+
Creation Timestamp: 2025-02-14T18:02:10Z
14+
Generation: 1
15+
Owner References:
16+
API Version: kubevirt.io/v1
17+
Block Owner Deletion: true
18+
Controller: true
19+
Kind: VirtualMachine
20+
Name: cirros-test-cont-1
21+
UID: 8df919d1-9798-47f8-b4ce-1ba0859d451c
22+
Resource Version: 24067411
23+
UID: bf4409e2-1992-4d36-bfb9-3c29857947dc
24+
Spec:
25+
Pvc:
26+
Access Modes:
27+
ReadWriteOnce
28+
Resources:
29+
Requests:
30+
Storage: 150Mi
31+
Volume Mode: Block
32+
Source:
33+
Registry:
34+
Pull Method: node
35+
URL: docker://quay.io/kubevirt/cirros-container-disk-demo
36+
Status:
37+
Conditions:
38+
Last Heartbeat Time: 2025-02-14T18:02:10Z
39+
Last Transition Time: 2025-02-14T18:02:10Z
40+
Message: No PVC found
41+
Reason: NotFound
42+
Status: Unknown
43+
Type: Bound
44+
Last Heartbeat Time: 2025-02-14T18:02:10Z
45+
Last Transition Time: 2025-02-14T18:02:10Z
46+
Status: False
47+
Type: Ready
48+
Last Heartbeat Time: 2025-02-14T18:02:10Z
49+
Last Transition Time: 2025-02-14T18:02:10Z
50+
Status: False
51+
Type: Running
52+
Phase: Pending
53+
Events:
54+
Type Reason Age From Message
55+
---- ------ ---- ---- -------
56+
Normal NotFound 3m50s datavolume-import-controller No PVC found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
Name: cirros-test-cont-1
2+
Namespace: cirros-test-cont
3+
Labels: app=cirros-test-cont-1
4+
velero.io/backup-name=backup-cirros-test-cont-all
5+
velero.io/restore-name=cirros-test-cont-1
6+
Annotations: kubevirt.io/latest-observed-api-version: v1
7+
kubevirt.io/storage-observed-api-version: v1
8+
API Version: kubevirt.io/v1
9+
Kind: VirtualMachine
10+
Metadata:
11+
Creation Timestamp: 2025-02-14T18:02:10Z
12+
Finalizers:
13+
kubevirt.io/virtualMachineControllerFinalize
14+
Generation: 1
15+
Resource Version: 24067415
16+
UID: 8df919d1-9798-47f8-b4ce-1ba0859d451c
17+
Spec:
18+
Data Volume Templates:
19+
Metadata:
20+
Annotations:
21+
cdi.kubevirt.io/storage.deleteAfterCompletion: false
22+
Creation Timestamp: <nil>
23+
Name: cirros-test-cont-1-dv
24+
Spec:
25+
Pvc:
26+
Access Modes:
27+
ReadWriteOnce
28+
Resources:
29+
Requests:
30+
Storage: 150Mi
31+
Volume Mode: Block
32+
Source:
33+
Registry:
34+
Pull Method: node
35+
URL: docker://quay.io/kubevirt/cirros-container-disk-demo
36+
Running: true
37+
Template:
38+
Metadata:
39+
Creation Timestamp: <nil>
40+
Name: cirros-test-cont-1
41+
Spec:
42+
Architecture: amd64
43+
Domain:
44+
Devices:
45+
Disks:
46+
Disk:
47+
Bus: virtio
48+
Name: volume0
49+
Interfaces:
50+
Mac Address: 02:87:36:00:00:7e
51+
Masquerade:
52+
Name: default
53+
Rng:
54+
Machine:
55+
Type: q35
56+
Resources:
57+
Requests:
58+
Memory: 256M
59+
Networks:
60+
Name: default
61+
Pod:
62+
Termination Grace Period Seconds: 0
63+
Volumes:
64+
Data Volume:
65+
Name: cirros-test-cont-1-dv
66+
Name: volume0
67+
Status:
68+
Conditions:
69+
Last Probe Time: 2025-02-14T18:02:10Z
70+
Last Transition Time: 2025-02-14T18:02:10Z
71+
Message: VMI does not exist
72+
Reason: VMINotExists
73+
Status: False
74+
Type: Ready
75+
Printable Status: Provisioning
76+
Volume Snapshot Statuses:
77+
Enabled: false
78+
Name: volume0
79+
Reason: PVC not found
80+
Events: <none>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Name: cirros-test-cont-1
2+
Namespace: openshift-adp
3+
Labels: <none>
4+
Annotations: <none>
5+
6+
Phase: Completed
7+
Total items to be restored: 5
8+
Items restored: 5
9+
10+
Started: 2025-02-14 18:02:09 +0000 UTC
11+
Completed: 2025-02-14 18:02:10 +0000 UTC
12+
13+
Backup: backup-cirros-test-cont-all
14+
15+
Namespaces:
16+
Included: all namespaces found in the backup
17+
Excluded: <none>
18+
19+
Resources:
20+
Included: *
21+
Excluded: nodes, events, events.events.k8s.io, backups.velero.io, restores.velero.io, resticrepositories.velero.io, csinodes.storage.k8s.io, volumeattachments.storage.k8s.io, backuprepositories.velero.io
22+
Cluster-scoped: auto
23+
24+
Namespace mappings: <none>
25+
26+
Label selector: app=cirros-test-cont-1
27+
28+
Or label selector: <none>
29+
30+
Restore PVs: auto
31+
32+
CSI Snapshot Restores: <none included>
33+
34+
Existing Resource Policy: <none>
35+
ItemOperationTimeout: 4h0m0s
36+
37+
Preserve Service NodePorts: auto
38+
39+
Uploader config:
40+
41+
42+
HooksAttempted: 0
43+
HooksFailed: 0
44+
45+
Resource List:
46+
cdi.kubevirt.io/v1beta1/DataVolume:
47+
- cirros-test-cont/cirros-test-cont-1-dv(created)
48+
kubevirt.io/v1/VirtualMachine:
49+
- cirros-test-cont/cirros-test-cont-1(created)
50+
velero.io/v2alpha1/DataUpload:
51+
- openshift-adp/backup-cirros-test-cont-all-fvs4v(skipped)
52+
- openshift-adp/backup-cirros-test-cont-all-nkdsq(skipped)
53+
- openshift-adp/backup-cirros-test-cont-all-tgtb7(skipped)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
NAME PHASE PROGRESS RESTARTS AGE
2+
datavolume.cdi.kubevirt.io/cirros-test-cont-1-dv Pending 107s
3+
4+
NAME AGE STATUS READY
5+
virtualmachine.kubevirt.io/cirros-test-cont-1 108s Provisioning False
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: kubevirt.io/v1
2+
kind: VirtualMachine
3+
metadata:
4+
annotations:
5+
generation: 1
6+
labels:
7+
app: cirros-test-cont-1
8+
name: cirros-test-cont-1
9+
namespace: cirros-test-cont
10+
spec:
11+
dataVolumeTemplates:
12+
- metadata:
13+
annotations:
14+
cdi.kubevirt.io/storage.deleteAfterCompletion: "false"
15+
creationTimestamp: null
16+
name: cirros-test-cont-1-dv
17+
spec:
18+
pvc:
19+
accessModes:
20+
- ReadWriteOnce
21+
resources:
22+
requests:
23+
storage: 150Mi
24+
volumeMode: Block
25+
source:
26+
registry:
27+
pullMethod: node
28+
url: docker://quay.io/kubevirt/cirros-container-disk-demo
29+
running: true
30+
template:
31+
metadata:
32+
creationTimestamp: null
33+
name: cirros-test-cont-1
34+
spec:
35+
architecture: amd64
36+
domain:
37+
devices:
38+
disks:
39+
- disk:
40+
bus: virtio
41+
name: volume0
42+
interfaces:
43+
- masquerade: {}
44+
name: default
45+
rng: {}
46+
machine:
47+
type: q35
48+
resources:
49+
requests:
50+
memory: 256M
51+
networks:
52+
- name: default
53+
pod: {}
54+
terminationGracePeriodSeconds: 0
55+
volumes:
56+
- dataVolume:
57+
name: cirros-test-cont-1-dv
58+
name: volume0

0 commit comments

Comments
 (0)