@@ -100,19 +100,28 @@ prepare_networking() {
100
100
101
101
rename_network_label () {
102
102
# In common criteria certification deployment, user must ensure:
103
- # - The 1st NIC (eth0) is for Management Network
104
- # - The 2nd NIC (eth1) is for Storage Network
105
- # - others (ethX, X>=2) is for Guest Network
103
+ # - The 1st NIC is for Management Network
104
+ # - The 2nd NIC is for Storage Network
105
+ # - others (X>=2) is for Guest Network
106
106
# This function is to rename these network labels to appropriate.
107
107
108
108
if [ " ${CC_PREPARATIONS} " != " true" ]; then
109
109
echo " Skipped common criteria settings"
110
110
return
111
111
fi
112
112
113
- for device in $( ls /sys/class/net | grep -E ' ^eth[0-9]+$ ' )
113
+ for device_path in /sys/class/net/ *
114
114
do
115
- device_id=$( echo ${device} | sed ' s/^eth//' )
115
+ device=$( basename " ${device_path} " )
116
+ network_uuid=$( ${XE} pif-list device=" ${device} " params=network-uuid --minimal)
117
+ if [ -z " ${network_uuid} " ]; then
118
+ continue
119
+ fi
120
+ bridge=$( ${XE} network-list uuid=" ${network_uuid} " params=bridge --minimal)
121
+ if [ -z " ${bridge} " ]; then
122
+ continue
123
+ fi
124
+ device_id=$( echo ${bridge} | sed ' s/^xenbr//' )
116
125
if [ ${device_id} -eq 0 ]; then
117
126
name_label=" Management Network"
118
127
elif [ ${device_id} -eq 1 ]; then
@@ -127,8 +136,7 @@ rename_network_label() {
127
136
continue
128
137
fi
129
138
130
- network_uuid=$( ${XE} pif-list device=${device} params=network-uuid --minimal)
131
- ${XE} network-param-set uuid=${network_uuid} name-label=" ${name_label} "
139
+ ${XE} network-param-set uuid=" ${network_uuid} " name-label=" ${name_label} "
132
140
echo " Renamed network label of ${network_uuid} to ${name_label} , device: ${device} "
133
141
done
134
142
}
0 commit comments