Actualiser Backup_OpenStack_Vms_And_Volumes.sh
This commit is contained in:
		
							parent
							
								
									dfd649678c
								
							
						
					
					
						commit
						0e1d8873e4
					
				
					 1 changed files with 10 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -188,42 +188,44 @@ function check_backup(){
 | 
			
		|||
        _info " => Checking the backup of volumes"
 | 
			
		||||
        for BCK_VOLUME in "${BCK_VOLUMES_LIST[@]}"
 | 
			
		||||
        do
 | 
			
		||||
            BCK_VOLUME_TODAY=${BCK_VOLUME}_${TODAY}
 | 
			
		||||
            RESULT=false
 | 
			
		||||
            while [ ! "$RESULT" = "true" ];
 | 
			
		||||
            do
 | 
			
		||||
                _info " Checking Backup for ${BCK_VOLUME} and waiting ${CHECK_FREQUENCY} secondes"
 | 
			
		||||
                _info " Checking Backup for ${BCK_VOLUME_TODAY} and waiting ${CHECK_FREQUENCY} secondes"
 | 
			
		||||
 | 
			
		||||
                CURRENT_TIMESTAMP=`date +%s`
 | 
			
		||||
                if [ "$CURRENT_TIMESTAMP" -gt "$MAXIMUM_TIMESTAMP" ]; then
 | 
			
		||||
                        _err " Backup for ${BCK_VOLUME} verification time expired"
 | 
			
		||||
                        _err " Backup for ${BCK_VOLUME_TODAY} verification time expired"
 | 
			
		||||
                        exit -1
 | 
			
		||||
                fi
 | 
			
		||||
 | 
			
		||||
                RESULT=$(${OPENSTACK} volume backup list -f json | jq -c '.[] |  select(.Name | contains("'${BCK_VOLUME}'")) | .Status == "available"')
 | 
			
		||||
                RESULT=$(${OPENSTACK} volume backup list -f json | jq -c '.[] |  select(.Name | contains("'${BCK_VOLUME_TODAY}'")) | .Status == "available"')
 | 
			
		||||
                sleep ${CHECK_FREQUENCY}
 | 
			
		||||
            done
 | 
			
		||||
            _info_action " Backup Volume ${BCK_VOLUME} is OK"
 | 
			
		||||
            _info_action " Backup Volume ${BCK_VOLUME_TODAY} is OK"
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
        echo ""
 | 
			
		||||
        _info " => Checking Backup Instance"
 | 
			
		||||
        for BCK_INSTANCE in "${BCK_INSTANCES_LIST[@]}"
 | 
			
		||||
        do
 | 
			
		||||
            BCK_INSTANCE_TODAY=${BCK_INSTANCE}_${TODAY}
 | 
			
		||||
            RESULT=false
 | 
			
		||||
            while [ ! "$RESULT" = "true" ];
 | 
			
		||||
            do
 | 
			
		||||
                _info " Checking Backup for ${BCK_INSTANCE} and waiting 60 secondes"
 | 
			
		||||
                _info " Checking Backup for ${BCK_INSTANCE_TODAY} and waiting 60 secondes"
 | 
			
		||||
 | 
			
		||||
                CURRENT_TIMESTAMP=`date +%s`
 | 
			
		||||
                if [ "$CURRENT_TIMESTAMP" -gt "$MAXIMUM_TIMESTAMP" ]; then
 | 
			
		||||
                        _err " Backup for ${BCK_INSTANCE} verification time expired"
 | 
			
		||||
                        _err " Backup for ${BCK_INSTANCE_TODAY} verification time expired"
 | 
			
		||||
                        exit -1
 | 
			
		||||
                fi
 | 
			
		||||
 | 
			
		||||
                RESULT=`${OPENSTACK} image show ${BCK_INSTANCE} -f json | ${JQ} -r '.properties.image_state == "available" and .status == "active"'`
 | 
			
		||||
                RESULT=`${OPENSTACK} image show ${BCK_INSTANCE_TODAY} -f json | ${JQ} -r '.properties.image_state == "available" and .status == "active"'`
 | 
			
		||||
                sleep 60
 | 
			
		||||
            done
 | 
			
		||||
            _info_action " Backup Instance ${BCK_INSTANCE} is OK"
 | 
			
		||||
            _info_action " Backup Instance ${BCK_INSTANCE_TODAY} is OK"
 | 
			
		||||
        done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue