diff --git a/common/usr/bin/openstack-cluster-installer-agent b/common/usr/bin/openstack-cluster-installer-agent index b57c52c5d8d4781739a95849efd0c9facef5fc64..1acf17044327fcd65aa79d7d46a98268213e5dcb 100755 --- a/common/usr/bin/openstack-cluster-installer-agent +++ b/common/usr/bin/openstack-cluster-installer-agent @@ -56,7 +56,7 @@ fi echo ' "interfaces": [' >>${TMPFILE2} for i in $(ip link show | grep -v '^ ' | grep -v 'lo:' | cut -d' ' -f2 | cut -d: -f1 | grep -v vlan | grep -v -E 'bond|qvb.*|qvo.*|vxlan.*|tap.*|qbr.*|qr.*|sg-.*|ha-.*|ovs.*|qg-.*|sg-.*|fg-.*|ovs-system|br-ex|br-int|br-tun|vlan.*') ; do MAC_ADDR=$(ip link show dev $i | grep 'link/ether' | awk '{print $2}') - ETH_SPEED=$(( $(lshw -class network -json 2>/dev/null | jq '.[] | select(.serial|test("'${MAC_ADDR}'")) | .capacity' | head -n 1) / 1000000)) + ETH_SPEED=$(( $(lshw -json 2>/dev/null | jq -f /usr/share/openstack-cluster-installer-common/filterclass.jq --arg F_ARG network | jq '.[] | select(.serial|test("'${MAC_ADDR}'")) | .capacity' | head -n 1) / 1000000)) # Find the neighbors using lldpcli if lldpcli -f json show neighbors | jq -r '.[]["interface"][] | keys[]' | grep -q $i ; then diff --git a/common/usr/share/openstack-cluster-installer-common/filterclass.jq b/common/usr/share/openstack-cluster-installer-common/filterclass.jq new file mode 100644 index 0000000000000000000000000000000000000000..b8e8666616450f3c7046e88c293271427c76bb58 --- /dev/null +++ b/common/usr/share/openstack-cluster-installer-common/filterclass.jq @@ -0,0 +1 @@ +def filterclass(c): . as $in | if type == "object" then if has("class") and .class == c then [ $in ] else reduce keys[] as $key ( []; . + [$in[$key] | filterclass(c)] ) end elif type == "array" then map( filterclass(c) ) else empty end; filterclass($F_ARG) | flatten diff --git a/debian/openstack-cluster-installer-common.install b/debian/openstack-cluster-installer-common.install index ce9fd34415f28c2592d208d742225a3c398a66f2..64372aa8d7b4d20496ee4589463a8914492cc638 100644 --- a/debian/openstack-cluster-installer-common.install +++ b/debian/openstack-cluster-installer-common.install @@ -1 +1,2 @@ common/usr/bin/* /usr/bin +common/usr/share/openstack-cluster-installer-common/* /usr/share/openstack-cluster-installer-common/ diff --git a/utils/usr/bin/oci-hdd-maint b/utils/usr/bin/oci-hdd-maint index a3fa0bdaf41631372178664ff9fa3af6c46c30d8..5d042e044acfad439f291e8d0dafa2b233635696 100755 --- a/utils/usr/bin/oci-hdd-maint +++ b/utils/usr/bin/oci-hdd-maint @@ -4,8 +4,8 @@ set -e #set -x show_disk_status () { - if [ ""$(lshw -class storage -json 2>/dev/null | jq -r '.[]["id"]' | head -n1) = "raid" ] ; then - HDRAID_PROD=$(lshw -class storage -json 2>/dev/null | jq -r '.[]["product"]') + if [ ""$(lshw -json 2>/dev/null | jq -f /usr/share/openstack-cluster-installer-common/filterclass.jq --arg F_ARG storage | jq -r '.[]["id"]' | head -n1) = "raid" ] ; then + HDRAID_PROD=$(lshw -json 2>/dev/null | jq -f /usr/share/openstack-cluster-installer-common/filterclass.jq --arg F_ARG storage | jq -r '.[]["product"]') # echo "Detected RAID card: ${HDRAID_PROD}" #number of physical disks @@ -70,7 +70,7 @@ else if [ -z "${2}" ] ; then usage fi - if [ ""$(lshw -class storage -json 2>/dev/null | jq -r '.[]["id"]' | head -n1) = "raid" ] ; then + if [ ""$(lshw -json 2>/dev/null | jq -f /usr/share/openstack-cluster-installer-common/filterclass.jq --arg F_ARG storage | jq -r '.[]["id"]' | head -n1) = "raid" ] ; then echo "Setting up RAID for device ${2}..." megacli -DiscardPreservedCache -Lall -a0 megacli -CfgLdAdd -r0[32:${2}] WB RA Direct -a0