Skip to content

Commit

Permalink
Update to use new IBM Cloud CLI PI syntax
Browse files Browse the repository at this point in the history
Signed-off-by: CS Zhang <zhangcho@us.ibm.com>
  • Loading branch information
cs-zhang committed Feb 2, 2024
1 parent 9790f38 commit 76ccda8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ ibmcloud cis instance-set ${CIS_INSTANCE}
# Setting IBMCLOUD_TRACE to true to enable debug logs for pi and cis operations
export IBMCLOUD_TRACE=true

instance_id=$(ibmcloud pi instances --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.serverName == $serverName ) | .pvmInstanceID')
instance_id=$(ibmcloud pi ins ls --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.name == $serverName ) | .id')

ibmcloud pi instance-delete ${instance_id}
ibmcloud pi ins delete ${instance_id}

# Cleanup cis dns records
idToDelete=$(ibmcloud cis dns-records ${CIS_DOMAIN_ID} --name "*.apps.${CLUSTER_NAME}.${BASE_DOMAIN}" --output json | jq -r '.[].id')
Expand All @@ -60,4 +60,4 @@ chmod 0600 ${SSH_PRIVATE}
SSH_OPTIONS=(-o 'PreferredAuthentications=publickey' -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null' -i "${SSH_PRIVATE}")

# Run cleanup-sno.sh to clean up the things created on bastion for SNO node net boot
ssh "${SSH_OPTIONS[@]}" root@${BASTION} "cd ${BASTION_CI_SCRIPTS_DIR} && ./cleanup-sno.sh ${CLUSTER_NAME}"
ssh "${SSH_OPTIONS[@]}" root@${BASTION} "cd ${BASTION_CI_SCRIPTS_DIR}/scripts && ./cleanup-sno.sh ${CLUSTER_NAME}"
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ export IBMCLOUD_TRACE=true

# Creating VSI in PowerVS instance
echo "$(date) Creating VSI in PowerVS instance"
ibmcloud pi instance-create ${POWERVS_VSI_NAME} --image ${POWERVS_IMAGE} --network ${POWERVS_NETWORK} --memory ${POWERVS_VSI_MEMORY} --processors ${POWERVS_VSI_PROCESSORS} --processor-type ${POWERVS_VSI_PROC_TYPE} --sys-type ${POWERVS_VSI_SYS_TYPE} --replicants 1 --replicant-scheme suffix
ibmcloud pi ins create ${POWERVS_VSI_NAME} --image ${POWERVS_IMAGE} --subnets ${POWERVS_NETWORK} --memory ${POWERVS_VSI_MEMORY} --processors ${POWERVS_VSI_PROCESSORS} --processor-type ${POWERVS_VSI_PROC_TYPE} --sys-type ${POWERVS_VSI_SYS_TYPE}

instance_id=$(ibmcloud pi instances --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.serverName == $serverName ) | .pvmInstanceID')
instance_id=$(ibmcloud pi ins ls --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.name == $serverName ) | .id')

# Retrieving ip and mac from workers created in ibmcloud powervs
echo "$(date) Retrieving ip and mac from workers created in ibmcloud powervs"
export MAC_ADDRESS=""
export IP_ADDRESS=""
for ((i=1; i<=20; i++)); do
instance_id=$(ibmcloud pi instances --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.serverName == $serverName ) | .pvmInstanceID')
instance_id=$(ibmcloud pi ins ls --json | jq -r --arg serverName ${POWERVS_VSI_NAME} '.pvmInstances[] | select (.name == $serverName ) | .id')
if [ -z "$instance_id" ]; then
echo "$(date) Waiting for instance id to be populated"
sleep 60
Expand All @@ -52,7 +52,7 @@ for ((i=1; i<=20; i++)); do
done

for ((i=1; i<=20; i++)); do
instance_info=$(ibmcloud pi instance $instance_id --json)
instance_info=$(ibmcloud pi ins get $instance_id --json)
MAC_ADDRESS=$(echo "$instance_info" | jq -r '.networks[].macAddress')
IP_ADDRESS=$(echo "$instance_info" | jq -r '.networks[].ipAddress')

Expand All @@ -71,7 +71,7 @@ if [ -z "$MAC_ADDRESS" ] || [ -z "$IP_ADDRESS" ]; then
fi

# Retrieving wwn from VSI to form the installation disk
volume_wwn=$(ibmcloud pi inlv $instance_id --json | jq -r '.volumes[].wwn')
volume_wwn=$(ibmcloud pi ins vol ls $instance_id --json | jq -r '.volumes[].wwn')

if [ -z "$volume_wwn" ]; then
echo "Required volume WWN not collected, exiting test"
Expand Down Expand Up @@ -637,7 +637,7 @@ ibmcloud cis dns-record-create ${CIS_DOMAIN_ID} --type A --name "*.apps.${CLUSTE
sleep 180

# Rebooting the node to boot from net
ibmcloud pi instance-soft-reboot $instance_id
pi ins act $instance_id --operation soft-reboot

# Updating the boot disk of SNO node to volume attached to VSI, it required only for normal SNO installastion.
if [[ ${INSTALL_TYPE} == "sno" ]]; then
Expand Down

0 comments on commit 76ccda8

Please sign in to comment.