Out of necessity, another SVC shell script was just born. If you ever need to migrate a whole MDisk group onto another, you quickly discover the limited application of the SVC GUI. Now, you could query the VDisks using your original MDisk Group and then copy and paste the VDisk’s name (or the VDisk ID) into a command line and simply reuse that svctask migratevdisk command over and over.
Luckily IBM blessed the SVC with an SSH interface. So again, we can write a (kinda) simple shell script which may look like this:
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
#!/bin/bash svc_cluster_ip=10.0.0.10 svc_priv_dsa=~/.ssh/id_dsa if [ -z $2 ] ; then echo echo " ${0##*/} [ original_mdiskgrp | target_mdiskgrp | (threads) ]" echo echo " mdiskgrp_old - The MDisk Group which currently contains" echo " the VDisks." echo " mdiskgrp_new - The MDisk Group you wish to migrate the" echo " VDisks migrated to." echo " threads - Number of processes to use for the migration." echo " By default, `migratevdisk` uses 2." echo exit 1; fi if [ ! -f $svc_priv_dsa ] ; then echo " ${0##*/} is missing the SSH DSA private key" echo " needed to access the SAN Volume controller." echo " Please specify the correct path!" fi mdiskgrp_old=$1 mdiskgrp_new=$2 threads=$3 : ${threads:=2} check_running_migrations() { # Get the number of already running migrations. The SVC is currently # able to run 32 migrations at the same time. running="$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmigrate | grep progress | wc -l )" if [ $running -ge 32 ] ; then echo echo " The SVC is already running the maximum amount of migrations" echo " at this time. Please retry, once the running migrations" echo " finished." echo exit 1 fi } check_running_migrations if [ "$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmdiskgrp $mdiskgrp_new &>/dev/null ; echo $? )" = 1 ] ; then echo "${0##*/}: The MDisk Group ($mdiskgrp_new) doesn't existent!" exit 1 fi echo "Legend:" echo echo -e " 33[0;32m*33[0m VDisk migration started successfully" echo -e " 33[0;36m*33[0m VDisk migration skipped (already running?)" echo -e " 33[0;31m*33[0m VDisk migration failed to start (wrong name?)" echo echo "Starting the tasks to migrate VDisks of $mdiskgrp_old to $mdiskgrp_new" for vdisk in $( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsvdisk -nohdr -delim : -filtervalue mdisk_grp_name=$mdiskgrp_old ); do vdisk_id="$( echo $vdisk | cut -d: -f1 )" vdisk_name="$( echo $vdisk | cut -d: -f2 )" # Check if there's already a migration running for this vdisk if [ "$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmigrate | grep "migrate_source_vdisk_index $vdisk_id$" )" != "" ] ; then echo -e " 33[0;36m*33[0m VDisk $vdisk_name ($vdisk_id)" continue fi check_running_migrations ssh -i $svc_priv_dsa admin@$svc_cluster_ip svctask migratevdisk -mdiskgrp $mdiskgrp_new -threads $threads -vdisk $vdisk_name &>/dev/null response=$? [ $response -eq 0 ] && echo -e " 33[0;32m*33[0m VDisk $vdisk_name ($vdisk_id)" || echo -e " 33[0;31m*33[0m VDisk $vdisk_name ($vdisk_id)" running=$((running+1)) done echo |
And the execution would look like this:
1 2 3 4 |
svc-mgmt ~ # svctask_migratemdiskgrp DS3400_146G_R1 DS4700_500G_R6 4 The SVC is already running the maximum amount of migrations at this time. Please retry, once the running migrations finished. |
Or maybe:
1 2 3 4 5 6 7 8 9 10 11 |
svc-mgmt ~ # svctask_migratemdiskgrp DS3400_146G_R1 DS4700_500G_R6 4 Legend: * VDisk migration started successfully * VDisk migration skipped (already running?) * VDisk migration failed to start (wrong name?) Starting the tasks to migrate VDisks from DS3400_146G_R1 to DS4700_500G_R6 * VDisk V_ATLAS_C_01 (25) * VDisk V_AETHER_D_01 (13) * VDisk V_DEIMOS_ROOT |