-
Notifications
You must be signed in to change notification settings - Fork 18
/
script-03.sh
59 lines (43 loc) · 2.23 KB
/
script-03.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/bash
# Improve readability of output
echo "========================================================================================="
echo "===>"
echo "===> Running $0"
echo "===> Create placement policy for filesystem fs1"
echo "===>"
echo "========================================================================================="
# Print commands and their arguments as they are executed
set -x
# Exit script immediately, if one of the commands returns error code
set -e
# Show file that contains the placement rules
echo "===> Show file that contains the placement rules"
cat /vagrant/files/spectrumscale/fs1-placement-policy
# Activate placement rules
echo "===> Activate placement rules"
sudo mmchpolicy fs1 /vagrant/files/spectrumscale/fs1-placement-policy
# Show all active rules
echo "===> Show all active rules"
mmlspolicy fs1
# Create example directory to demonstrate placement rules
echo "===> Create example directory to demonstrate placement rules"
sudo mkdir -p /ibm/fs1/examples/placement_policy
# Create file that will be placed in the system storage pool
echo "===> Create file that will be placed in the system storage pool"
sudo bash -c 'echo "This file will be placed in the system storage pool" > /ibm/fs1/examples/placement_policy/file.hot'
# Create file that will be placed in the capacity storage pool
echo "===> Create file that will be placed in the capacity storage pool"
sudo bash -c 'echo "This file will be placed in the capacity storage pool" > /ibm/fs1/examples/placement_policy/file.txt'
# Show that hot file is placed in the system storage pool
echo "===> Show that hot file is placed in the system storage pool"
mmlsattr -L /ibm/fs1/examples/placement_policy/file.hot | grep 'storage pool name'
# Show that default file is placed in the capacity storage pool
echo "===> Show that default file is placed in the capacity storage pool"
mmlsattr -L /ibm/fs1/examples/placement_policy/file.txt | grep 'storage pool name'
# Show that Storage Scale storage pools are not visible to end users
echo "===> Show that Storage Scale storage pools are not visible to end users"
ls -la /ibm/fs1/examples/placement_policy
wc -l /ibm/fs1/examples/placement_policy/file*
# Exit successfully
echo "===> Script completed successfully!"
exit 0