# Happy Path for ODF Resource Profiles
## SetUp

In the storagesystem creation wizard, find the drop down to choose the resource profile.
By default balanced is selected.
Wait for the storagecluster to become ready
## Testing Change of Profile
On the data foundation tab in the storage section, go to the kebab menu on the storagesystem. Their change the profile.
### Change the profile to higher(balanced-->performance)


#### New Resource Profile is being applied
Storagecluster will be in progressing state, The conditions will show "New resource profile is being applied"

#### Resource Profile successfully applied, storagecluster is ready again

#### Check the new pods with the new resource profile label

### Change the profile to lower(performance-->lean)

#### Resource Profile is being applied

#### Resource Profile applied, Storagecluster is ready again

#### Check the new pods with the new resource profile label

## Test Resource Profile Change Failed
### Reaching resource profile change failed state
#### Create high consumption pods on each node
so that it consumes majority amount of the resources on the cluster, so that when resource profile is changed to performance there isn't enough for all the pods, So we can see the profile change failed behaviour.
```
cat <<EOF | oc create -f -
apiVersion: v1
kind: Pod
metadata:
name: test-pod-1
spec:
priorityClassName: system-node-critical
nodeSelector:
topology.kubernetes.io/zone: us-east-1a
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
resources:
limits:
cpu: '1'
memory: 40Gi
requests:
cpu: '1'
memory: 40Gi
EOF
```
```
cat <<EOF | oc create -f -
apiVersion: v1
kind: Pod
metadata:
name: test-pod-2
spec:
priorityClassName: system-node-critical
nodeSelector:
topology.kubernetes.io/zone: us-east-1b
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
resources:
limits:
cpu: '1'
memory: 40Gi
requests:
cpu: '1'
memory: 40Gi
EOF
```
```
cat <<EOF | oc create -f -
apiVersion: v1
kind: Pod
metadata:
name: test-pod-3
spec:
priorityClassName: system-node-critical
nodeSelector:
topology.kubernetes.io/zone: us-east-1c
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
resources:
limits:
cpu: '1'
memory: 40Gi
requests:
cpu: '1'
memory: 40Gi
EOF
```

#### Now change the profile to performance mode
#### Resource Profile is being applied

#### Resource Profile change failed
After some time, When pods go into pending, the storagecluster will be in error state. The conditions will say "New resource profile failed to apply, please revert to the last working profile"

#### Check the pods

### Recovery from Resource profile change failed
#### Change the resource profile to the last working one
As we were lean profile we will revert to that, the last working profile can be found from sc.status.lastAppliedResourceProfile in the storagecluster CR.
As we were on lean profile change to that.
#### Wait for the resource profile to get applied
#### Now the storagecluster is ready
