#!/bin/sh
# Check if any migration from NetApp/VNX to Isilon is currently running

# NetApp: check if any migration is starting, running, sleeping or restartable
isi_vol_copy -list | awk '{
                              if ($5 ~ /Starting|Running|Sleeping|Restartable/)
                                  exit 1;
                          }'
if [ $? = 1 ]
then
	isi_upgrade_ulog -e Error "A migration (isi_vol_copy) is running. See 'isi_vol_copy -list' for more details."
	exit 1
fi

# VNX: check if any migration is running
isi_vol_copy_vnx -list | awk '{ 
                                  if ($3 ~ /Running/)
                                      exit 1;
                              }'
if [ $? = 1 ]
then
	isi_upgrade_ulog -e Error "A migration (isi_vol_copy_vnx) is running. See 'isi_vol_copy_vnx -list' for more details."
	exit 1
fi

exit 0
